Unable to get Audio & Video synced properly in VSE

I have ripped a DVD and converted into a AVI with handbrake. I’m trying to make some cuts with the video and mainly editing out some words in it, so it’s at a PG level for my son. The problem I have is the audio is never in sync with the video. The movie is in 23.976, so I have changed the FPS to 24 and the base to 1.001. When I do that both the audio and video tracks are the same size, but the audio is still off. I have tried 29.97, 25, 24, but nothing works. I have verified that the movie is 23.976 FPS. I even reconverted forcing it at 23.976 FPS. I have even tried offsetting the video and audio, but nothing works. Right now I’m converting the VOB’s to a dedicated 29.97 FPS. I am using blender 2.49a on a mac. I haven’t tried converting the audio with audacity, yet but I’m coming close. I have also tried importing both the video and audio separately, but I still get the same results.

Is there a problem with blender handling 23.976 FPS? I wouldn’t think the conversion would have hurt anything, since I can play it in VLC player and the video and audio are synced properly.

I would appreciate any help on this. Blender is a great program, I don’t know what I’m missing.

Well well, Blender has some challenges trying to keep different codecs in sync so good luck there. I would seriously try something else (AVIsynth?), As there are way to many issues with the different systems in the Sequencer to expect them to all play right (apart from doing simple lip sync) I am happy to be proven wrong but you cant even expect WAV files to stay synced up…

What codec in the AVI? AVI is a container like Mov not a codec. With sound or seperate audio file? Don’t know handbrake what other formats are available? Any lossless uncompressed? HuffyUV?

I’m trying to make some cuts with the video and mainly editing out some words in it, so it’s at a PG level for my son. The problem I have is the audio is never in sync with the video. The movie is in 23.976, so I have changed the FPS to 24 and the base to 1.001. When I do that both the audio and video tracks are the same size, but the audio is still off.
Have you ticked the Playback sync with Frames/Secs.

I have tried 29.97, 25, 24, but nothing works. I have verified that the movie is 23.976 FPS. I even reconverted forcing it at 23.976 FPS. I have even tried offsetting the video and audio, but nothing works.
Is this in the VSE or encoded output specifying the latency/shift given in Blender’s Audio tab.

Right now I’m converting the VOB’s to a dedicated 29.97 FPS. I am using blender 2.49a on a mac. I haven’t tried converting the audio with audacity, yet but I’m coming close. I have also tried importing both the video and audio separately, but I still get the same results.
Perhaps try exporting only video in AVI as uncompressed, HuffyUV, if you aren’t already or as image sequences. Much disk space. then add wav seperately and your cuts should reduce the length of the audio into smaller chunks to be able to resync if problems.

Is there a problem with blender handling 23.976 FPS? I wouldn’t think the conversion would have hurt anything, since I can play it in VLC player and the video and audio are synced properly.
Not sure, I’m in PAL region but re earlier comment about play back sync to frames/secs.

I would appreciate any help on this. Blender is a great program, I don’t know what I’m missing.
A working solution. :slight_smile: What OS btw?

Hi, this has also been my experience with some videos: no matter what I do syncing is doesn’t work. It doesn’t happen very often but when it does it’s a pain. What I usually do is: #1. use ffmpeg to convert all frames to still mages (png) #2. extract the audio stream in a raw format (pcm) Once you know the frame rate then you can import the sequence of images in VSE and then import the audio stream. The streams should have the same lenght. You might then proceed to edit either video or audio strip and render the final video. Note that while I have found this to be a failsafe method, converting the video to separate images takes a lot of time and it’s a waste of resources (i.e. cpu time). ffmpeg is quite capable of handling everything you throw at it but sometimes the container-codec combo appears to be dificult for Blender to handle. Ilias

Yes its a real shame, especially when you see dedicated apps manage playback of many tracks in sync. Please understand I am NOT complaining. I think the devs kick a… its just a shame thats all.

@3pointEdit: Thanks for the heads up. I have checked avisynth. It looks very nice for some other things I want to do, but it would be almost impossible for me to use it. I want to cut some things and mute others, but I need to see where and when. I tried a avisynth GUI but it didn’t work to well.

@yellow:

What codec in the AVI? AVI is a container like Mov not a codec. With sound or seperate audio file? Don’t know handbrake what other formats are available? Any lossless uncompressed? HuffyUV?
Sorry, I should have been more specific. It was in mpeg-4(FFMPEG), which made me think it would work well in blender. I tried some mpeg-4(Dvix) and some other formats, but blender didn’t like them.

Have you ticked the Playback sync with Frames/Secs.
Yes. I know the video is 23.976, and even forced the encoding to 23.976 and still no luck. I have also tried 25 FPS and 29.97 FPS, still no go.

Is this in the VSE or encoded output specifying the latency/shift given in Blender’s Audio tab.
Well, I was referring to the handbrake encoding, but I have also tried many different settings in the render panel.

Perhaps try exporting only video in AVI as uncompressed, HuffyUV, if you aren’t already or as image sequences. Much disk space. then add wav seperately and your cuts should reduce the length of the audio into smaller chunks to be able to resync if problems.
Maybe. I just hate converting it to a raw format. They implemented ffmpeg, so I would think it would add some support to keep from doing that.

A working solution. :slight_smile: What OS btw?
OS X 10.5.7. I have tried blender 2.48, 2.48a, 2.49a, and 2.49b all the same problem. I have even tried 2.48a on my windows virtual with the same problem

I even messed with handbrake making the audio 44.1 and 44.8 kHz and that still didn’t make a difference. It did make it better, but the audio was still off. I tried shifting the tracks around, but it would still eventually be off.

@blendercomp: I will try what you say, it just seems so wrong.

I haven’t used VSE alot, but I have had it play files in sync and I even messed with green screening. I’m just somewhat disappointed that I can’t get this two and a half hour video synced.

I must say what they have done in blender is very amazing, especially for being open source and free. I guess not all implementations of ffmpeg are created equally.

FFMPEG is all well and good as a transcoder but it still has problems, mailing list is full of them.

HuffyUV can be lossless and although the files are bigger they are not as big as image sequences. But converting from one delivery codec to another in order to edit it is a bit daft really.

Going from mpeg2 codec which is what your DVD is to mpeg4 or any other delivery codec is introducing quality loss, from both re encoding, crap colour space conversions (if any going from mpeg2 to mpeg4) and gamma/luma shifts. You then intend reencoding again from blender to another delivery codec.

Even if you get the correct sync with audio you may well find contrast/brightness is different due to the conversion as well. I guess this is all ok for doing a quick hack of a DVD but as a workflow for video editing it’s poor.

Blender VSE / FFMPEG probably handles mpeg2 better than mpeg4.

By re encoding you are remuxing your audio into those codecs in different ways each time. If you intend editing your video it is better to extract to an intermediate codec like HuffyUV or image sequences and separate wav, no need to remux audio every time you do some sort of encoding, just the last one to final delivery codec.

Editing in a delivery codec is not the way to go, only reason NLE’s do it was for speed of playback and realtime editing, but things are changing, intermediate codecs exist to work in instead. Like lagarith, Huffy, Cineform[/quote]

OS X 10.5.7. I have tried blender 2.48, 2.48a, 2.49a, and 2.49b all the same problem. I have even tried 2.48a on my windows virtual with the same problem

I even messed with handbrake making the audio 44.1 and 44.8 kHz and that still didn’t make a difference. It did make it better, but the audio was still off. I tried shifting the tracks around, but it would still eventually be off.

@blendercomp: I will try what you say, it just seems so wrong.

I haven’t used VSE alot, but I have had it play files in sync and I even messed with green screening. I’m just somewhat disappointed that I can’t get this two and a half hour video synced.
It all depends on what codec. Any NLE will present you with the same problems, out of sync audio. Garbage in garbage out.

I must say what they have done in blender is very amazing, especially for being open source and free. I guess not all implementations of ffmpeg are created equally.
Yes they will vary unless you use a stable version, it is continuous evolving, but the whole use of FFMPEG in NLE’s is imho a distraction from a real decent workflow, that is get the video out of the delivery codec to a lossless intermediate and separate audio, edit, export as a master, mixed down audio + image sequences / lossless codec and re encode/mux in something like Avidemux to whatever delivery codecs you want that offer more choices and more success than blenders encode options. You are then able to encode that master to flv, mp4, ipod whatever without going through the pain of sync and quality problems going delivery codec to delivery codec.

You could try AVISynth with Virtualdub to do your editing. It doesn’t rely solely on FFMPEG implementation, it’s an option for some sources. Check outhttp://forum.doom9.org

Yeah Avid copped grief for their proprietry codecs, but you know what, they just worked and worked. Bullet proof and realtime. What does proxy generate do, just make image sequences? Could it be co-opted to transcode to a production format upon import?

The main reason for the re-coding was blender kept hanging on import when I would add all the VOB’s, and it wouldn’t import the audio. So I re-encoded it so it would be smaller and import the audio as well. I’m using ffmpeg right now to basically encode it to mpeg-2, which is the same format it’s in now. When one of the VOB’s is finished I will see if everything is in sync or not.

I would use AVISynth, but it won’t fit what I need to do. It looks great for a lot of things, but I need to mute some portions and chop others. And I don’t know where at. So I was going to watch it in VSE and edit it on the fly.

What is some good software to just rip audio from a DVD. I found a windows app, but I don’t know if I can trust it and I prefer open-source linux stuff.

Thanks for all the input so far guys.

Must check this once more since I didn’t see a straight answer from you, did you actually enable the Sync button in the Sound Block buttons’ Sequencer tab?

edit: hmm, I’m not sure yellow is talking about the same thing… but anyway, I didn’t see any answer about this.

Yes. I tried the sync option in the render panel. When previewing the video it seemed to sync it, but at the same time the preview would play fine and then slowdown horribly and keep repeating like this. I’m assuming it was the sync option trying to keep everything synced. When I renedered sections of the video the audio was still off.

