PDA

View Full Version : Ways to edit ts file for same length audio & video?


HookedOnTV
6th August 2005, 17:58
I have HD ts files that I would like to convert over to XviD. The problem I have been having is a loss of a/v sync as the movie progresses. I recently found a thread discussing this and that the cause was probably different duration of the audio and video streams. Demux (DGIndex, which alerts the first frame does not start on a GOP boundary) and compare. Yep.

I've seen mention of using besweet to change the length of the audio stream (although I don't see how from the besweet gui), maybe projectx or cuttermaran. But none have been detailed enough to understand.

What are some ways to fix the problem? If the audio is longer and I shorten it should I cut off the beginning or the end? Will the delay for muxing be the same as detected by DGIndex or will I have to just mux it a half dozen times to find the correct delay? I use HDTVtoMPEG2 to cut the beginning and end off the capture. Would another editor yield a better file that would have matching audio and video stream durations?

Any suggestions, links etc would be greatly appreciated.

Pookie
6th August 2005, 20:24
Download this version of ProjectX - http://rapidshare.de/files/3717861/ProjectX__Fixed.zip.html

Use the Demux choice and it will ensure the audio and video are in sync. Convert the Demuxed video file to XVID with your favorite method, then remux the XVID AVI with the ac3 file you had demuxed with ProjectX

neuron2
7th August 2005, 03:32
@HookedOnTV

Please follow forum rules, specifically rule 12: Do not ask what's best. Thank you.
:readrule:

HookedOnTV
7th August 2005, 18:12
@HookedOnTV

Please follow forum rules, specifically rule 12: Do not ask what's best. Thank you.
:readrule:

Sorry

Toti
9th August 2005, 05:43
HookedOnTV,

The problem does not lies with the video or audio lengths. It just the errors in the stream. The capturing errors like (dropouts, loss of signal, etc..) create an error on the audio that if not corrected it will be skipped (instead of silenced).

Other words, compress your video normally and before you mux it back with the AC3 audio. Use ac3fix.exe -> AC3 Delay Cut Tool 1.2.0.4 and finally fix the delay with AC3 Delay corrector. The resulting audio should be fixed of errors and it will keep sync with video.

If you don't have the tools I mention let me know and I'll post them here but a simple yahoo search should find them they are all free.

HookedOnTV
9th August 2005, 19:22
Use ac3fix.exe -> AC3 Delay Cut Tool 1.2.0.4 and finally fix the delay with AC3 Delay corrector.

Found all three. What function of AC3 Delay Cut do I use? The "fixcrc"? Assuming the chosen muxing tool allows for delay correction could the use of AC3 Delay Corrector be dropped?

Thanks!

Toti
10th August 2005, 14:26
Yes, if you fix the delay with it you can drop the delay corrector. I don't use fix CRC but I use Silence. Let me know if that helped.

Just curious, How do you get the TS files is it "Over The Air" or "Cable with firewire enabled" or "DirecTV with 169time upgrade"?

Also, why encode to MPEG4? when you can re-encode to MPEG2 and play them on your HD-TV via MyHD? and MyHD even has DVI and Optical outputs. MPEG2 re-encodes will fit on DVD-R or 2hour movie on Dual Layer Discs or 2 DVDRs.

GaveUp
10th August 2005, 20:23
Yes, if you fix the delay with it you can drop the delay corrector. I don't use fix CRC but I use Silence. Let me know if that helped.

Just curious, How do you get the TS files is it "Over The Air" or "Cable with firewire enabled" or "DirecTV with 169time upgrade"?

Also, why encode to MPEG4? when you can re-encode to MPEG2 and play them on your HD-TV via MyHD? and MyHD even has DVI and Optical outputs. MPEG2 re-encodes will fit on DVD-R or 2hour movie on Dual Layer Discs or 2 DVDRs.

As far as sync tools, there's AC3 Cutter you can use. Pretty self explanatory how to use it. The problem with the ac3fix util is that it's very dumb in the way it works. It works by just chopping off the extra data to get the correct packet length, which as I'm sure you've heard if you've used enough, can result in pops and squeaks in the audio stream. A much better solution is the one employed by ProjectX, DelayCut, and AC3 Cutter, which finding corrupt packets and replacing them with silence. Most of the times, if there are not many consequtivly bad frames in the AC3 this fix will be unnoticable while watching. Also, ProjectX, DelayCut, and AC3 Cutter will eliminate the need for the delay correction tool as they do that automatically. AC3 Cutter will also fix a problem that can arrise specifically when going to an AVI destination format where if the audio is VBR (Fox broadcasts 448 for shows, 192 for commercials). When it is VBR it gets mischunked in the AVI and will cause stuttering of the video and afterwards desync.

