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.


edit:
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.

link|improve this question
feedback

1 Answer

up vote 3 down vote accepted

Do you really not want to compile yourself? It's pretty easy. Follow the tutorials here to install the latest version of FFmpeg. It takes a few minutes.

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.

If everything's done, extract from the source file. This would be something along (just copy and paste everything, including the backslashes.):

ffmpeg -ss 00:01:23.450 -i file.ogv -t 00:00:10.000 \
-vcodec libx264 -vprofile high -preset slow \
-acodec libfaac -async 1 \
out.mp4

This command will:

  • extract from minute 1, at 23 seconds and 450 milliseconds
  • extract 10 seconds from the clip
  • extract as h.264 encoded video, using the high profile and a rather good average quality setting
  • extract audio as AAC and sync it (didn't know that was necessary, but it seems to occur sometimes)

I think there are plenty of options you can tune here, like the video quality, the audio codec used, et cetera. I use this approach at work all the time. If you need anything specific, drop a comment.

You can also copy without re-encoding anything:

ffmpeg -ss 00:01:23 -i file.ogv -t 00:00:10 -vcodec copy -acodec copy out.ogv
link|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 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 at 22:00
Hm, that's weird? You could try adding the -async 1 option. – slhck Jan 4 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 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 at 22:15
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.