When I re-encoded the video to a mpeg-4(AVI) I also set options in the audio panel of Handbrake to force the audio at 44.1 kHz and tried it at 48 kHz. That didn’t work when I tried either option in the blender render panel selecting with 44.1 or 48 with sync in the render panel enabled or disabled.

@cyperpatriot:
For the record, I have added VOB files directly from the DVD drive to the VSE in the past (using 2.48 I think) without any trouble whatsoever. Needless to say that after inserting the vob file two separate strips, video and audio respectively, appeared in the VSE and editing proceeded as usual.
As far as I can recall, the only problems faced were related to a specific DVD which had to be decrypted first.

@blendercomp: I have added some in the past, but my experience with VSE is limited. This rip it gives me this error: The selected file is not a movie file or FFMPEG - Support not compiled in!. Then it gives me only the video on most of the VOB’s, and some it won’t load the VOB at all. Which is one reason I’m re-encoding them. I have tried version 2.48, 2.48a, 2.49a, and 2.49b for OS X and I have tried 2.48a in my windows virtual and it all ends up with the same error. The rip is decrypted, especially since I can encode the VOB’s without a issue.

So, I don’t know if it’s VSE or the VOB’s themselves.

Cyberpatriot, the message you got when importing the vob files is bad news as it clearly shows that the ffmpeg version used by Blender does not support the video codec (but not any other version of ffmpeg you might have installed on your system etc). This means that you cannot work directly in Blender and the workflow should be diverted to some other app, hence it leaves you no other option than reencoding to a format that can be imported into Blender’s VSE.
If you’ve got ffmpeg installed in your system and are familiar with the command line, you can try reencoding it to one of the formats suggested in this thread.
If your not familiar with ffmpeg and its use, you I would highly recommend Avidemux for transcoding. You could try transcoding a portion of a vob file using Avidemux, import the resulting file in Blender and then check for sync issues.
Ilias

I have no problem using VOB’s with the VSE. Linux Karmic Koala. Blender 2.49b from www.blender.org.

One caveat, if you load a NTSC file into blender and the render panel is set to PAL, audio and video strips are different lengths. Swapping to NTSC in the render panel after the strips are loaded doesn’t change the strip lengths. Reloading the VOB doesn’t change the strip lengths, so with whatever you are inputing make sure your render panel is set to NTSC first.

Your VOB files are mpeg2 so no need to transcode/reencode to another format, you should be able to do direct stream copies to another container using something like Avidemux or VirtualDubMod. It will take a fraction of the time and maintain the quality doing straight stream copies.

Doing straight copies of video and audio in Avidemux works for me from the VOB’s I’ve tested tonight exporting to either AVI and MPEG-PS (A+V).

Yellow, if what you’re suggesting does work then it’s gonna be a huge timesaver! :slight_smile:
Still, I’m under the impression that the container+codec combo is causing the trouble with the built-in ffmpeg version Blender uses. Will try the direct stream copy approach tomorrow and see how it goes.

Me too, but I’m using the vanilla blender 2.49b with the built in FFMPEG I guess so hopefully it should at least get the strips in sync.

What I do notice is the very minor audio sync delay with playback in blender via the sequencer viewer, as I have a 46ms latency according to blender with vanilla linux kernel. But once encoded to the fianl delivery codec, either with blender of via Avidimux (inputtng the latency as shift) the sync appears perfectly good in the final videos.

I do use the RT kernel when messing with audio+jack+ardour but not for general use.

Yet to try an RT kernel and check latency in blender playback.

Success!!!

I appreciate all your help. I couldn’t find a good ffmpeg for OS X so I used winff and did like yellow suggested and converted to a mpeg2. The audio and video synced up! So either handbrake, which doesn’t do mpeg2 on OS X, doesn’t encode mpeg4 properly. Or like yellow said it’s remuxing the stuff. It’s a little weird to encode it to mpeg2, since that is basically what a VOB is. I also think it “repaird” some of the VOBs. During the encoding it looked like some of the VOB’s had a FPS problem with certain frames that it corrected.

winff is pretty nice front end for ffmpeg. I’ve tried ffmpegX, for OS X, in the past and that is a pile of crap. Any suggests for a gui ffmpeg for linux?

Once again thanks guys!

Could be the reindexing that is done when reading in a mpeg file. For the I, P and B frames, beyond me though.

Any suggests for a gui ffmpeg for linux?
Avidemux, Avisynth, Blender :slight_smile: etc, they include FFMPEG along with a few other libraries rather than just being a GUI to FFMPEG which hedges your bets a bit.

WinFF is available for Linux i think or at least it runs with wine. I have it in installed but never used it.

@Cyberpatriot: it’s good to hear that Yellow’s suggestion worked and reencoding was unecessary. I will surely make a note of this for future reference.
@Yellow: just finished installing Koala and winff is available straight from the repositories. The interface looks a bit intimidating but hey, this is Blender users we’re talking about so… I must confess that the number of presets available in winff is very impressive.
As a side note, the Blender version available for Koala is 2.49a! :frowning: