Log in

View Full Version : AVI becomes shorter when rendered from TS (Transport Stream)


barakori
29th September 2005, 09:39
I'm using the following script to generate an IVTC version of an 1080i movie (originally in TS format):

LoadPlugin("C:\plugins\decomb521vfr1.3\Decomb521VFR1.3_P4-Athlon.dll")
DirectShowSource("C:\movies\my-movie.ts")
Telecide(order=1)
Decimate(cycle=5)
BilinearResize(1024, 576)

When I opened the AVS in VirtualDub everything looked fine, the frame rate changed from 29.97 to 23.976 and the movie retained the same length.

When I rendered the movie (XviD at 6Mbps - I don't care about size and mp3 audio), the result was a movie in which the last 16% of the movie shows a black frame. It looks like the rendered movie just runs a bit faster and was ended after 1:18:21 instead of 1:32:23. Again the result movie is 1:32:19, but the last 14 minutes are black.

I didn't have time to investigate a lot more, but I do know the following:

I tried to render 3000 frames (a little over two minutes), and the error is consistent - the rendered movie is is faster than what I see in VirtualDub
I didn't apply any filters in VirtualDub, just applied the right compression to the video and the audio.
I tried compressing the video using HuffyYUV (and got a HUGE file), the dropped frames are still there...


I'm suspecting the DirectShowSource. I know I had some issues with DirectShow changing the frame rates as an input for TMPEGEnc, but when I look at the AVS file information in VD, I see the right details (23.976, the right number of frames, etc.) I tried, but couldn't load the video using mpeg2dec3.dll.

Has anyone encountered this problem?

Thanks.

Boulder
29th September 2005, 09:50
Have you tried the latest DGIndex/DGDecode combo?

foxyshadis
1st October 2005, 08:48
My first guess would be that the TS is variable frame rate. Virtualdub will (iirc) honor pulldown flags in mpeg2, but directshowsource just hands out whatever raw frames are in the source.

Try DirectShowSource("C:\movies\my-movie.ts",fps=29.97)

DGIndex/DGDecode is probably a better solution overall though.

barakori
2nd October 2005, 11:03
Thanks to both replies. I tried using DGIndex/DGDecode, and I was able to get the film properly - (loading the D2V file). But now the source (as I see it in VirtualDub) doesn't contain any audio. I'd rather have the source audio copied as is (it's DD 5.1ch 384Kpbs). Is there a way to keep the source audio in the D2V file as is? I tried disabling any audio processing, but it didn't help.

foxyshadis
2nd October 2005, 11:39
If you're not doing any trimming, you can just demux the audio (an option in dgindex) and remux it when you're done. If what you want is to attach the audio to the video, you can use nic's mpasource on the demuxed audio and then Audiodub them together.

Sometimes it shows up with mpeg2source, not sure just what option causes it not to.

barakori
2nd October 2005, 14:17
Thanks. I thought the demux option in DGIndex demuxes the channels within the the audio track :-(
After demuxing, will I have a WAV I can use as WAV source in the VirtualDub audio source, or is it an audio source I need to somehow grab in my AVS file?

Guest
2nd October 2005, 14:27
After demuxing, will I have a WAV I can use as WAV source in the VirtualDub audio source, or is it an audio source I need to somehow grab in my AVS file? Demuxing produces a demuxed elementary audio stream, e.g., .ac3. But you can also decode AC3 streams to WAV if you wish. If you demux and not decode, you can source the elementary stream using for example NicAudio in your Avisynth script, or you can use versions of VirtualDub that accept the streams directly, e.g., VirtualDubMod for AC3.

Boulder
2nd October 2005, 15:56
And if you don't want to end up re-encoding the audio, there's always DelayCut which can be used for cutting the ac3 track as needed.

barakori
4th October 2005, 12:49
Okay, so now I have the following script:

video = mpeg2source("C:\movies\mymovie.d2v")
audio = NicAC3Source("C:\movies\mymovie PID 014 T01 2_0ch 384Kbps DELAY -314ms.ac3")
audiodub(video,audio)
Telecide(order=0)
Decimate(cycle=5)
LanczosResize(1024,576)

(I used DGIndex to extract the audio in AC3 format)

But now, when I open the AVS in VirtualDub and check the file information I see the following for the audio: 2 channel (Stereo) 48KHz 16-bit PCM (Uncompressed).

Now, the original AC3 is probably 2Ch (based on the extracted name), the only problem is that I've lost the AC3 encoding. My questions are (does this fit better in a new thread? has this been answered gazillion times?):

Can I somehow get the original AC3 data without any conversion? I'll try VirutalDubMod, but I'd rather have it in a script I can keep, and not in memory as a set of mouse clicks.
Will my audio and video be out of sync because the AC3 track has a "delay" of -314ms?

BTW, I'm using the current movie as a test. The next one has 5.1 channels, so I really want to keep the AC3 track as is. Also, the resize is to fit the resolution of my projector - all the work done here is to prepare the movie to be projected.

Boulder
4th October 2005, 14:42
You don't need to feed the audio track in the Avisynth script. Use DelayCut or BeSweet (+BeLight as a GUI) for delay correction.

foxyshadis
4th October 2005, 17:28
Virtualdubmod will allow you to set a delay on an audio stream. I imagine it works just as well with ac3 in avi, but I do know it works fine with ogm/mkv through it. Just add the stream, right click, and select "interleaving". Then you don't have to modify the source track in any way.

barakori
4th October 2005, 19:27
Thanks for all the replies. Just for the record, here's what worked for me:

I took the video from the D2V created by DGIndex and used VirtualDubMod to load the AC3 audio (created also by DGIndex). I was able to specify the audio delay exactly as described by the last post by foxyshadis.

Thanks again.