ffmpeg minimal requirements configuration for encoding and decoding h264 files

5,022

You're trying to create a .mp4 file but you don't have the mp4 muxer enabled. Change --enable-muxer=h264 to --enable-muxer=mp4 in your config line and it should work.

Share:
5,022

Related videos on Youtube

TheSquad
Author by

TheSquad

Updated on September 18, 2022

Comments

  • TheSquad
    TheSquad over 1 year

    I'm trying to compile ffmpeg with minimal requirements in order to encode/decode with h264.

    So far my command line configuration is :

    ./configure --disable-yasm --disable-everything --enable-encoder=libx264 --enable-encoder=libfaac --enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 --enable-parser=h264 --enable-protocol=file
    

    once compiled, I try this :

    ./ffmpeg -i ~/Dropbox/TestFile.mov -vcodec libx264 test.mp4
    

    but I get an error :

    ffmpeg version N-58081-g2925571 Copyright (c) 2000-2013 the FFmpeg developers
      built on Nov 14 2013 15:49:58 with Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
      configuration: --disable-yasm --disable-everything --enable-encoder=libx264 --enable-encoder=libfaac --enable-decoder=h264 --enable-muxer=h264 --enable-demuxer=h264 --enable-parser=h264 --enable-protocol=file
      libavutil      52. 52.100 / 52. 52.100
      libavcodec     55. 43.100 / 55. 43.100
      libavformat    55. 21.100 / 55. 21.100
      libavdevice    55.  5.100 / 55.  5.100
      libavfilter     3. 91.100 /  3. 91.100
      libswscale      2.  5.101 /  2.  5.101
      libswresample   0. 17.104 /  0. 17.104
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/mGs/Dropbox/TestFile.mov':
      Metadata:
        major_brand     : qt  
        minor_version   : 0
        compatible_brands: qt  
        creation_time   : 2013-06-23 14:33:09
        model           : iPhone 4S
        model-fra       : iPhone 4S
        encoder         : 6.0
        encoder-fra     : 6.0
        date            : 2013-06-23T16:33:09+0200
        date-fra        : 2013-06-23T16:33:09+0200
        make            : Apple
        make-fra        : Apple
      Duration: 00:00:42.09, start: 0.000000, bitrate: 20960 kb/s
        Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 20880 kb/s, 29.97 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
        Metadata:
          rotate          : 180
          creation_time   : 2013-06-23 14:33:09
          handler_name    : Core Media Data Handler
        Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, 63 kb/s (default)
        Metadata:
          creation_time   : 2013-06-23 14:33:09
          handler_name    : Core Media Data Handler
    [NULL @ 0x7fd999802e00] Unable to find a suitable output format for 'test.mp4'
    test.mp4: Invalid argument
    

    This is probably coming from the fact that I have forgot something to enable on the ffmpeg configuration... But I can't found out what.

    The test file is a video got from iPhone 4S Camera.

    EDIT :

    Enabled decoders:
    h264
    
    Enabled encoders:
    
    Enabled hwaccels:
    
    Enabled parsers:
    h264
    
    Enabled demuxers:
    asf         mov         rm
    h264            mpegts          rtsp
    
    Enabled muxers:
    ffm         h264
    
    Enabled protocols:
    file            rtp         udp
    http            tcp
    
    Enabled filters:
    aformat         format          trim
    anull           null
    atrim           setpts
    

    Apparently it does not activate the encoder libx264 although I have specified it in my command line...

    • slhck
      slhck over 10 years
      --disable-everything? If you choose that, everything you enable will be disabled, notably the --enable-encoder= parts. I think you need --enable-libx264 at the very least.
    • TheSquad
      TheSquad over 10 years
      doesn't --disable-everything will let me enable things one by one ?
    • slhck
      slhck over 10 years
      Not sure – I haven't tried recompiling. I was just looking at the configure script. It basically unsets all the components.
    • TheSquad
      TheSquad over 10 years
      @slhck : I have checked on the configuration, it enables correctly the codec I want one by one, see the post EDITED :-)
    • slhck
      slhck over 10 years
      No, it does not. Your list shows Enabled encoders: as empty. You should have at least libx264 there.
    • TheSquad
      TheSquad over 10 years
      @slhck Yes I have noted it on the EDIT, but even if I only configure with ./configure --disable-yasm it doesn't show on the list...
    • TheSquad
      TheSquad over 10 years
      I will try to install yasm to see if libx264 is disabled because of that
    • TheSquad
      TheSquad over 10 years
      nope, even with yasm, libx264 does not appear on the list...
    • slhck
      slhck over 10 years
      Again, that's because --disable-everything disables everything. You can't selectively re-enable components after that. ./configure --enable-libx264 --enable-gpl is the minimum you need. From there you could start disabling things manually that you don't need, of course.
    • Rajib
      Rajib over 10 years
      @slhck If he just installed yasm, then how was h264 compiled? One needs yasm to compile x264.
    • slhck
      slhck over 10 years
      @Rajib h264 is ffmpeg-internal. Not an external library.
    • Rajib
      Rajib over 10 years
      @slhck Sorry I meant libx264- because the config you suggest is --enable-libx264.
    • Sir Codelot
      Sir Codelot over 9 years
      Did root ever resolve this?
    • rogerdpack
      rogerdpack over 8 years
      I wouldn't recommend --disable-yasm that sounds pretty scary :)
    • Elliott B
      Elliott B about 8 years
      Why do you want to disable everything?