1
votes

I have installed ffmpeg 3.0 from https://github.com/FFmpeg/FFmpeg, I am trying to convert a video coded with mepeg4 part 2 to H264, but I got Unknown encoder 'libx264' error

Here is my comannd: (I tried h264, x264, libx264, none of them worked)

ffmpeg -i Fashion.divx -acodec aac -vcodec libx264  out.mp4

I checked the list of supported codec

Codecs:
 D..... = Decoding supported
 .E.... = Encoding supported
 ..V... = Video codec
 ..A... = Audio codec
 ..S... = Subtitle codec
 ...I.. = Intra frame-only codec
 ....L. = Lossy compression
 .....S = Lossless compression
 -------
 D.VI.. 012v                 Uncompressed 4:2:2 10-bit

Here is h264:

 D.V.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau)

I am using ffmpeg 3.0, from that list, it seems that encoding with h264 is not supported, only decoding h264 is supported, right?

I tried to enable h.264 with this guide How to quickly compile FFmpeg with libx264 (x264, H.264)

./configure --enable-gpl --enable-libx264

bu I get ./configure --enable-gpl --enable-libx264

ERROR: libx264 not found

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
[email protected] mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solve the problem.

what should I do to make encode video in h.264 work?

2
Step 1 from the quick compilation guide you linked: Compile x264aergistal
yes, I just found out I need to install libx264 separately, thx.seaguest

2 Answers

5
votes

Ok, I just found out I need to install libx264 separately, here is the command

sudo apt-get install yasm libvpx. libx264.

Indeed after install libx264, I get

 DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau ) (encoders: libx264 libx264rgb )
1
votes

Hehe, you've already answered your own question:

Here is h264:

 D.V.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau)

As the listing suggests, the encoder's name is h264, the codec's name can be found between the braces.

So your command should look like this:

ffmpeg -i Fashion.divx -acodec libfaac -vcodec h264  out.mp4

My FFmpeg version has libx264, so the -codecs option prints me this:

DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau ) (encoders: libx264 libx264rgb )

As you can see, I could use -vcodec libx264 or -vcodec libx264rgb.