PDA

View Full Version : Type-2 audio desync; Type-1 not


Velocity 7
26th March 2005, 01:16
I have a Sony DCR-TRV25, recorded footage into the camera tape in "SP" mode, "16-bit" audio. If I capture using WinDV or DVapp in Type-1 mode, the audio synchronizes properly with the footage. However, if I capture using Type-2 mode with anything (WinDV, DVapp, DVIO) or even try a conversion from Type-1 to Type-2, the audio begins to de-sync. Note that this does not happen with live captures.

Anyone have any ideas on this one? It's giving me a headache. :S

bb
26th March 2005, 14:42
Desynch problems have been reported before in conjunction with type-2. Which applications do you use, i.e. where do you experience desynchronization?

bb

Velocity 7
26th March 2005, 21:21
De-sync happens with Type-2 in the following programs:

- DVapp preview mode
- VirtualDub
- Media Player Classic

Type-1 can be played properly in Media Player Classic, with 48 Khz audio. However, for some odd reason it can only be opened with VirtualDub 1.6.0 (version-specific), and even then it is 32 Khz audio. With AVISynth (latest beta), DirectShowSource() ends up giving me 32 Khz audio.

Note that, because of this 32 Khz problem, the audio length is reduced; even if I do an AssumeSampleRate sort of command to fix the audio sampling rate back to 48 Khz, the total length of the audio is now 2/3rds what it once was.

EDIT: Came up with a workaround. Fortunately, TMPGEnc (v2.521, v2.524) can read Type-1 files, so do this:

1. Save a TMPGEnc Project File.
2. Convert the project file into frameserve AVI using the VFAPI converter.
3. <do what you want from here>

However, sometimes audio might skip from time to time just to keep synchronization. TMPGEnc seems to be causing it. Odd.

dosdan
29th March 2005, 06:13
My problem with type 1 is that my apps would see a 48KHz DV recording transferred from my camera as 32Khz. Plays at 2/3 of the standard pitch and also sounds clickly. And if I create a type 2 larger than 2 GB it has no sound. Using Panasonic DV codec and WinDV.

Solution 1. Run resultant type 1 file through Canopus DV converter and save it as MS type 1. These are seen my ny system as 48KHz. The disadvantages are the extra temporary space required to make a second copy before deleting the original files and also the time required to convert the files (about 1/3 of the time of the recording on my XP1800 i.e. a 60 min. file takes about 20 mins to convert.)