As for why to encode to MPEG-4, quality vs size is a lot better. I do 1280x720p encodes at ~1120MB per hour length program and the quality is great. Compare that to the 4+ gigs you'd need to use with MPEG-2. And for me XBMC on an xbox plays my encodes perfectly. Much more convenient than any of the tv-out solutions there are, in my opinion.

HookedOnTV
10th August 2005, 22:48
Yes, if you fix the delay with it you can drop the delay corrector. I don't use fix CRC but I use Silence. Let me know if that helped.

Just curious, How do you get the TS files is it "Over The Air" or "Cable with firewire enabled" or "DirecTV with 169time upgrade"?

Also, why encode to MPEG4? when you can re-encode to MPEG2 and play them on your HD-TV via MyHD? and MyHD even has DVI and Optical outputs. MPEG2 re-encodes will fit on DVD-R or 2hour movie on Dual Layer Discs or 2 DVDRs.

Caps are from a R5000 Dish box. Don't want anything to do with removable media, everything is online for instant access anywhere in the house. After reaching 2TB of HD TS files it was time to find a new solution and MPEG4 is the only logical one.

So far out of 30 ac3 files only 2 have had errors so I don't think that is where my lip sync issues are coming from.

Toti
15th August 2005, 02:39
Hooked On TV, :eek:

My captures are from SAT using 169time upgrade and OTA. I use DGIndex 1.40 to create a .D2V then Avisynth 2.5X with the following script

--------When IVTC--------------------

LoadPlugin("C:\Program Files\AviSynth 2.5.5\plugins\DGDecode.dll")

LoadPlugin("C:\Program Files\AviSynth 2.5.5\plugins\Decomb521.dll")

mpeg2source("E:\HD Capture\0719-2003\NCIS_Repaired.d2v")

Telecide(1,guide=1)

Decimate(cycle=5)

FieldDeinterlace(Full=False,threshold=15,dthreshold=9)


--------When Interlace--------------------

LoadPlugin("C:\Program Files\AviSynth 2.5.5\plugins\DGDecode.dll")

mpeg2source("E:\HD Capture\0719-2003\NCIS_Repaired.d2v")

then deinterlace using TMPGEnc since is also going to encode
------------------------------------------

The audio I always do the process above (OTA caps have lots of errors, DirecTV not many). I resize using TMPGEnc to 1280X720. Video is always on sync.

NOTE: TV shows like CSI or NCIS. I MUST encode them in parts, these parts are continous but when it comes a commercial break I create a new .d2v file. encode them then mux them by parts. After they have been muxed then merge them. If I don't do it like this each time the commercial break will create a small out of sync.

HOOK On TV. Please post how you encode and your scripts so I can analyse where the problem occurs. I suggest you watch the video you encode and if it starts OK and it slowly gets out of sync. Look for encodes where there was an error if you edited the .ts file (like HDTVtoMPEG2) before the encode, etc...

HookedOnTV
15th August 2005, 02:54
I believe I have identified the problem as video stream errors. Upon further searching it doesn't sound like I am alone. It is actually on the todo list for DGIndex development. There is far more video data available to be dropped during transmission and it is this loss that causes the loss of a/v sync. Eventually the audio is behind the video which is a pretty good indicator that some video data is missing.

I'm looking at the Videoredo software right now to see what it might be able to do.

Toti
15th August 2005, 06:24
Have you tried MPEG Repair 1.0.0.9 ? I use it sometimes to repair the .ts streams before encode. It fixes alot of the problems but some do get thru it and when one does it creates the out-of-sync problem. Give it a try and let me know if it works for you.

neuron2
15th August 2005, 14:21
Please do not attach large executables when a simple link will suffice. Here is the link:

http://users.adelphia.net/~mwilczyn/mpeg2repair/

HookedOnTV
15th August 2005, 15:17
I've tried mpeg2repair and it doesn't have the ability to correct these problems. It can detect them and does log them. I had a short conversation with the author on another forum. He recommended looking at ProjectX, which for me just thinks every frame is bad, and VideoRedo which I am looking at.

Toti
17th August 2005, 05:47
Hooked, I wouldn't know since I recompress in MPEG2 and I do not experience that problem at all. After I fix the AC3 audio and mux them they are always in sync. I re-encode SAT with the 169time upgrade, OTA and downloads in HD that are either .mov/.avi/.wmv I have even used the audio from the DVDs I have (movies) and after fixing the delay they are always in sync.

If you do find a fix please post it since I might run in some problem like yours.

HookedOnTV
17th August 2005, 16:02
You can use mpeg2repair in "log mode" to analyze the file which for me shows video data errors in the files I have trouble with. Video has errors while audio doesn't. Not enough video to go with the audio, which is what is causing the a/v sync loss.

Fix? VideoRedo seems to be doing the trick for me. It removes the audio that has no video.