Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running KUbuntu 11.10 Linux.

I would like to extract a clip from an MP4 file. I tried this command:

myCLIPrompt:~/Downloads/temp/clips$ mencoder -ss 00:43:13 -endpos 00:02:12 -oac copy -ovc copy The.Original.Video.\[VTV\].mp4 -o TheClip.mp4

and I got this error message:

MEncoder SVN-r33713-4.6.1 (C) 2000-2011 MPlayer Team

WARNING: OUTPUT FILE FORMAT IS _AVI_. See -of help.
success: format: 0  data: 0x0 - 0x19148a83
libavformat file format detected.
[lavf] stream 0: video (h264), -vid 0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  720x404  24bpp  29.970 fps  843.8 kbps (103.0 kbyte/s)
[V] filefmt:44  fourcc:0x34363248  size:720x404  fps:29.970  ftime:=0.0334
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, s16le, 143.0 kbit/9.31% (ratio: 17880->192000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
videocodec: framecopy (720x404 24bpp fourcc=34363248)
Audio format 0x4134504d is incompatible with '-oac copy', please try '-oac pcm' instead or use '-fafmttag' to override it.

Exiting...

How do I do it the correct way?

Thanks in advance

Steve

share|improve this question
add comment

2 Answers

Use avconv. For example, if you'd like to extract a clip of duration 10s starting at 15s, then you'd use

avconv -ss 00:00:15 -t 00:00:10 -i input.mp4 -codec copy output.mp4

There are a lot more options that you can play with, like specifying the resolution, output format etc. See the man page of avconv for all the options.

If you happen to have ffmpeg you can use

ffmpeg -ss 00:00:15 -t 00:00:10 -i input.mp4 -c:v copy -c:a copy output.mp4 
share|improve this answer
    
The second one worked for me. I don't have avconv in my system. When I Googled how to install it I saw something about having to compile it. Does it do anything that ffmpeg doesn't to justify the trouble? –  user787832 Jul 7 '12 at 19:07
    
ffmpeg is now deprecated. It is not developed anymore and is there on 12.04 only for compatibility. –  abhshkdz Jul 7 '12 at 19:17
    
Good to know, I'll switch to avcconv when there is a compiled version to download. Thanks for the good info. –  user787832 Jul 7 '12 at 19:42
    
No problem. Cheers mate :) –  abhshkdz Jul 7 '12 at 19:52
3  
@abhshkdz FFmpeg is not deprecated. It is actively developed. Where did you get that info from? The Ubuntu package message is simply wrong. See here: Bug #939863 “Warning message from ffmpeg program needs update” –  slhck Jul 11 '12 at 17:03
show 2 more comments
up vote 1 down vote accepted

Googling around my ffmpeg command should have been more like this

ffmpeg -i InputFile -ss StartTime -t Duration Outputfiless
ffmpeg -i input.mp4 -ss 00:07:38 -t 00:07:36 output.mp4

-ss being the time in the video to start the clip at, -t the duration of the clip. Never use more than 60 units for minutes or seconds. For example if the duration is 6 minutes and 62 seconds write 07:02, for seven minutes and two seconds

I got on the ffmpeg-users GNUMailman email list. I was told that the Ubuntu family of distributions uses an old, buggy, unsupported port of ffmpeg.

http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html

http://stackoverflow.com/a/9477756/1109017

I was told that if I wanted ffmpeg to work on even the latest Ubuntu family distribution I would need to get the source code directly from the ffmpeg project, compile and set it up myself.

https://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide

HTH

Steve

share|improve this answer
    
Just want to note: this work on the HomeBrew version of ffmpeg on Mac OS/X Mountain Lion as well. –  tamouse Sep 24 '13 at 5:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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