How to use libx264 ffmpeg in conda environment?

2

I tried to convert an avi video file into an h264 processed mp4 file, but I ran into the following error:

$ ffmpeg -i sa1-video-fram1.avi -c:v libx264 -crf 19 -c:a libfdk_aac -b:a 192k -ac 2 out.mp4
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.2.0 (crosstool-NG fa8859cb)
  configuration: --prefix=/home/anaconda2_new/envs/faceswap-GAN --cc=/opt/conda/conda-bld/ffmpeg_1531088893642/_build_env/bin/x86_64-conda_cos6-linux-gnu-cc --disable-doc --enable-shared --enable-static --enable-zlib --enable-pic --enable-gpl --enable-version3 --disable-nonfree --enable-hardcoded-tables --enable-avresample --enable-libfreetype --disable-openssl --disable-gnutls --enable-libvpx --enable-pthreads --enable-libopus --enable-postproc --disable-libx264
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, avi, from 'sa1-video-fram1.avi':
  Metadata:
    encoder         : Lavf57.83.100
  Duration: 00:00:04.93, start: 0.000000, bitrate: 359 kb/s
    Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 512x384, 280 kb/s, 25 fps, 25 tbr, 25 tbn, 50 tbc
    Stream #0:1: Audio: aac (LC) ([255][0][0][0] / 0x00FF), 16000 Hz, mono, fltp, 69 kb/s
Unknown encoder 'libx264'

So, I installed libx264 via running the following command:

conda install -c conda-forge x264

But it doesn't solve the error above.

Question:

How to use libx264 ffmpeg in conda environment?

Jay Xiong

Posted 2019-04-02T10:00:24.543

Reputation: 21

To be specific, I previously installed an environment with ffmpeg in it, so I just use conda install -c conda-forge x264 under the created conda environment. – Jay Xiong – 2019-04-02T10:02:52.297

Your ffmpeg config has --disable-libx264 so no x264 for you. Enable it and rebuild. – Gyan – 2019-04-02T11:59:48.467

4Thx! It does work. Also, use conda install x264=='1!152.20180717' ffmpeg=4.0.2 -c conda-forge works too. – Jay Xiong – 2019-05-14T03:44:47.177

What does '1!152.20180717' mean? – muuh – 2019-10-22T19:39:35.237

its a version control number. looks weird though. – Jay Xiong – 2019-10-28T03:50:34.380

No answers