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

pshirkey at boosthardware.com pshirkey at boosthardware.com
Fri Jun 10 19:56:06 UTC 2011


> Excerpts from Ralf Mardorf's message of 2011-06-10 19:24:54 +0200:
>> On Fri, 2011-06-10 at 18:57 +0200, Renato wrote:
>> > On Fri, 10 Jun 2011 17:58:46 +0200
>> > Philipp <hollunder at lavabit.com> 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.
>> > >
>> > > Regards,
>> > > Philipp
>> > >
>> >
>> > Hi, unfortunately can't give you a full solution, but only a hint: in
>> > mplayer with "-" and "+" you can adjust audio/video syncronization by
>> > multiples of 100ms (maybe you cand do finer, but I'm not sure).
>> >
>> > maybe you could then somehow record the output to a new file?
>
> Thanks Renato, I've played with that already and know the approximate
> offsets, but that doesn't help much. I'm not sure screen recorders
> typically can pause and resume, and even then it would be less than
> optimal anyway due to the transcoding of both audio and video.
>
> Also, to clarify, those offsets are constant but only appear beginning
> at a certain point in the file, imaginary example: after 97 Minutes the
> offset is suddenly approximately -9600ms. Hence shifting the offset of
> the whole file doesn't help.
>


I went through this a couple of years back with pretty much the same
result. The general consensus round here was that it is not possible to
shrink a video to fit with an audio track. Instead you should stretch the
audio track to fit the video.

I ended up using Blender to edit the video into chunks and align chunks of
audio to fit as best as possible.

I don't understand why it is not possible to resize a video track. It
seems to me that dropping video frames is significantly easier
programatically than time stretching audio.


>> I don't think so, assumed you can display the video without side effects
>> in a way, that you could 'record your desktop', than you only would be
>> able to record video, but AFAIK not audio.
>> An app like Cinelerra can separate the container's audio and video, but
>> using video apps on Linux can become a PITA ...
>>
>>         21.9 Improving performance
>>
>>         For the moment GNU/Linux is not an excellent desktop. It is more
>>         of a server. Most of what you will find on modern GNU/Linux
>>         distributions are faceless, network-only programs strategically
>>         designed to counteract one Microsoft server feature or another
>>         and not to perform very well at user interaction. There are a
>>         number of parameters on GNU/Linux, which ordinary people can
>>         adjust to make it behave more like a thoroughbred in desktop
>>         usage.
>>         21.9.1 Disabling swap space
>>         21.9.2 Enlarging sound buffers
>>         21.9.3 Freeing more shared memory
>>         21.9.4 Speeding up the hard drive
>>         21.9.5 Disabling cron
>>         21.9.6 Reducing USB mouse sensitivity
>>         21.9.7 Assorted X tweeks
>>         21.9.8 Speeding up the file system
>> http://cinelerra.org/docs/cinelerra_cv_manual_en.html
>>
>> ... if the app after editing should make a container again, it can
>> happen that the old man became a voice like Mickey Mouse or the
>> beautiful woman is transformed to a Conehead. After 12 hours using all
>> resources of your computer you will know if the video is ok or not. I
>> nearly have forgotten to mention, that it also can happen that audio and
>> video get out of sync during this process ;). YMMV.
>>
>> On my machine Cinelerra always 'worked' OOTB! On Philipp's it doesn't
>> run.
>>
>> Regards,
>>
>> Ralf
>
> Thanks Ralf,
> I had looked at the typical problems but they all mention error messages
> while I get none:
>
> -----
>
> $ cinelerra
> Cinelerra 2.1.5CV  GIT::01dc4375a0fb65d10dd95151473d0e195239175f  (C)
> 2010 Heroine Virtual Ltd.
> External ffmpeg
> Compiled on Mon Mar 28 20:17:50 UTC 2011
>
> Cinelerra is free software, covered by the GNU General Public License,
> and you are welcome to change it and/or distribute copies of it under
> certain conditions. There is absolutely no warranty for Cinelerra.
>
> -----
>
> That's it, nothing else happens in the console and no visible window
> appears, though an invisible does appear (I can tell from the reaction
> of my window manager, it tiles the invisible window but nothing is
> painted there).
>
> I thought cutting and aligning audio/video on a timeline would be a
> basic operation and possible in every NLVE...
>
> _______________________________________________
> Linux-audio-user mailing list
> Linux-audio-user at lists.linuxaudio.org
> http://lists.linuxaudio.org/listinfo/linux-audio-user
>



More information about the Linux-audio-user mailing list