I am having a problem using ffmpeg which is driving me a little mad, so I hope someone can help me out.

I have a 13 MPEG-4 .mp4 video of which I am attempting to trim the first two seconds off using ffmpeg and display in an Android app.

From the numerous tuts online i am excecuting the following on the command line

ffmpeg -i untrimmed_video.mp4 -vcodec copy -ss 2 trimmed_video.mp4

with no luck as it outputs a video of 4-seconds length (i have no idea where its getting 4 from), if i change this to 3 i still get a 4 second video, if i set it to 10 i get unplayable output.

if i move the -ss arg to

ffmpeg -vcodec copy -i untrimmed_video.mp4 -ss 2 trimmed_video.mp4 

i get output the same length as the input, same as if i move to the end.

I have tried lots of variations as orders and nothing seems to work, is this a bug, am i doing something wrong?!

please help!!!

link|improve this question

60% accept rate
OK, it seems if i leave out the '-vcodec copy' args it works fine. It give a buffer error but still completes, just move the -ss to before -i and all works fine - finally!!!! – Dori Jun 28 '11 at 14:26
feedback

1 Answer

As you seem to have discovered, order of command line arguments can matter with some programs - this seems to have been such a case. Another option for this would have been to use mencoder with similar command line options, as it too, can do this.

So, for future users wondering about this same question, please confirm that the command that worked for you is:

ffmpeg -vcodec copy -ss 2 -i untrimmed_video.mp4 trimmed_video.mp4 

For Ubuntu users, I've found the gui tool "pitivi" to be really really really nice for editing videos graphically. You have to install it from the Software Centre (or via apt-get). It's fairly reminiscent of iMovie HD, to me anyway. So that's a fairly easy option for cropping videos too, though you'll really want to use ffmpeg if you figure out the correct commands and want to be fast about it.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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