Log in

View Full Version : dgpulldown: audio sync - player problem?


kevinm
6th May 2005, 17:26
I have been trying to use dgpulldown to convert from PAL (analogue capture of Hi8 camcorder footage) to NTSC for burning to DVD.

My flow is based on what I have read on Donald Graft's web site and also in this forum, all seems to work ok according to what I see when played on WinDVD on my PC however there is a significant audio/video sync problem when I play the DVD on my Sony standalone player.

I have determined that the audio is correct, but the video appears to still be playing at NTSC frame rate.

Is it possible that my Sony DVD player doesn't support pulldown flags correctly? (I am using Sony DVD-NS400D)


Here is my flow:

1. Capture analogue video using iuvcr, codec = Panasonic, capture resolution = 720x560. Deinterlacing performed in iuvcr in real time.

2. Use Avisynth script to frameserve to TmpgEnc (basic PAL DVD template used in TmpgEnc, avs script used to resize video to 720x480, framerate left at 25fps)

3. In TmpgEnc, dumux to create .mv2 and .mpg

4. Load .mv2 into dgpulldown and change from 25fps to 29.97

5. Load pulldown.mv2 and original .mpg into TmpgEnc and multiplex.

6. Burn DVD (the DVD authoring program claims that it is not re-encoding the MPEG)


any help/suggestions would be greatly appreciated,

thanks,

Kevin

Guest
6th May 2005, 21:51
Describe the desync in detail. Is it a fixed offset? How big? Is there no desync when you play in WinDVD but there is when you play in the standalone? Have you tried other players?

kevinm
7th May 2005, 00:11
Donald,

thanks for your reply.

The sync appears to be ok in WinDVD, there is perhaps a slight misalignment (1/2 sec perhaps) but not that would concern me too much.

The problem only occurs when I play the disk on my standalone DVD player, I have not tried on another standalone player, I will do that at the weekend and let you know the outcome.


I suspect that the video is running fast as I observe a visual event occurring a number of seconds before the corresponding audio event. The exact skew is hard to measure and at first I assumed that the player is running at 29.97, I will try to find a way to measure the skew and video frame rate more accurately. Perhaps the problem is skew, rather than frame rate, I had not considered that possibility.


As regards the audio, I know it is running at the correct speed however I need to check to see if there is any offset at the start.


My test setup consists of the following:

I have digital timer of the type you plug into the wall socket to turn lights on/off in your home. This powers a little board I constructed which, when first powered up flashes an LED and at the same time fires a beeper.

I set the timer to turn on/off at one minute intervals.

When I make a recording of this using me camcorder the resulting capture has the following attributes which I find useful for debugging these skew issues:

1. I can see the timer count (in seconds).
2. I can see a short visual indication (i.e. LED), synchronized with the timer.
3. I can hear a short beep, synchronized with the timer.

I will check the things you suggest and let you know when I have the results.


many thanks for your help. I am really excited about using your dgpulldown, PAL->NTSC has been such a pain for me up till now, I have read great things about dgpulldown and I hope it is the solution for me also,

Kevin

Guest
7th May 2005, 00:20
I'll wait for your full response, but in the meantime, I'll point out that most people would not consider 500ms to be a "slight misalignment"! For example, DirecTV requires their STBs to adhere to +/- 20ms, and many boxes keep it to +/- 5ms.

kevinm
9th May 2005, 06:10
Donald,

I managed to get to try my disk on a friends DVD player, it shows the same problem. I have now tried it on two players:

Sony DVP-NS400D
Sony DVP-NS315

Here is what I have determined:

There is no noticeable delay at the start.
The audio is running at the correct speed.
The video is running too fast:

Two minutes of the original video footage was timed as taking 1 min 45secs when played back on the Sony standalone players.

As I mentioned previously my test setup produces a sound/video event once every two minutes (LED flash and audio beep, and timer display of the "wall clock" time).

I watched the video played on my Sony DVD standalone player and measured (using a stopwatch) the points at which each LED flash occurred:

2nd event was timed at 1:40:27 (clock on the video reads 12:07)
3rd event was timed at 3:20:40 (clock reads 12:09)
4th event was timed at 5:01:49 (clock reads 12:11)
5th event was timed at 6:41:53 (clock reads 12:13)
6th event was timed at 8:21:68 (clock reads 12:15)

So, for each two minute section of original video, when the pulldown video is played on the standalone NTSC player it takes around 1 minute 40secs.

If I take the 2 minute interval and factor in the ratio of PAL/NTSC I get:

25/29.97*2min = 1min 40.1sec

Since I have only tried it on Sony players I will try to get access to a non-Sony machine and let you know the results.

If you have any suggestions for any further experiments I can try please let me know,

thanks for you help,

Kevin

Guest
9th May 2005, 13:42
Open pulldown.m2v in VirtualDub using DGMPGDec and determine its playing time (or any other reliable method). Is it what you expect (i.e., same as the audio length)?

kevinm
11th May 2005, 05:46
Donald,
I now have the length results for you:

I installed your DGMPEGDec in my VirtualDubMod directory and was able to load the m2v file, I also loaded the original source (AVI) and the mpg files created prior to running dgpulldown ..


1) Original AVI (uses Panasonic codec)

Length = 29614 frames, 19:48.01

NOTE, this AVI is loaded into TMPGEnc and Trim(Input,700,-15300) performed, this is why the mpg and m2v files are much shorter than
the original AVI)

2) mpg produced by TMPGenc

Length = 15300 frames, 0:10:12.000)

3) m2v produced by demux in TMPGEnc

Length = 15300 frames, 0:10:12.000)

4) m2v produced by DGPulldown

Length = 15300 frames, 0:08:30.510



Kevin

Guest
11th May 2005, 05:50
How can the pulled down M2V not have more frames? Something is rotten in Denmark with your results.

You can't use VDubMod! It doesn't honor pulldown.

Also, we need the audio length.

kevinm
11th May 2005, 20:59
I dont know how the .mv2 doesn't have more frames, maybe VirtualDubMod is not analyzing it correctly.

I will install VirtulDub tonight and post the results. I have not used VirtualDub before but hopefully it will be intuitive. Up till now I have only used avisynth with TMPGEnc, I have used VirtualDubMod a long time ago, that was why it was already on my machine.

I will also make sure I give you the audio length numbers,

Kevin

kevinm
12th May 2005, 04:32
Could someone please help with loading MPEG2 into VirtualDub? I have downloaded DGMPEGDec to my VirtualDub directory but I am unable to load either .m2v or .mpg streams. I get the message ..

"No video frames found in MPEG file"

This is the first time I have used VirtualDub so I apologize if this is a stupid question.

How do I install the DGMPEGDec dll so that VirtualDub can load the .mpg and .m2v? Is there some dll loader or do I have to frameserve to VirtualDub to get the stream to load?

I did check the HTML help which came with DGMPEGDec but it only talks about how to use with avisynth, but I have been told to use VirtualDub.

I search the VirtualDub forum on Doom9 but found a post that said VirtualDub cant load MPEG2, presumably this is why I need to install DGMPEGDec,

thanks,

Kevin

dbloom
12th May 2005, 04:41
DGIndex and VirtualDub don't just find each other and start working (unfortunately). The way they work and process files pretty much mandates that they be separate programs (long story).

Get AVISynth from whatever page http://google.com/search?q=avisynth&btnI goes to. Copy all the DGMpegDec files into the AVISynth plugins folder (try c:\program files\avisynth 2.5\plugins).

Open up Notepad, and type this:
MPEG2Source("Insert the name of your D2V file here.d2v")
ConvertToRGB24(interlaced=true)

(We are doing ConvertToRGB24 because VirtualDub works in RGB24land, so we might as well convert the right way in AVISynth)

Go to File/Save as..., and go to the folder with your D2V file. Type this for the file name, including the "quotes":
"virtualdub-d2v.avs"
You can type whatever you want before the .avs, virtualdub-d2v is just an example. Keep the quotes and .avs though.

Open the .avs file in VirtualDub and see what happens.

kevinm
12th May 2005, 04:55
dbloom,

does avisynth have to be in the same directory as VirtualDub is installed?

thanks,

Kevin

dbloom
12th May 2005, 04:57
Originally posted by kevinm
does avisynth have to be in the same directory as VirtualDub is installed?

nope

kevinm
12th May 2005, 05:03
dbloom,

I get and error in VirtualDub when I load the avs ..


"Avisynth open failure
Script error: there is no function named "MPEG2SOURCE"
(G:\virtualdub-d2v.avs,line2)"


My AVS looks like ..

PluginPath = "c:\AVISynth25\Plugins\"
MPEG2SOURCE("G:\test_audio_sync1_resized.d2v")
ConvertToRGB24(interlaced=true)


(I added Pluginpath but it didn't help, I know I had to use this in avisynth when framserving to TMPGEnc but in this case it didn't help),


any idea what I have done wrong?

thanks,

Kevin

kevinm
12th May 2005, 07:13
Correction, my AVS looks like ..

PluginPath = "c:\AVISynth25\Plugins\"
MPEG2SOURCE("G:\test_audio_sync1_resized.m2v") <<<<<
ConvertToRGB24(interlaced=true)

however I am still unable to load the .m2v in VirtualDub.

Will have to take a look again tomorrow,

thanks for your help,

Kevin

Abond
12th May 2005, 12:58
You need to run the m2v through DGIndex to produce *.d2v file (File->Save project)

Guest
12th May 2005, 13:19
Yes, use DGIndex to make a D2V file with field operation None and then load the D2V file in the script, not the M2V.

Also, take a look at rocko1911's thread; he found the problem in his case: GOP length.

dbloom
12th May 2005, 14:24
I have been trying to use dgpulldown to convert from PAL (analogue capture of Hi8 camcorder footage) to NTSC for burning to DVD.


Since your footage is interlaced, I think it would probably be better to use AVISynth and change the frame rate that way. DGPulldown is only optimzied for progressive video.

Anyone have a good AVISynth interlaced format conversion filter chain?

kevinm
12th May 2005, 16:46
dbloom,

yes my source (PAL camcorder) is interlaced but I deinterlace it during the analogue capture. I am feeding deinterlaced video to TMPGEnc where I perform the resize to 720x480.

I have spent many months trying to get some avisynth script to do a decent job of converting 25fps to 29,97fps, all do an unacceptable job in my opinion.

I have had more sucess going the other way (NTSC -> PAL). I had all but given up trying to get my old PAL video onto NTSC DVD when I saw the discussions on neuron2's DGPulldown.

I think the problem for me is the source, it is home video from a handheld camcorder. Lots of panning and not very smooth at that. Every technique I have tried for frame rate conversion results in jerky motion during the panning. I dont know if DGPulldown will result in anything better but it is worth a try as my attempts to get a decent result using Avisynth filters has been driving me nuts,

Kevin

kevinm
12th May 2005, 18:31
Donald,

with your, Abond and Dbloom's help I managed to create the d2v project files and load the video streams into VirtualDub ..

Here are the numbers:

Before pulldown:
15300 frames, length = 0:10:12.000

After pulldown:
18341 frames, length = 0:10:11.979

Audio (.mp2), length = 10:12

Note, I used media player to determine audio length, hope that is ok.


I will now read up on GOP and figure out if I need to apply the same fix as rocko1911,

Kevin

dbloom
12th May 2005, 20:53
Originally posted by kevinm

