I have mentioned this issue before, but sadly, it was on Facebook comments. Try to find a status post with comments you’ve made a long time ago. Facebook currently doesn’t implement a reasonable way to search your own ancient statusses and comments.

So, I had to re-create the procedure. It’s not staight forwards, and it seems more people are suffering from this issue. So I’ve decided to put it here on my blog.

So, I want to record a video with my webcam. For this purpose I use Cheese Webcam Studio. Now the problem is, the first part of the video contains some audio problems, causing the file to go out of sync. A way to fix it is to skip the first 30 seconds of a recording.

Using ffmpeg you can do this by

ffmpeg -acodec copy -vcodec copy -ss 30 -i input.ogv output.ogv

We just copy the video and audio stream to a new file, and skip the first 30 seconds. Playing it locally using mplayer now correctly displays the video.

Now, uploading it to youtube will fail. It seems, YouTube doesn’t correctly handle the Theora codec in an Ogg-container. The solution to this is copying the video to a Matroska container instead. So we get

ffmpeg -acodec copy -vcodec copy -ss 30 -i input.ogv output.mkv

Now, playing it locally with mplayer shows the aspect ratio is messed up. So, trying to ass the aspect ratio

ffmpeg -acodec copy -vcodec copy -ss 30 -aspect 4:3 -i input.ogv output.mkv

But this had NO EFFECT WHATSOEVER. It seems, ffmpeg is sensitive to the order of the parameters, and only accepts the -aspect parameter as last parameter, just before the output filename. So

ffmpeg -acodec copy -vcodec copy -ss 30 -i input.ogv -aspect 4:3 output.mkv

will do the trick and produce a video file that’s correctly synchronised, and ‘compatible’ with YouTube.