Solution 2. Set up WinDV to save transfers as 2GB (max.) multisegment type 2 (at a frame rate of 25fps that's 12000 frames/8 mins. length per segement) and then use SegementedAviSource("filename.avi") inside Avisynth to load the complete sequence. I use this method as it's quicker and easier in my case. Perhaps it might solve your sync problem.

Velocity 7
29th March 2005, 17:14
My file didn't even pass the 2 GB mark yet it's having the sync problem still. I doubt this will solve the problem. ^^;;

dosdan
30th March 2005, 00:25
What about trying my Type 1 ->Type 1 (MS) conversion to see if that fixes your 32Khz DirectShow problem?

Velocity 7
30th March 2005, 02:04
Using that Canopus DV converter allows me a new workaround option (by converting to any format it has): use VirtualDub and set it to synchronize the video and audio. But as a result the video frame rate must drop (29.97 to 29.91 or something). I don't think this even needs to happen does it? :S

dosdan
30th March 2005, 02:44
Let's say your system has a problem with Type 2's and will lose sync when using them.

1. Will Canopus' Type 1 (Microsoft) converted files now work in DirectShow apps with the correct audio sampling rate?

2. Can you load the Type 1 (MS) file in VDub Experimental which I believe supports Type 1?

Velocity 7
30th March 2005, 03:31
Type 1 will play properly with 48 Khz audio in Media Player Classic, if you read my above posts.

Only VirtualDub 1.6.0 will load Type 1 files with audio, but the audio will be clocked at 32 Khz regardless of the Type 1 format (tried Canopus and MS). Any version higher than 1.6.0 refuses to load the audio.

bb
30th March 2005, 19:52
I assume your audio is 32 kHz. Try to save it as a WAV file from within VirtualDub, and convert it to 48 kHz using SSRC (you may use BeSweet and its GUI from Doom9's full software page). Then mux the resulting WAV file with the video, again using VirtualDub. Is it synchronized now?

bb

Velocity 7
9th April 2005, 02:54
(BUMPED)

It is actually 48 Khz, not 32. VirtualDub sees it as 32 Khz and plays it at 32 Khz (in other words, direct sample rate change rather than a conversion/interpolation taking place). So the sound would be a lot slower, as a result.

Furthermore, Media Player Classic plays it at sample rate 48000 (as indicated by the "Default DirectSound Device" filter).

And I've already tried that before; but SSRC will obviously leave the sound slow as it is. And using AssumeSampleRate() will simply just have the same result as before; correct sound but no synchronization.

Velocity 7
11th April 2005, 16:40
Okay, this is probably the best workaround you can come up with before anything starts going wrong.
Solution 1:This is what you need:

1. VirtualDub (any version)
2. GraphEdit
3. Soundforge (need free alternative here based on steps)

First, open the file using VirtualDub. Get the number of frames there are, and note the framerate that the video is supposed to go at; in my case it is 29.970 fps, and I had 17236 frames.

Next, open up GraphEdit, and connect like this:

Source File -> AVI Splitter -> DV Splitter -> WAV Dest -> File Writer

and make sure you connect the audio properly.

Then, open up the WAV file generated using Soundforge, and note the audio rate and number of samples. In my case, it was 48000 Hz, and there were 27653648 samples.

Now, let's do the math:

17236 frames / 29.970 fps * 48000 samples/second = 27605205 samples (round to nearest integer)
Note now that 27653648 > 27605205. So do a Time Stretch in Soundforge based on this problem.

In this case, the original time was 27653648 / 48000 samples/second = 9:36.118.
The final time is supposed to be 27605205 samples / 48000 samples/second = 9:35.108.

I chose AO3. Music 03 (less echo).

Solution 2:Do everything in Solution 1 up to the point requiring Soundforge. Use VirtualDub and set the WAV source to the WAV file immediately, then do Video -> Frame Rate -> "Change so video and audio durations match." This makes the framerate go from 29.970 to 29.917, which is a little slower but allows the video to match the audio.

Now everything synchronizes properly. I'll need to write a better guide than this later, but just documenting it for future purposes.

Question to come from this: when the DV video was being recorded to tape, was the camera dropping frames? Moreover, if it was dropping frames, was it doing it like this:

Say you have a continuous image sequence going
A B C D E

Instead of going:
A B C C E (dropping frame D)

It went:
A B C E (just dropped the frame and cut it out altogether)

So as a result video length < audio length? But this doesn't explain why Media Player Classic (http://www.gabest.org) was able to play Type-1 files with perfect synchronization (and no audio gaps whatsoever), yet Type-2 files have the synchronization problem noted. Very very odd...

bb
11th April 2005, 19:10
Camcorders are not supposed to drop frames. I assume there's something wrong with the type-2 file, which leads to your synchronization problems.

- A type-1 DV AVI contains video and audio intermuxed. This is the best format to work with DV, if you ask me. Even popular programs, like older versions of Ulead's MediaStudio Pro, had problems with type-2 DV.

- A type-2 DV AVI contains a stream with video and audio intermuxed, and a stream with the audio only. The first stream should be identical to what you have in a type-1 file, whereas the second - which should be an exact copy of the audio samples from the first stream - is used by VfW applications. Synchronization problems have been reported in conjunction with type-2 files more than once, but some people have never experienced any problem at all. Apparently it depends on the software you use. Note that VirtualDub does not create proper type-2 DV AVIs, if you save an AVI through a DV codec, because the first stream is saved with video only, which is wrong.

If you ask me for a recommendation, I'd say use type-1 only - that's what I do.

bb

Velocity 7
15th April 2005, 16:19
Even if you say so, how would I be able to do something like make VirtualDub work with it perfectly?

If not, is there any other free software that can handle DV files correctly like Media Player Classic can? (which can't encode FYI)