Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So first, a little background. I record videos using recordMyDesktop. It's not the gtk or qt wrappers, I just use the command line. The command looks like this.

recordmydesktop -o file.ogv --full-shots --device=default

The problem is that it saves Theora video and Vorbis audio in OGV container. There are no alternatives I can use. My problem is that I end up with a some time before and some time after the desired recording time. That is, the time I spend setting up, and cleaning up. I want to remove this. So my question is...

How do I extract seconds X to Y from the video?

I want to retain all the original quality. It has to be uploadable to YouTube as well. I don't actually care about a different format as long as those two conditions are met.

I'm using Linux Mint (Ubuntu/Debian based), and I can install whatever free software is needed, so long as I don't have to compile it my self.

I tried the solution posted here. The avi it produced had the audio out of sync, and somehow discarded everything after the first 30 seconds.

share|improve this question
up vote 9 down vote accepted

Do you really not want to compile yourself? It's pretty easy. Follow the guides here to install the latest version of FFmpeg. It takes a few minutes. You can also download a static build from their download page, which you just have to extract and you're ready to go.

I'd really advise you to go for the latest, as the versions shipped with Ubuntu (Mint) are probably buggy and really outdated, and you need a few dependencies when installing with apt-get.

First of all, you can extract a part without re-encoding anything, e.g. 10 seconds starting from 01:23:

ffmpeg -ss 00:01:23 -i file.ogv -t 00:00:10 -c copy out.ogv

If you want to re-encode the video (which should help in case of synchronization issues), this would be something along the following, for H.264 video and AAC audio (just copy and paste everything, including the backslash):

ffmpeg -ss 00:01:23.450 -i file.ogv -t 00:00:10.000 \
-c:v libx264 -preset slow -c:v aac -strict experimental -b:a 128k out.mp4

For a detailed explanation of what options you can add here, check the x264 encoding guide.

share|improve this answer
I'm trying it out. Thanks a lot! (I'm compiling it too. I've never found a guide that worked for me before, but I think this one will.) – FakeRainBrigand Jan 4 '12 at 21:31
I compiled everything successfully (yay!). I ran that command as posted. The video and audio are out of sync. The video seems to be correct. The audio seems to be about 40 seconds behind. Any ideas? note: that's also about half of 1:23... if that has something to do with it. – FakeRainBrigand Jan 4 '12 at 22:00
Hm, that's weird? You could try adding the -async 1 option. – slhck Jan 4 '12 at 22:07
That seems to have fixed it. Thanks a lot. I'm just going to convert the whole thing and then accept the answer if all goes well :) – FakeRainBrigand Jan 4 '12 at 22:13
Cool! Good to know :) Added a way to copy without re-encoding. YouTube might have problems with that though. – slhck Jan 4 '12 at 22:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .