Info: How I edited/converted HDB to DivX HD

MPM wrote on 7/13/2007, 4:33 PM
Working on a couple of hobby projects, editing/converting HD Broadcast to DivX HD, I didn’t find a whole lot of information available... I wanted to post a little of what I was able to figure out, hoping that someone might find it useful – might have an easier go of it than I did. This isn’t a definitive guide or workflow, & certainly isn’t fine tuned – just more or less a few tips, stuff I did that I hope might help out, whether you’re posting DivX projects on-line or whatever...

[Why DivX? There are a lot of decent codecs out there, but to my knowledge only 2 allow easy use of CC or subs: DivX & WinMedia... The WinMedia encoder is a bit slow, not having been retooled for several years.]
[Software mentioned is available at videohelp.com, Roxio.com, & DivX.com]

I used WatchHDTV to record the HD Broadcast stream as DVR-MS. The easiest way I’ve found to convert DVR-MS to mpg2 is using the version of Videowave that comes with Roxio EMC9: import (drag) the dvr-ms into Videowave, & it brings up the dialog for the very fast conversion.

Because the video’s a broadcast stream it needs to be tweaked (repaired) before use – Project X works well to demux the mpg2 file, inserting needed GOP sequence headers etc... At the same time I found it useful to do some rough cut edits of commercials, creating segments instead of one longer file.

I found that using whatever player to play back the video worked well to check for any errors, like dropped segments... Muxing the m2v without supplying an audio track converts it to an mpg file that Vegas will open, but it mis-reads the frame size and can be prone to display errors so you might see problems that don’t really exist. Creating a project file from the m2v in DGIndex, then using VFAPI on the project file gives a correctly sized proxy avi that Vegas can use for editing. [Other software for handling HD might be useful, but this worked well enough for limited editing, & I wasn’t looking for another potential layer of complexity.]

I used a simple Avsynth script so I could use the DGIndex project file in VirtualDub: it takes only two lines in a text file with the .avs extension that’s placed in the same folder as the project file...
loadplugin("Your path to...\dgdecode.dll")
mpeg2source(".\your_d2v.d2v")

My reason for using V/Dub was/is simply speed encoding to DivX. Using V/Dub’s Direct Stream Copy, DivX video segments can be chained together into one file; open the first file, append the second, third, and so on. This makes it possible to render just those scenes with edits in Vegas, and then put those scenes together with the rest of the video into a single file. It’s more hands-on, but the considerable difference in speed can make it worthwhile. I want to note that it should also be possible to use the Debugmode frameserver to send the output to V/Dub. That would eliminate the one glitch in my method...

Vegas seems to encode to DivX just fine (if at a slower pace), but the DivX encodes don’t match V/Dub’s using Avisynth, so that they can’t be strung together. The key seems to be the data that is passed to the encoder, and using Avisynth with the Vegas edited segments solved that problem... I rendered to an intermediate avi format in Vegas, then used a single line Avisynth script [either]: AVISource(filename) or AVIFileSource(filename) to open the intermediate in V/Dub. You can always add filters for things like color space to most any Avisynth script.

Setting up V/Dub I opened the (Avisynth) .avs file, swapped the input/output displays, and added the resize filter setting the new height to 480. Using Fast Recompress or Direct Stream Copy, filters aren’t enabled, so all this does is make it convenient. Making an EDL using Vegas, I mapped out edits, but before editing, encoded everything else in V/Dub while I could still match frame numbers.

Audio in HDTV Broadcast can be in a number of formats... I use Belight to get 6 .wav files out of 5.1 AC3. There are several other methods to get down-mixed stereo if you prefer – I like Graphedit & DVD Player filters. However you get it, you probably want to import your .wav audio into Vegas so that it can be edited along with the video. Because I pieced the final video together I didn’t render the audio until I could import the final DivX file into Vegas to compare with the original VFAPI proxy file – this was probably a bit “Monkish” (for those familiar with the series), since I wasn’t off by more than a few frames, but I re-edited the audio to match none-the-less.

I found a lot of questions on-line re: importing DivX into Vegas; Nic’s 4CC changer is included with Xvid, and using it to set both codes to DIVX worked for me. DivX muxing software is available at the DivX.com site. One big caveat: If the final HD result plays out of sync, it could just as easily be your system or software as an error in putting everything together. If in doubt, try a smaller frame test...

Decoding & displaying 1080p DivX is not a trivial matter, particularly if Post Processing is used; while the video might look good & play smoothly, frames can be delayed or dropped neatly enough that you don’t notice anything except the lack of sync. On 1 system only after quite a bit of tweaking DivX & wmplayer settings could I get 720p with MP3 stereo playing full screen in sync. On another turning off Auto Deblocking was required for full screen 1080p w/AC3 6ch. Attempting to re-sync the audio would not have worked in either case, but thrown sync off on every system.

Comments

p@mast3rs wrote on 7/13/2007, 8:30 PM
And you could have used MeGUI and its one click mode to encode directly to H.264 AVC and retained higher quality than you could have ever had using Divx. Mpeg-4 ASP is a quickly dying format and hardly offers any advantage over H.264 AVC.
Laurence wrote on 7/14/2007, 8:24 AM
Yeah but that doesn't give you subtitles or alternate audio tracks.
p@mast3rs wrote on 7/14/2007, 11:17 AM
Laurence, it actually does. The MP4 Container isnt restricted like the avi container. I can have an mp4 file with multiple audio tracks and subs all in the same file and not have to include subs in another file like avi requires.
4eyes wrote on 7/16/2007, 8:18 AM
I've been encoding .m2t or cineformhd HDV files to the hd-divx@8mbs w/mp3 audio, Interlaced uff.
These videos encoded at 8mbs look better to me then avchd(h264) encoded @ 8mbs. I have to encode the h264's at about 12mbs to get back to the original hdv.m2t quality.
I'm using an external hd-divx player to playback the videos and a PS3 to playback the h264 files.
Some say don't use interlaced for divx but my player has no problem playing them. The computer doesn't play them very well though. I'm using another program to create the hd-divx files.