8
votes

i am a newbie to ffmpeg and am using it on Windows. I tried to convert an avi file using the H.264 vcodec (h264). Got this error: Unknown encoder 'h264'. The 'Unknown encoder' error also showed up for mp3 for -acodec usage.

Can anyone please help me out with this?

4

4 Answers

14
votes

A few things:

  1. Run the command ffmpeg -codecs to list the codecs your ffmpeg build supports.
  2. h264 and mp3 are compression standards, but do not really identify a specific encoder. The H.264 encoder that ffmpeg uses is x264 and you will either have to use x264 or libx264 in your command line depending on what is listed in #1. The mp3 encoder is lame and usually is identified by something like libmp3lame.
  3. You must have a version of ffmpeg that is built with support for these libraries since they are not directly part of ffmpeg. If these codecs are not listed in ffmpeg -codecs you need to create or find a build that supports them.
3
votes

Install x264 and add run ./configure in ffmpeg's directory, using these flags:

--enable-gpl 
--enable-shared 
--enable-libx264
--extra-cflags="-I/path/to/include" 
--extra-ldflags="-L/path/to/lib"

where -I/path/to/include is likely -I/usr/local/include and -L/path/to/lib is likely -L/usr/local/lib.

0
votes

Make sure you have enabled the 'h264' encoder while configuring the FFmpeg. 'h264' encoders comes under GPL.