LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   ffmpeg Unknown encoder 'libx264' (https://www.linuxquestions.org/questions/slackware-14/ffmpeg-unknown-encoder-libx264-4175677695/)

mfoley 06-26-2020 04:20 PM

ffmpeg Unknown encoder 'libx264'
 
In addition to my recent ffmpeg post (https://www.linuxquestions.org/quest...75#post6138275) I have another issue. I've tried:
Code:

ffmpeg -f image2  -r 1/5 -pattern_type glob -i './*.[jJ]*' -c:v libx264 -pix_fmt yuv420p out.mp4

Unknown encoder 'libx264'

I've downloaded and installed package x264 from SlackBuilds (via sbopkg), and re-installed package ffmpeg from SlackBuild. libx264 is in:
Code:

-rwxr-xr-x 1 root root 1019528 Jun 26 16:33 /usr/lib64/libx264.so.148
lrwxrwxrwx 1 root root 14 Jun 26 16:33 /usr/lib64/libx264.so -> libx264.so.148

So, why is ffmpeg giving me this error?

LuckyCyborg 06-26-2020 04:23 PM

Quote:

Originally Posted by mfoley (Post 6138303)
In addition to my recent ffmpeg post (https://www.linuxquestions.org/quest...75#post6138275) I have another issue. I've tried:
Code:

ffmpeg -f image2  -r 1/5 -pattern_type glob -i './*.[jJ]*' -c:v libx264 -pix_fmt yuv420p out.mp4

Unknown encoder 'libx264'

I've downloaded and installed package x264 from SlackBuilds (via sbopkg), and re-installed package ffmpeg from SlackBuild. libx264 is in:
Code:

-rwxr-xr-x 1 root root 1019528 Jun 26 16:33 /usr/lib64/libx264.so.148
lrwxrwxrwx 1 root root 14 Jun 26 16:33 /usr/lib64/libx264.so -> libx264.so.148

So, why is ffmpeg giving me this error?

Because of the greedy Hollywood barons.

It is not legal to ship some particular codecs unless you pay royally for them, and that happens specially and particularly in USA.

teckk 06-26-2020 04:47 PM

ffmpeg has to have x264 support compiled in. It usually does.
Code:

ffmpeg -codecs
...
 DEV.L. h263p                H.263+ / H.263-1998 / H.263 version 2
 DEV.LS h264                H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_qsv h264_cuvid ) (encoders: libx264 libx264rgb h264_nvenc h264_omx h264_qsv h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
 D.VIL. hap                  Vidvox Hap
 DEV.L. hevc                H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_qsv hevc_v4l2m2m hevc_cuvid ) (encoders: libx265 nvenc_hevc hevc_nvenc hevc_qsv hevc_v4l2m2m hevc_vaapi )
...

Also when you launch ffmpeg
Code:

ffmpeg
ffmpeg version n4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265....


LuckyCyborg 06-26-2020 04:51 PM

The Slackware does not ships H264 encoders, only H264 decoders. Because of reasons.

drgibbon 06-26-2020 04:56 PM

Quote:

Originally Posted by mfoley (Post 6138303)
I've downloaded and installed package x264 from SlackBuilds (via sbopkg), and re-installed package ffmpeg from SlackBuild. So, why is ffmpeg giving me this error?

Did you pass X264=yes to the script before building? For whatever reason, the ffmpeg build doesn't auto-detect these optional deps.

bassmadrigal 06-26-2020 05:01 PM

Did you enable x264 when compiling ffmpeg? It doesn't autodetect things, so you're forced to pass flags to enable/disable certain features. Per the README, x264 encoder support requires passing X264=yes to the SlackBuild (and installing x264).

You can check your available encoders by running ffmpeg -encoders and if the output is a bit overwhelming, you can pipe the info and grep for 264 (ffmpeg -encoders | grep 264)

EDIT: drgibbon beat me to it.

drgibbon 06-26-2020 05:14 PM

Quote:

Originally Posted by bassmadrigal (Post 6138322)
EDIT: drgibbon beat me to it.

Haha sorry, it seems I keep doing that :p

mfoley 06-26-2020 07:18 PM

Output to ffmpeg -encoders | grep 264:
Code:

ffmpeg -encoders | grep 264
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.5.0 (GCC)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/doc/ffmpeg-3.2.4/html --mandir=/usr/man --disable-debug --enable-shared --disable-static --enable-gpl --enable-version3 --enable-avresample --arch=x86_64 --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-libcaca --enable-libcdio --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-opengl --enable-libopenjpeg --enable-libpulse --enable-libsmbclient --enable-libwavpack --enable-x11grab
  libavutil      55. 34.101 / 55. 34.101
  libavcodec    57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter    6. 65.100 /  6. 65.100
  libavresample  3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample  2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
 V..... h264_nvenc          NVIDIA NVENC H.264 encoder (codec h264)
 V..... h264_vaapi          H.264/AVC (VAAPI) (codec h264)
 V..... nvenc                NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc_h264          NVIDIA NVENC H.264 encoder (codec h264)

It certainly seems to list h364, but I still get that error. Meanwhile, I'll try building with X264=yes and see what happens.

bassmadrigal 06-26-2020 10:13 PM

You don't have libx264 as an encoder option. Compare your output to mine:

Code:

jbhansen@craven-moorhead:~$ ffmpeg -encoders | grep 264
ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 5.5.0 (GCC)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/doc/ffmpeg-3.2.4/html --mandir=/usr/man --disable-debug --enable-shared --disable-static --enable-gpl --enable-version3 --enable-avresample --arch=x86_64 --enable-nonfree --enable-libschroedinger --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-gnutls --enable-libass --enable-libcaca --enable-libcdio --enable-libdc1394 --enable-frei0r --enable-libgme --enable-libiec61883 --enable-libilbc --enable-openal --enable-libopus --enable-librtmp --enable-libsnappy --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-opengl --enable-libopenjpeg --enable-libpulse --enable-libsmbclient --enable-openssl --enable-libwavpack --enable-x11grab
  libavutil      55. 34.101 / 55. 34.101
  libavcodec    57. 64.101 / 57. 64.101
  libavformat    57. 56.101 / 57. 56.101
  libavdevice    57.  1.100 / 57.  1.100
  libavfilter    6. 65.100 /  6. 65.100
  libavresample  3.  1.  0 /  3.  1.  0
  libswscale      4.  2.100 /  4.  2.100
  libswresample  2.  3.100 /  2.  3.100
  libpostproc    54.  1.100 / 54.  1.100
V..... libx264              libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (codec h264)
 V..... libx264rgb          libx264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 RGB (codec h264)
 V..... h264_nvenc          NVIDIA NVENC H.264 encoder (codec h264)
 V..... h264_vaapi          H.264/AVC (VAAPI) (codec h264)
 V..... nvenc                NVIDIA NVENC H.264 encoder (codec h264)
 V..... nvenc_h264          NVIDIA NVENC H.264 encoder (codec h264)


mfoley 07-02-2020 01:27 PM

Thanks all for the feedback. At the moment, I'm not that into this project enough to modify builds, etc. I'm going to move on and not deal with this one further.

drgibbon 07-02-2020 02:33 PM

All good. If anyone has this problem on the latest Slack you can fix it like this (assuming you installed x264 already):
Code:

rsync -avz rsync://mirrors.kernel.org/slackware/slackware-current/source/l/ffmpeg .
cd ffmpeg
su
X264=yes sh ./mirror/ffmpeg.SlackBuild

And then upgradepkg on the output (check the SlackBuild for other compile time environment vars, I really don't know why ffmpeg can't autodetect that stuff though :scratch:).

Alternatively slackpkg+ and alienbob's restricted ffmpeg would be an easier method in the long run.

bassmadrigal 07-02-2020 03:39 PM

Quote:

Originally Posted by drgibbon (Post 6140669)
I really don't know why ffmpeg can't autodetect that stuff though :scratch:).

This has been a major head scratcher for me too. I've been thinking about tweaking the SlackBuild script to add in autodetection and then submit it to the maintainer, but it's been low on my priority list.

Quote:

Originally Posted by drgibbon (Post 6140669)
Alternatively slackpkg+ and alienbob's unrestricted ffmpeg would be an easier method in the long run.

Just to clarify, you'd want the "restricted" ffmpeg that Alien Bob offers, as that includes support for various things that have patent restrictions (like x264 encoding).

https://bear.alienbase.nl/mirrors/pe...builds/ffmpeg/

drgibbon 07-02-2020 03:55 PM

Oops, yes, "restricted" :thumbsup:

Weber Kai 06-02-2021 01:17 AM

Sorry for necroposting, but I've made an improvement on this script to auto detect some libraries.
It's not complete, but maybe we could finish this list and send to the maintainer. The missing parts are marked with a #TODO comment
The following lines can be added just before the comments I've kept at the end.

Code:

LAME=$(/sbin/ldconfig -p | grep libmp3lame\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
X264=$(/sbin/ldconfig -p | grep libx264\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
CELT=$(/sbin/ldconfig -p | grep libcelt0\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
DC1394=$(/sbin/ldconfig -p | grep libdc1394\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
#TODO FREI0R libfrei0r
GSM=$(/sbin/ldconfig -p | grep libgsm\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
RTMP=$(/sbin/ldconfig -p | grep librtmp\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
SCHROEDINGER=$(/sbin/ldconfig -p | grep libschroedinger-1.0\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
SPEEX=$(/sbin/ldconfig -p | grep libspeex\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
XVID=$(/sbin/ldconfig -p | grep libxvidcore\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
BLURAY=$(/sbin/ldconfig -p | grep libbluray\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
ASS=$(/sbin/ldconfig -p | grep libass\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
OPENAL=$(/sbin/ldconfig -p | grep libopenal\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
IEC61883=$(/sbin/ldconfig -p | grep libiec61883\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
ILBC=$(/sbin/ldconfig -p | grep libilbc\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
MODPLUG=$(/sbin/ldconfig -p | grep libmodplug\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
OPUS=$(/sbin/ldconfig -p | grep libopus\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
TWOLAME=$(/sbin/ldconfig -p | grep libtwolame\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
#TODO LADSPA ladspa
#TODO FLITE libflite
VIDSTAB=$(/sbin/ldconfig -p | grep libvidstab\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
X265=$(/sbin/ldconfig -p | grep libx265\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
ZVBI=$(/sbin/ldconfig -p | grep libzvbi\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
#TODO OPENCV libopencv
#TODO GME libgme
SNAPPY=$(/sbin/ldconfig -p | grep libsnappy\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
WEBP=$(/sbin/ldconfig -p | grep libwebp\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
#TODO ZMQ libzmq
#TODO BS2B libbs2b
#TODO EBUR128 libebur128
RUBBERBAND=$(/sbin/ldconfig -p | grep librubberband\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
#TODO TESSERACT tesseract
#TODO NETCDF netcdf
CHROMAPRINT=$(/sbin/ldconfig -p | grep libchromaprint\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
OPENCORE=$(/sbin/ldconfig -p | grep libopencore-amrnb\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
FDK_AAC=$(/sbin/ldconfig -p | grep libfdk-aac\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
OPENSSL=$(/sbin/ldconfig -p | grep libssl\.so\  | grep /usr/lib${LIBDIRSUFFIX}/ | grep . >> /dev/null && echo yes)
#TODO DECKLINK decklink

# You can enable a lot of optional (not-autodetected) features by
# passing variables to the script (VAR=yes/no ./ffmpeg.SlackBuild).
# Unfortunately ffmpeg's configure doesn't support --enable-feature=yes
# syntax, so we have to do it the complicated way :/
# Additional optional (autodetected) dependencies are:
# - jack
# - libva
# - libvdpau
# - libX11
# - libxcb
# - sdl2
# - xz
# - zlib


drgibbon 06-02-2021 02:35 AM

Quote:

Originally Posted by Weber Kai (Post 6255829)
Sorry for necroposting, but I've made an improvement on this script to auto detect some libraries.
It's not complete, but maybe we could finish this list and send to the maintainer. The missing parts are marked with a #TODO comment

See this post for some other ideas (using pkg-config).


All times are GMT -5. The time now is 12:41 PM.