[LAU] OT - syncing partially out of sync video and audio in existing files

Robin Gareus robin at gareus.org
Fri Jun 10 19:44:04 UTC 2011


On 06/10/2011 05:58 PM, Philipp wrote:
> Hi,
> sorry for abusing this list for a mostly video editing question, but I
> didn't find a proper list and knew that we have some video people on
> this list.
> 
> I'd like to fix some videos that have partially out of sync video and
> audio, meaning that beginning at a certain point in the video the audio
> is suddenly out of sync by a couple of seconds. There's no constant
> change, the delay seems fixed once it's there.
> 
> I wonder how to fix such a thing. The files are xvid encoded videos and
> vbr mp3 audio inside avi containers. I thought it should be reasonably
> easy to cut and move the audio (re-encode if unavoidable, but I know
> it's in principle possible without) and put it back in a container, but
> I didn't manage.
> 
> Can someone recommend a program/workflow that would allow this?
> 
> I tried:
> - Avidemux: seems like actual editing is not what this program was
>   written for, couldn't figure it out, but it seems close
> 
> - openshot: couldn't figure out how to separate video/audio
> 
> - kino: seems to only work with DV-files, apparently takes ages to
>   decode the file, doesn't seem to be what I need
> 
> - openmovieeditor: I figured it might work by dragging the file to both
>   a video and an audio track, but I got extremely garbled audio output,
>   no idea what's wrong
> 
> - cinelerra-cv: Doesn't start. No error message, it simply shows no
>   window, nothing. Well, it does something with the screen, but it shows
>   nothing.
> 
> - pitivi: Doesn't seem like it can play back the video. I can drag the
>   video to the tracks and it starts to draw a waveform, I guess no video
>   thumbnails because of: gst.ElementNotFoundError: pngenc
>   Doesn't seem to be able to play the video.
> 
> - kdenlive: would require me to install 30 additional packages, total
>   about 200MB, no thanks.
> 
> I thought it would be a simple task, really nothing fancy. Seems like I
> was wrong.

If you're just interested to do it once during playback: with mplayer
you can set A/V offset (using '+' and '-' and 'o' for
on-screen-display). IIRC VLC can do it as well...

If you're up to compiling A3 + videotimeline: it's intended for this
kind of work: http://rg42.org/wiki/a3vtl - basically it does the
following (but with a nice GUI);

1) separate A/V
  ffmpeg -i INPUT.avi -vn audio.wav;
  ffmpeg -i INPUT.avi -an -sameq video.avi

2) re-align A/V (by shifting/cutting the audio)
   You could do this step with xjadeo & ardour2

3) Mux A/V
  ffmpeg -i video -i audio.wav -vcodec copy -sameq output.avi

The A3-vtl video-export offers a lot more ffmpeg encoding options
optimizations.. but the above command should do; see `man ffmpeg` or
`ffmpeg --help` - though reading those is only for the faint-hearted.
google is your friend.

Sorry short reply. I'm a bit tied up this week-end and mostly offline.
HTH,
robin


More information about the Linux-audio-user mailing list