View Full Version : HDV to h264
mrcubehead
26th June 2006, 18:14
I can't find much info out there for transcoding HDV 25Mbps mpeg ts to h264 (particularly with x264). I don't know if that's because it's not something you'd want to do, or simply that the info isn't there. If it's the former, could someone please explain why this isn't a good idea? If it's the latter, hopefully there's a good solution so I can cut down the file sizes :) I'd be curious if anyone's done this and could mention their procedure or avs script? (I have a sony HDR-HC1). Details like, do you need LanczosResize to alter the 1440x1080 non-square pixels? Do you need crop(0,0,0,-8) to make it a multiple of 16 for x264? Would you deinterlace, drop frames, etc? Do you use dgdecode or directshowsource directly?
Thanks in advance! :)
bond
26th June 2006, 20:24
no need to change the 1080 to 1088
SeeMoreDigital
26th June 2006, 20:42
No doubt your HDV 1440x1080 MPEG-2 source will be pure interlaced...
When encoding to MPEG-4 AVC will it be your intension to stay interlaced or de-interlace? CoreAVC now offers a direct-show filter that offers interlaced decoding.
EDIT: Either way, if you decide to generate an MPEG-4 AVC stream at 1440x1080 you can add aspect ratio signalling so it will be displayed at 16:9 too...
Cheers
mrcubehead
26th June 2006, 21:20
When encoding to MPEG-4 AVC will it be your intension to stay interlaced de-interlace?
Good question. The source is indeed pure interlaced (ntsc). I just read in this link (http://forum.doom9.org/showthread.php?t=111527) that there is a patch for x264 to do interlaced encoding ... although on my previous standard DV encodes, I would use EEDI+TDeint and it looked great (the original interlaced DV AVIs show combing effects on my computer, especially on resizing them during playback). I haven't noticed any combing for my HDV footage. But I think I'll be deinterlacing anyway, at least until x264 and related decoders have robust interlace encoding support. (Aside: does wmv 9 advanced profile support interlacing encodes?) But, something to play with both ways...
I feel like x264 gave me a warning on feeding it a 1440x1080 sized stream because 1080/16 = 67.5, but it didn't crash (it just said encode would be lower quality). I will also play with resizing to 720x480 for dvd (since I probably won't have a bluray or hd dvd burner anytime soon), but I'm most interested in archiving for computer playback at maybe 5-8Mbps. Also, not sure if I need convert to square pixels, but just feeding to virtualdub it was horizontally stretched so I'm thinking I need to do something there -
SeeMoreDigital
26th June 2006, 21:43
It's my personal belief that many people on the forum shy away from generating "pure interlaced" encodes. I guess this is because software players and computer monitors are not very good at displaying them properly.
Thankfully, hardware players (even when connected to progressive capable displays) have no such problems. Indeed my Zensonic Z500 can play and display pure interlaced 1440x1080 HDV camcorder sources and pure interlaced 1440x1080 MPEG4 SP/ASP encodes perfectly ;)
mrcubehead
26th June 2006, 22:13
The Z500 looks really sweet. Maybe I'll get it once I figure out how to do good HDV encodes :)
SeeMoreDigital
26th June 2006, 22:31
The Z500 looks really sweet. Maybe I'll get it once I figure out how to do good HDV encodes :)Indeed...
Until MPEG-4 AVC hardware devices become readily available, MPEG-4 SP/ASP hardware devices make for a great stop-gap!
I hear rumours that a few manufactures are thinking of launching "non disc-drive" MPEG-2/4 AVC/SP/ASP network capable devices - so they don't have to pay Blu-ray, HD-DVD or DVD royalties ;)
mrcubehead
27th June 2006, 05:24
Update:
The best results that I've gotten so far have been from the interlace patched x264 from here (http://forum.doom9.org/showthread.php?t=111527&page=2) and using the CoreAVC decoder (1.1.0.5). My FFDShow is UGLY and/or broken (5/26/06 build) on this interlaced output. I used a plain vanilla avs script:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
mpeg2source("E:\Temp\HD1.d2v")
Trim(0,100)
and Revgen's slightly modified command line:
H:\x264.exe --paff --bitrate 8000 --bframe 2 --b-pyramid --b-rdo --bime --weightb --ref 5 --mixed-refs --filter 0:0 --subme 6 --8x8dct --me hex --trellis 1 --analyse all --threads 2 --thread-input --progress --no-psnr --output "e:\temp\HD1.mp4" "e:\temp\HD1.avs"
(note I only tested 100 frames so I could get some immediate results). If anyone can improve on this, please let me know :)
mrcubehead
6th September 2006, 04:13
I just wanted to post an update on what I'm doing to transcode from HDV to H.264 using x264 in case anyone is curious. First I've used DGIndex to open my m2t file and detect the PIDs one-time-only: the relevant info was MPEG2 Video on PID 0x810 and MPEG1 Audio on PID 0x814. I then wrote a script to do the encode and muxing (my script is in ruby, so consider #{xyz} as standing for text in variable xyz):
DGIndex.exe -IF=[#{target}.m2t] -VP=810 -AP=814 -OM=3 -OF=[#{target}] -EXIT
mplayer.exe -ao pcm:file="#{target}.wav" -vc dummy -vo null "#{target}.m2t"
neroAacEnc.exe -q 0.5 -if "#{target}.wav" -of "#{target}_audio.mp4"
x264.exe #{myopts_pass1}
x264.exe #{myopts_pass2}
MP4Box.exe -add "#{target}_audio.mp4" -add "#{target}_video.mp4:par=4:3" "#{target}_muxed.mp4"
For pass 1 & 2 parameters, I'm playing with various settings from Sharktooth's MeGUI profiles, encoding around --bitrate 8000. For the input, I'm preprocessing with an avs script that looks like this:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\DGDecode.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\EEDI2.dll")
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\TDeint.dll")
mpeg2source("#{target}.d2v")
# Deinterlace - TFF
interp = separatefields().selecteven().EEDI2(field=1)
tdeint(order=1,field=1,edeint=interp)
# 1440:1080 @ 4:3 par == 960:720 @ 4:3 par
LanczosResize(960,720)
mrcubehead
6th September 2006, 18:35
Does anyone know if it's more sane to resize from 1440x1080i to 960x720p with a PAR of 4:3, or 1280x720p square pixels prior to x264 encoding (see avs script above)?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.