如何使用ffmpeg在H.264中编码视频?

sea*_*est 1 ffmpeg h.264

我已经从https://github.com/FFmpeg/FFmpeg安装了ffmpeg 3.0 ,我试图将用mepeg4第2部分编码的视频转换为H264,但是我收到了Unknown encoder 'libx264' 错误

这是我的人:(我试过h264,x264,libx264,没有一个工作)

ffmpeg -i Fashion.divx -acodec aac -vcodec libx264  out.mp4
Run Code Online (Sandbox Code Playgroud)

我查看了支持的编解码器列表

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
Run Code Online (Sandbox Code Playgroud)

这是h264:

 D.V.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_vdpau)
Run Code Online (Sandbox Code Playgroud)

我正在使用ffmpeg 3.0,从该列表中看来,似乎不支持使用h264编码,只支持解码h264,对吧?

我尝试使用本指南启用h.264 如何使用libx264快速编译FFmpeg(x264,H.264)

./configure --enable-gpl --enable-libx264
Run Code Online (Sandbox Code Playgroud)

我得到./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
ffmpeg-user@ffmpeg.org 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.
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能使h.264中的编码视频有效?

sea*_*est 5

好的,我刚刚发现我需要单独安装libx264,这是命令

sudo apt-get install yasm libvpx. libx264.
Run Code Online (Sandbox Code Playgroud)

确实在安装libx264后,我得到了

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