I'm trying to convert a large MKV to an old-school AVI file.

I'm trying this:

ffmpeg -i video.mkv -s -codec:v mpeg4 -bf 1 -b 2567k -mbd 2 -g 300 -flags cgop -acodec copy video.avi

but I get

[NULL @ 0x7fa0d901e600] Unable to find a suitable output format for 'mpeg4' mpeg4: Invalid argument

Long version of ffmpeg's message...

ffmpeg version 2.1.3 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb  4 2014 17:53:32 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.3 --enable-shared     --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-     hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags=        --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Input #0, matroska,webm, from ‘video.mkv':
    creation_time   : 2011-05-11 09:25:47
  Duration: 00:49:01.35, start: 0.000000, bitrate: 2851 kb/s
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709), 1280x720, SAR 1:1 DAR 16:9, 23.98 fps, 23.98 tbr, 1k tbn, 47.95 tbc (default)
    Stream #0:1(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 384 kb/s (default) (forced)
    Stream #0:2(eng): Subtitle: subrip
[NULL @ 0x7fa0d901e600] Unable to find a suitable output format for 'mpeg4' 
mpeg4: Invalid argument

Any idea what's going on?

EDIT: I intended to use ffmpeg after DivX Converter - both on Mac and Windows - would fail at various points trying to transcode a video to DivX Home Theater profile. The closest I got was shlck's answer. It threw up only warnings (rather than errors.) In any case, I couldn't get the video to play on the DVD player (it would freeze every 10 seconds for about 6 seconds). If you've found this question while trying to research the creation of a DivX Home Theater profile-compatible video, you could possibly use this string as a starting point to figure out what's wrong, and post a new follow up question to SU:

ffmpeg -i video.mkv -s 720x406 -codec:v mpeg4 -bf 1 -b:v 2567k -mbd 2 -g 300 -flags cgop -sc_threshold 1000000000 -acodec copy video.avi

(In the end I gave the old DVD player away).

  • -s is to specify the size of the output. The format is -s w x h, where w and h is width and height of the output. – Vineet Menon Feb 18 '14 at 5:10
  • Thanks but if you read my edit, or the answer and comments by slhck which I accepted, you would see that was the first thing that got corrected. – iceequal Feb 18 '14 at 5:17
  • yeah! i saw your edited question a bit late. – Vineet Menon Feb 18 '14 at 9:41

You have a lonely -s option there. It misses its argument.

You should specify the size you want or leave it out entirely – otherwise it will not interpret -codec:v correctly and assume mpeg4 is your output filename.

Additionally, use -b:v instead of just -b – it's ambiguous.

ffmpeg -i video.mkv -s 1280x720 -codec:v mpeg4 -bf 1 -b:v 2567k -mbd 2 -g 300 -flags cgop -acodec copy video.avi
  • Thanks! I've put -s 720x406 but now get: [mpeg4 @ 0x7fc13a813800] Invalid pixel aspect ratio 406/405, limit is 255/255 reducing / [mpeg4 @ 0x7fc13a813800] closed gop with scene change detection are not supported yet, set threshold to 1000000000 (...) / Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height / I'm using the resolution that the DivX Converter application suggests for the 'Home Theatre' profile given the same input file (DivX converter has fatal bugs of its own). Any idea where to go from here w/ ffmpeg? – iceequal Feb 4 '14 at 14:31
  • (I also corrected the -b option) – iceequal Feb 4 '14 at 14:35
  • Remove the -flags cgop if you don't necessarily need it. Or add -sc_threshold 1000000000 as an option. – slhck Feb 5 '14 at 7:10
  • -sc_threshold 1000000000 allowed ffmpeg to at least transcode the file. For anyone trying to create a DivX Home Theater profile-compatible video, refer to my edited question above (you'll need to do more asking/research). – iceequal Feb 18 '14 at 5:05

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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