digitalFAQ.com Forum

digitalFAQ.com Forum (http://www.digitalfaq.com/forum/)
-   Encode, Convert for streaming (http://www.digitalfaq.com/forum/video-web/)
-   -   Audio out of sync after VirtualDub (http://www.digitalfaq.com/forum/video-web/6169-audio-sync-after.html)

pinheadlarry 10-18-2014 12:07 AM

Audio out of sync after VirtualDub
 
Hi guys, I'm getting bad results with one particular file. A script i've been using with no problems is now giving me audio issues for one captured file.

It hasn't happened with any other captures. Other videos give correct results. I'm guessing the video is losing frames in the process, but how do i fix this? Why would this only happen to only one file?

Here is the script i'm using for the video. I only adjusted the 'top' crop / AddBorders.

HTML Code:

ConvertToYV12(interlaced=true)
AssumeTFF() QTGMC(Preset="Very Slow", TR2=2,EZDenoise=2)
crop(0, 6, 0, -8).AddBorders(0, 8, 0, 6)
DeHalo_Alpha()
GradFun2DBMod(thr=1.5)
LimitedSharpenFaster(strength=50)


sanlyn 10-18-2014 03:53 AM

Is the original capture in nsync?

Your script deinterlaces the video, doubles the number of frames, and doubles the frame rate.

pinheadlarry 10-18-2014 10:40 AM

yeah the original capture is in sync.

The tape i used wasn't in the best condition compared to the other tapes / captures. Not sure if that would have any affect

sanlyn 10-19-2014 06:21 AM

The only "processing" of your video that should be going on is done by Avisynth. VirtualDub just transmits the results from Avisynth to whatever new file and location you specify. Vdub shouldn't be doing any processing of its own, neither video nor audio. In VirtualDub, audio should be output using "direct steram copy" and video should use "fast recompresss".

As noted earlier, the output from VirtualDub will have double the original frame rate and double the number of original frames. The output video should retain the YV12 colorspace that Avisynth outputs. The audio sampling data during capture should be uncompressed PCM audio at 16-bits, 48Khz. Audio should stay that way until you're ready for your final encode into whatever delivery format you have in mind.

You can use video properties menus in VirtualDub or your NLE or something like the free MediaInfo utility to get data statistics from your source files and compare them to your output files. With no sample of the original capture it's not otherwise possible to say what could be going on.

pinheadlarry 10-20-2014 09:46 AM

2 Attachment(s)
All my settings were as you described. Here's the media info for the before and after file.

source:
Attachment 4287

script:
Attachment 4286

sanlyn 10-20-2014 01:13 PM

It's not necessary to make images of MediaInfo panels. The image only shows the "General" info panel. MediaInfo gives a lot more info in the "Text" view, which can be copied and pasted into a post or saved and attached as a text file. Here is a text copy from "Text" view of one of my captures:

Code:

Complete name                            : E:\GDSMAN\B\B.avi
Format                                  : AVI
Format/Info                              : Audio Video Interleave
Format profile                          : OpenDML
File size                                : 2.45 GiB
Duration                                : 6mn 31s
Overall bit rate                        : 53.8 Mbps
Writing library                          : VirtualDub build 32842/release

Video
ID                                      : 0
Format                                  : Lagarith
Codec ID                                : LAGS
Duration                                : 6mn 31s
Bit rate                                : 52.3 Mbps
Width                                    : 640 pixels
Height                                  : 480 pixels
Display aspect ratio                    : 4:3
Frame rate                              : 29.970 fps
Color space                              : YUV
Chroma subsampling                      : 4:2:2
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                      : 5.675
Stream size                              : 2.38 GiB (97%)

Audio
ID                                      : 1
Format                                  : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                : 1
Duration                                : 6mn 31s
Bit rate mode                            : Constant
Bit rate                                : 1 536 Kbps
Channel(s)                              : 2 channels
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Stream size                              : 71.7 MiB (3%)
Alignment                                : Aligned on interleaves
Interleave, duration                    : 33 ms (1.00 video frame)
Interleave, preload duration            : 500 ms

Your audio sampling rate should be 48KHz, not 44Hz. You can change that in VirtualDub by using the "Audio" menu and "full processing mode" for audio only. With the Audio menu set up that way, you can click on "Conversion./." and set audio to 48KHz at 16-bits.

That might not solve the problem entirely, which is a big bug with Qtime and DV captures. Some Avisynth code that can set things straight (assuming you have audio set to full processing mode) is this code that you can use at the end of a script, or just run a script that opens the deinterlaced AVI and adds this line:

Code:

AssumeFPS("ntsc_double",sync_audio=true)

pinheadlarry 10-21-2014 05:22 PM

Wouldn't extra code only be useful if it was happening to all my videos?

If possible, i'd rather figure out why one video has audio issues when the other of 30+ videos.

i tried to change the conversion to 48khz, but that did not work. Also, i do not believe this a DV capture.

sanlyn 10-21-2014 09:37 PM

Quote:

Originally Posted by pinheadlarry (Post 34844)
Wouldn't extra code only be useful if it was happening to all my videos?

Use it only when needed.

Quote:

Originally Posted by pinheadlarry (Post 34844)
If possible, i'd rather figure out why one video has audio issues when the other of 30+ videos.

Difficult to say. The MediaInfo image you posted is just the short bit from the General screen, which doesn't say all that much, for you omitted all the other detail.

Quote:

Originally Posted by pinheadlarry (Post 34844)
i tried to change the conversion to 48khz, but that did not work. Also, i do not believe this a DV capture.

Sometimes fixing the sample rate doesn't change anything, except it does make it DVD/BluRay/AVCHD compatibe. 44KHz isn't valid for the latter.

When you say you think "this" is not a DV capture, which image do you mean? The upper image is MPEG-4 encoded with ProRes in a QuickTime container, isn't it? Did you notice the top video's frame rate ? (it's not 29.97). The lower image wouldn't be DV. Did you notice that the two video versions have a different running time? Is the source video another skating compilation, or is it a recording based on film or movie source? Not enough info to go with.

So far the previous questions haven't been answered. But in general I'd say your original capture doesn't look right. For one thing, the frame rate is off. I'd consider a re-capture. I'd also suggest that if the original source is telecined material, you can't use a deinterlacer on it. What is the general content of the source video?

pinheadlarry 10-23-2014 12:00 PM

Source

Code:

General
Complete name                            : /Users/sean/Desktop/Hoax 5.mov
Format                                  : MPEG-4
Format profile                          : QuickTime
Codec ID                                : qt 
File size                                : 24.2 GiB
Duration                                : 54mn 13s
Overall bit rate mode                    : Variable
Overall bit rate                        : 63.8 Mbps
Encoded date                            : UTC 2014-10-23 03:23:42
Tagged date                              : UTC 2014-10-23 04:17:56
Writing library                          : Apple QuickTime

Video
ID                                      : 1
Format                                  : ProRes
Format version                          : Version 0
Format profile                          : High
Codec ID                                : apch
Duration                                : 54mn 13s
Bit rate mode                            : Variable
Bit rate                                : 62.3 Mbps
Width                                    : 640 pixels
Height                                  : 480 pixels
Display aspect ratio                    : 4:3
Frame rate mode                          : Variable
Frame rate                              : 29.888 fps
Minimum frame rate                      : 2.580 fps
Maximum frame rate                      : 29.970 fps
Color space                              : YUV
Chroma subsampling                      : 4:2:2
Scan type                                : Progressive
Bits/(Pixel*Frame)                      : 6.791
Stream size                              : 23.6 GiB (98%)
Writing library                          : Apple
Language                                : English
Encoded date                            : UTC 2014-10-23 04:17:56
Tagged date                              : UTC 2014-10-23 04:17:56
Matrix coefficients                      : BT.601

Audio
ID                                      : 2
Format                                  : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                : sowt
Duration                                : 54mn 13s
Bit rate mode                            : Constant
Bit rate                                : 1 411.2 Kbps
Channel(s)                              : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 44.1 KHz
Bit depth                                : 16 bits
Stream size                              : 547 MiB (2%)
Language                                : English
Encoded date                            : UTC 2014-10-23 04:17:56
Tagged date                              : UTC 2014-10-23 04:17:56


Script

Code:

General
Complete name                            : /Users/sean/Desktop/bladescript.avi
Format                                  : AVI
Format/Info                              : Audio Video Interleave
Format profile                          : OpenDML
File size                                : 27.7 GiB
Duration                                : 54mn 6s
Overall bit rate                        : 73.2 Mbps
Writing library                          : VirtualDub build 35491/release

Video
ID                                      : 0
Format                                  : Lagarith
Codec ID                                : LAGS
Duration                                : 54mn 6s
Bit rate                                : 71.8 Mbps
Width                                    : 640 pixels
Height                                  : 480 pixels
Display aspect ratio                    : 4:3
Frame rate                              : 59.940 fps
Color space                              : YUV
Chroma subsampling                      : 4:2:0
Bit depth                                : 8 bits
Bits/(Pixel*Frame)                      : 3.898
Stream size                              : 27.1 GiB (98%)

Audio
ID                                      : 1
Format                                  : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                : 1
Duration                                : 54mn 6s
Bit rate mode                            : Constant
Bit rate                                : 1 411.2 Kbps
Channel(s)                              : 2 channels
Sampling rate                            : 44.1 KHz
Bit depth                                : 16 bits
Stream size                              : 546 MiB (2%)
Alignment                                : Aligned on interleaves
Interleave, duration                    : 17 ms (1.00 video frame)
Interleave, preload duration            : 500 ms


pinheadlarry 10-23-2014 12:02 PM

I did a recapture but got the same results. The video is one of a series, and this is the only video from the series or any video that has given me this problem with this script.

sanlyn 10-23-2014 12:22 PM

Thanks for the info text.

The problem I see is that your capture used a variable frame rate. Should be fixed rate, 29.97 fps for NTSC.

pinheadlarry 10-24-2014 06:19 PM

1 Attachment(s)
Just to make sure i'm not confusing anything, I should change the "Best" to 29.97?

Attachment 4289

sanlyn 10-24-2014 07:43 PM

Bet framerate? Best for what? Maybe you better set it to the framerate of your source video so that the video and the audio will run at same constant frame rate.


Turn off autogamma ! ! ! ! ! !

pinheadlarry 10-25-2014 09:35 AM

best is the default, which is why asked if that is what i should change to 29.97....

Also, i recaptured with the 'correct' settings ( i changed best to 29.97), and ran the script but got the same results. I checked the media info and it is almost identical to the capture i used with "best". Framerate still says "variable".

Not sure if it's the software or the tape..

sanlyn 10-25-2014 12:58 PM

You would have one file after capturing, another file after running the QTGMC script. The file to scheck for audio sync is the capture file, not the deintelaced file. Your capture might have video that shouldn't be deintelaced. What is the source tape's content? Skateboarding? A movie? What does mediainfo say about the captured tape before it was deinterlaced?

pinheadlarry 11-04-2014 11:02 AM

The content is rollerblading (action sports).

The captured file does not have audio problems, the file after running the QTGMC script has the bad audio sync. The mediainfo info for both the captured source and the scripted file are posted above on post #10.

I've been going through more tapes, and i've been seeing this problem more and more but only with older tapes (93-98). Although some tapes from the same year have good results with no audio problems. The content looks better after running the script, so i'm not sure if the video shouldn't be deinterlaced or not.

I believe the video is dropping frames during the script process resulting in this bad audio sync.

sanlyn 11-05-2014 07:22 AM

QTGMC doesn't drop frames. If your capture has a variable frame rate, you can't have good audio sync. When the frame rate doubles for deinterlacing you can't properly maintain a/v sync. Variable frame rates are not allowed with DVD/BluRay/AVCHD. Also you're capturing at the wrong audio rate (44KHz), which is invalid for DVD/BluRay/AVCHD.

Someone familiar with your ProRes setup will have to help with avoiding VFR and audio sampling rates. I'm using Windows XP and VirtualDub/huffyuv for losssless capture from VHS for years now and have never had the problems you're having.

pinheadlarry 11-24-2014 11:31 AM

Well something is happening between the script process. Even when i put the captured audio over the scripted file it's out of sync.

I tried to explain this before, but this problem usually occurs with very old tapes. I think this is due to poor tracking, but the picture will be 'jittery'. Here is a short clip showing what i mean.

https://www.dropbox.com/s/20ubwqbzgc...est-1.mov?dl=0


You said the audio rate is wrong, but didn't say the correct rate. I have no plan to ever put these on DVDs. I've also used this method on countless other videos that gave great results.


I tried the smart deinterlacer plugin with VirtualDub and it still gave me an out of sync file although it wasn't as bad as the AviSynth method. Handbrake gives me an in-sync file, but the quality doesn't compare.

sanlyn 11-24-2014 04:24 PM

The audio rate to use depends on your plans for final output.

The video test-1.mov is a clip of some jittery titles and some clouds passing over the moon. What is the audio supposed to be in sync with?

The PCM audio is sampled at a 24-bit rate, and tries to play back at 32-bits. Both are invalid for PCM. PCM is 8-bit or 16-bit, preferably 16.

That video looks as if it's jumping all over the place in the tape path. You need a line tbc of some kind and a frame-level tbc as well. I don't recall what you might be using for those two components. If you already have them hooked up, you're working with some dreadful tape on a player that has a real hassle trying to track it.

pinheadlarry 11-30-2014 05:22 PM

Right now i'm only using the TBC that comes with the JVC SR V10u. It works for most tapes, but a lot of tapes that are in 'poor' condition it doesn't help much. If i turn off the TBC, it stabilizes the image but about 20px of the top image is useless due to 'warping'? i'm not sure of the correct term for this.

Something i just realized, which may tell why the audio is out of sync...

On the video i run AviSynth scripts on, which has audio sync problems, a certain scene is at - 11:08.

On the captured file and the Handbrake deinterlaced file that same scene is at - 11:20

I'm not sure what this means, but it shows why the audio would be out of sync on the AviSynth files.


All times are GMT -5. The time now is 05:34 AM

Site design, images and content © 2002-2021 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2021 Jelsoft Enterprises Ltd.