I think the problem for me is the source, it is home video from a handheld camcorder. Lots of panning and not very smooth at that. Every technique I have tried for frame rate conversion results in jerky motion during the panning. I dont know if DGPulldown will result in anything better but it is worth a try as my attempts to get a decent result using Avisynth filters has been driving me nuts,

Is your field order correct? That could be what's causing flicker.

(Note: when I say "60Hz", I'm probably talking about NTSC, and when I say "50Hz", I'm probably talking about PAL. I don't like using the terms NTSC and PAL because they relate to color encoding, not frame-rate. In some cases this isn't accurate - for example, Brazil actually has 60 field per second, 480-line TV. But, because they use PAL for color, they are considered to be PAL. Also, France has SECAM, etc. That's enough ranting for this set of parenthesies...)

50Hz-->60Hz interlaced conversion is difficult because you have to create new fields and flicker becomes a problem because you have to basically treat field A and B differently then merge them.

Anyway, let's see what we can do using AVISynth, which is much better at the job than VirtualDub.

Create a new file in Notepad. Then, use your interlaced source file (note: unless it's your only source, we don't want to use an encoded MPEG-2 file because it will get encoded again).

Start with this line, which imports an AVI into AVISynth as a source:
AVISource("c:\avi file here.avi")
ConvertToYUY2(interlaced=true)

Then, add this code, which splits the interlaced fields of the video into separate frames of height 480 (60Hz TV's vertical resolution). The width for 60Hz DVD is the same as for 50Hz DVD, 720, so we don't need to change that.
Bob(height=480)

Since we create frames from each field, and we have two fields per interlaced frame, our frame rate is now doubled.

Now here's where NTSC and PAL actually DOES have to do with frame-rate: NTSC has "drop frame", so 60Hz in NTSC is actually 59.94Hz (long story), but 60Hz in PAL is still 60Hz. I'm assuming you're doing NTSC 60Hz in this next step.

This next line will blend fields to change your 50 FPS video into 59.94 FPS video:
ConvertFPS(59.94)

Now to split, splice, dice, and recombine the fields:
SeparateFields.SelectEvery(4,0,3)
Weave
ConvertToRGB24(interlaced=true)

Change the "0" in "SeparateFields.SelectEvery(4,0,3)" to a "1" if the output has the wrong field order (you can tell because there will be a very noticeable amount of constant flicker).

Open that AVS file directly in TMPGEnc, or in VirtualDub if you want. It should be a higher-quality FPS conversion.

kevinm
12th May 2005, 21:30
dbloom,

thanks for the pointers but this is more or less what I started with many moons ago, since then I have been using an adaptation of a video conversion script posted to the avisynth forum many months ago. I have tried many experiments including testing out the various deinterlacers and also sharpen filters like msharpen. I managed to get my 29.97 to 25fps conversions to a point of being acceptable but there is probably still room for improvement.

For top/bottom field selection I must admit that I was guided by the comments in the original avs script (which I believe was created by Xesdeen). When I started all this I hadn't a clue how to tell whether a stream was top or bottom field first.

Through my experiments with this script I have come to learn more about the conversion process and would be the first to admit that some assumptions I was happy to accept at the start may need to be reconsidered.

If you are interested you can see a version of the conversion script (this one for 29.97 to 25fps) at ..

http://forum.doom9.org/showthread.php?s=&threadid=86020&highlight=poormans


Kevin

kevinm
14th May 2005, 17:26
At last I got it to work. I can play the DVD on my Sony standalone NTSC player and the audio and video is in sync :)

I used DVDAuthorGUI to author the DVD, then burned the disk using the disk burning application from PowerDirectorPRO (generally I don't like that proggy, but at least the disk burning part of it has always been reliable).

Now I need to copy some real video footage (camcorder footage, lots of difficult panning scenes) and see how well the pulldown handles it. Hopefully it will be better than I have been able to obtain so far with more 'traditional' frame rate conversion methods.

Many thanks to everyone for their help, and special thanks of course to Neuron2 for creating DGPulldown!

Kevin