View Full Version : Please critique my ATSC 1080i ivtc to XviD technique
ufdent98
16th November 2006, 13:42
As I still occasionally come up with unsolvable audio/video synch problems, I'm hoping someone can figure out where I'm going wrong.
Goal: To take ATSC broadcast 1080i content, which has been telecined from a film source, and then resize and XviD compress it.
Current Method:
1. Video capture with VBox catseye tuner, BeyondTV software on WinXPpro to a Original.tp file
2. Run Original.tp through mpeg2repair, stripping null packets, stripping extra streams, repairing macroblocks. Original.tp --> Original_fixed.tp
3. Run Original_fixed through HDTVtoMPEG2, only converting to .mpg format, no clipping of the stream Original_fixed.tp --> Original_fixed.mpg
4. Run DGIndex on Original_fixed.mpg, IDCT algorithm, Honor Pulldown Flags, Demux all Tracks.
5. Run BeLight to convert AC3 track to .wav. Belight automatically registers the proper delay.
6. Create the following AVISynth script "1080i.avs" :
load plugin("DGDecode.dll")
load plugin("decomb.dll")
video=mpeg2source("Original_fixed.D2V")
audio=wavsource("Original_fixed yada yada .wav")
audiodub(video,audio)
telecide()
decimate()
lanczos4resize(1280,720)
7. Run VirtualDub. Load in above .avs script (1080i.avs). Set in virtual dub:
Video (compression XviD quality based 3)
Audio (Interleaving on, no preload, interleaved every 1 frame, no delay)(Compression Lame, 48000, 128kbs, CBR)(Source audio)(Full processing)
And yet still, occasional shows come out where the sync steadily gets further out during the show.
HELP!
steve
Pookie
16th November 2006, 23:44
All of the apps you're using are good. MpegRepair is a great app, but not required unless your source is seriously messed up. Try the following combination if you want to experiment with a different "pre-processing" method.
Make sure you have Quicktime Alternative installed.
1) Open your .TS/.TP file with MpegStreamClip. Choose File-->Convert To Mpeg
http://www.squared5.com/svideo/mpeg-streamclip-win.html
2) Open your resulting .MPG file in Mpeg2Cut2. Remove the commercials.
http://www.geocities.com/rocketjet4/
3) DGindex the now commercial free Mpeg and Save the AC3 file
4) Transcode -- BTW - Look for a plugin called Bt709toBt601 to fix the color/darkness issues of HD-SD conversion.
Also, choose "Fast Recompress" instead of Full Processing mode in VirtualDub
I wouldn't process the audio along with the video in Avisynth, it'll only slow down an already CPU intensive process. You can convert the sound from AC3 to MP3 right inside Belight, then mux the resulting Audio and newly transcoded video in VirtualDub or AviMuxGUI.
ufdent98
17th November 2006, 01:38
Thanks!
Further questions:
1. Let's say the length of the original .ts/.mpg file is 30 minutes, at 29.97 FPS. When it goes through the telecide/decimate process, doesn't that mess up sync of the audio? That's why I've been doing that whole audiodub(video,audio) step prior to the telecide/decimate, in order to get audio and video frame by frame interleaved, so that as frames are decimated, it's the matching audio and video frames together.
2. If Belight produces a .wav file from the ac3 source, does the delay which is auto loaded by belight mean that I should use no audio delay in VirtualDub, or should I pass that delay value on again.
3. Should I be using the framerate conversion of BeLight from 29.97 to 23.976 when producing the .wav, or perhaps somewhere in VirtualDub?
Thanks again for the input.
Steve
Pookie
17th November 2006, 02:56
Nope, it doesn't work that way. Your original audio will still be synched with your new 23.976fps file. Cool, huh ? You can even mux your original AC3 file with your new AVI video.
If Belight recognizes the delay info from the file name, it will correct the output file. In other words, if you fixed it in Belight, then VirtualDub doesn't need to do any delay correction.
No framerate conversion needed for IVTCed material.
TEB
17th November 2006, 17:17
Hi. as a comment on nr3. Why not skip this stage AFAIK dgindex supports Transportstreams anyway. I only use hdtv2mpeg for a easy way to join lots of mpeg clips into one.. Besides that use dxindex..
my 2 cents
ufdent98
17th November 2006, 18:28
I can't wait to get home and try the advice, Pookie. Thanks!
TEB - When I commercial cut with hdtv2mpeg, i often get an a/v sync issue. So I'd like to avoid it.
I'm curious to see how well mpeg2cut2 works, and if it will work on a .ts/.tp file, or if the hdtv2mpeg or mpegstreamclip conversion to .mpg is needed.
steve
Pookie
17th November 2006, 21:25
Mpeg2Cut2 will sort of work on Transport Streams ONLY if they've been stripped of the junk PIDs (eg - Doppler Radar, Infommercials). Open up a multi-PID TS file and scroll through it in Mpeg2Cut2...:D You can actually choose the PID you wish to view, but cutting the stream results in an error/warning message from the app, and the resulting saved clip isn't quite...right. Hence, the conversion of TS to PS in MpegStreamClip
ufdent98
19th November 2006, 01:36
So far, things working pretty well. I'm deciding between:
1. DGIndex the raw .ts file, Belight the resultant ac3 to mp3, compress/resize the .dv2 file in virtualdub to xvid, AviMuxGui everything together, then pull up the result in an avi editing program and chop out the commercials at the end (currently virtualdub direct streaming out clips, then loading/autoappend and direct stream final product)
vs.
2. Mpeg2repair on the raw .ts file to make it acceptable by mpeg2toHDTV, mpeg2toHDTV to convert to .mpg, cut commercials with mpg2cut2, DGIndex, Belight, AviMuxGui.
Ie, is it better to cut commercials before or after?
Thanks Pookie
steve
ufdent98
19th November 2006, 01:38
Oh - what do you think the field operation in DGIndex ought to be?
I'm usually changing so many things I haven't tested Honor Pulldown flags vs. Ignore vs. Force Film. Aren't the commercials NOT telecined, so it needs the Pulldown flags to help differentiate between?
ufdent98
19th November 2006, 01:50
And StreamClip crashes when opening my .tp file. Tried opening it under open all files, then tried renaming it to .ts, no luck.
Pookie
19th November 2006, 05:59
Did you install Quicktime Alternative? Can you open ANY mpeg file with StreamClip ?
http://www.free-codecs.com/download/QuickTime_Alternative.htm
ufdent98
19th November 2006, 15:03
quicktime alternative installed. mpgs load right up.
steve
current trial:
dgindex the original .tp file, ignore pulldown flags.
virtualdub transcode the .d2v with xvid.
belight convert the .ac3 to .mp3
avimuxgui.
result - sound good first 20min, slowly going out of sync.
Next run, belight converting the FPS of the .ac3 29.97003 to 23.976 when converting to .mp3
steve
Turtleggjp
20th November 2006, 21:32
Oh - what do you think the field operation in DGIndex ought to be?
I'm usually changing so many things I haven't tested Honor Pulldown flags vs. Ignore vs. Force Film. Aren't the commercials NOT telecined, so it needs the Pulldown flags to help differentiate between?
I think you only need to honor pulldown flags if your source alternates between 29.97 fps and 23.976 fps. Using Ignore Pulldown flags in this case would cause your entire clip to be interpreted as 29.97 fps, which will cause the video to playback too fast when it changes to 23.976. Using Honor Pulldown Flags in this case would cause the 23.976 fps material to be telecined into 29.97 fps to match the rest of the clip. Force Film can be used when almost the entire stream is 23.976, but there are a few 29.97 fps sections which may cause sync problems. In my experience, I have only seen this type of mixed material on DVDs. All 1080i HDTV content that I have seen has been 29.97 fps interlaced, so I usually set my field operation to Ignore Pulldown flags when working with 1080i. I have yet to see 1080i content broadcast at 23.976 fps with pulldown flags, but then again I only have experience in one area...
Also, if you ever work with 720p material, there is no interlacing and no pulldown flags, so then I would imagine you would want to keep it on Ignore Pulldown Flags, so it doesn't try to introduce any unexpected interlacing into your clip.
So far, things working pretty well. I'm deciding between:
1. DGIndex the raw .ts file, Belight the resultant ac3 to mp3, compress/resize the .dv2 file in virtualdub to xvid, AviMuxGui everything together, then pull up the result in an avi editing program and chop out the commercials at the end (currently virtualdub direct streaming out clips, then loading/autoappend and direct stream final product)
vs.
2. Mpeg2repair on the raw .ts file to make it acceptable by mpeg2toHDTV, mpeg2toHDTV to convert to .mpg, cut commercials with mpg2cut2, DGIndex, Belight, AviMuxGui.
Ie, is it better to cut commercials before or after?
Seems like this question comes up a lot. My method is to use ProjectX to split my .tp file into a .m2v file and a .ac3 file with no delay. It usually does a pretty good job at keeping the audio and video in sync. However at this stage it is still unedited for commercials. I then use VirtualDub to cut the video precisely the way I want it (not restricted to key frames from the original MPEG2 file) and I then save the resulting processing settings into a .vcf file. I then use the frame numbers from the .vcf file to make a series of AVISynth Trim commands, which go at the beginning of my script right after I load my video. After that comes the same Telecide and Decimate commands you mentioned, and then you can resize to whatever size you want. The only trick with this method is cutting the audio. If you use BeLight to transcode your AC3 to a .wav file, you can load it into VirtualDub when you are cutting the commercials, and use the Save Wave command after you have finished. The result is a .wav file that is cut to match the video that your script produces. When you load your script to process the video, simply load the cut .wav file and compress it to your desired format as well. You may also be able to have AVISynth load your full length .wav file and have the Trim commands cut the audio as well. I don't do it this way, because I have not had much luck in the past using AVISynth with audio, so I use it strictly to process video only. If however you wish to keep your soundtrack as untouched AC3, then cutting it can be more complicated. I currently use the program AC3 Cutter in conjunction with an Excel spreadsheet I created which helps guide AC3 Cutter. Using this method, I was able to take a clip and cut it in more than 20 places (for experiment only) and the result never drifted out of sync.
A more appropriate question would be if you want to cut the commercials before or after removing the transport stream packaging. In theory, cutting it while it is still a transport stream should not cause loss of sync, but may cause unpredictable results right at the cut points. Cutting it afterwards makes things more difficult when preserving AC3 audio, but no weird video at cut points. Going a step further and cutting it after your have converted it to XviD should also not cause loss of sync, but then you once again are restricted to cutting on keyframes (which may be much farther apart, depending on how you encoded it) and you also spent some extra time encoding stuff that you are throwing out later.
Matt
bbobbo
21st November 2006, 21:13
i had the same problem as you--encoding and shrinking 1080i atsc to xvid would lead to gradual audio sync mismatch. my solution process was as follows:
1) edit commercials using hdtvtompeg2
2) demux into .m2v and .ac3 files using projectx
3) remux using mpeg multiplexer
4) encode using autogk
it would work most of the time--it usually only failed if there were too many glitches in the original file.
however, there was another problem which caused me to change my process. i mainly wanted to encode episodes of conan o'brien. for some reason, whenever conan showed a movie clip, projectx would drop a bunch of frames during the clip. not sure if there's something with the change in fps, but it was very annoying.
i ended up using a commercial program called videoredo. its commercial detection isn't as good as hdtvtompeg2's, so i have to do that part by hand now. but i save time by eliminating several steps. and, it keeps the audio and video in sync. here's my process now:
1) edit commericals using videoredo
2) encode using autogk
now, i never have any audio sync problems, and movie clips during conan get encoded properly.
another nice thing is that the preview screen is resizable in videoredo, not fixed like that tiny one in hdtvtompeg2.
i did have to spend a little money for videoredo, but it saved me a lot of hassle. you can trial it for a couple of weeks (i think it also limits you to saving output files of 30 minutes in length).
jmac698
22nd November 2006, 01:26
AddRange lets you use a virtualdub .vcf edits list in avisynth.
http://niiyan.net/?JapanesePlugins
ufdent98
22nd November 2006, 01:37
bbobbo-
Yeah, I've heard good things about videoredo.
Currently, what seems to be working:
1. Run the original .tp through mpeg2repair in order to strip out the extraneous streams and "repair" things.
2. Cut commercials out of the now "fixed" .tp with mpg2cut2.
3. Run DGIndex on resultant .ts file.
4. Run the .D2V file via an .AVS script (see first post for script) through virtual dub to transcode into xvid .AVI
5. Run the .AC3 through Belight to convert to .mp3
6. AviMuxGui the .AVI and .MP3 together.
I'm gonna try autoGK on the .TS file generated in step 2 to replace steps 3-6.
Thanks everyone for the input!
steve
sjchmura
24th November 2006, 19:34
4) Transcode -- BTW - Look for a plugin called Bt709toBt601 to fix the color/darkness issues of HD-SD conversion.
Can you explain this more? If we have an HD-Source and are just making it smaller, 720p,. good for atchiving WHY would you want to mess with the color???
Pookie
24th November 2006, 21:59
Bt709tobt601 or ColorMatrix
http://avisynth.org.ru/docs/english/externalfilters/colormatrix.htm
http://forum.doom9.org/showthread.php?s=&postid=514595#post514595
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.