I am using the moviepy module with python 3.2 on my RPi 2. It uses FFMPEG to read and write the video, so I installed FFMPEG using these instructions to the letter. Now when I run the program, it says that my video export failed because FFMPEG didn't find the libmp3lame codec that it needs. How do I got about installing the libmp3lame codec onto my RPi 2 (running Raspian Wheezy)?
I think I have to reinstall FFMPEG to install the codec.. how do I do that correctly?
First, install lame mp3 with
sudo apt-get install libmp3lame-dev
and then recompile/build ffmpeg including the --enable-libmp3lame flag
./configure <other-configure-options> --enable-libmp3lame
Related
I have used following command to install libvorbis and libvpx.
yum install libvpx
yum install libvorbis
Please help me to enable these modules. I'm using centos 7 server.
1. Remove the old ffmpeg
Uninstall the packages you installed from the link you followed. This should also remove the third-party repository you installed.
yum remove epel-release ffmpeg ffmpeg-devel
Remove the signing key you imported:
sudo rpm -e gpg-pubkey-85c6cd8a-4e060c35
sudo rm /etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
2. Get a new ffmpeg
Now you can get a more recent ffmpeg that has libvpx, libvorbis (and libopus). You have two options–download or compile:
If you want to download ffmpeg
For Linux and you can get it from johnvansickle.com/ffmpeg/.
curl -LO https://johnvansickle.com/ffmpeg/builds/ffmpeg-git-amd64-static.tar.xz
tar xvf ffmpeg-git-amd64-static.tar.xz
cd ffmpeg-git-201*
sudo cp {ffmpeg,ffprobe} /usr/local/bin
For Windows or macOS see FFmpeg Download.
If you want to compile ffmpeg
See FFmpeg Wiki: CentOS.
Consider using VP9 and Opus instead of outdated VP8 and Vorbis:
ffmpeg -i input -c:v libvpx-vp9 -c:a libopus output.webm
For more info see FFmpeg Wiki: VP9 & VP8.
I'm trying to use youtube-dl on a Macbook (using Mojave). It used to work flawlessly but recently I am seeing the following error:
youtube-dl -x --audio-format mp3 https://youtu.be/somevidR4hhU
[youtube] somevidR4hhU: Downloading webpage
[youtube] somevidR4hhU: Downloading video info webpage
[youtube] somevidR4hhU: Downloading js player vflWnjS_n
[download] Destination: somevidR4hhU.webm
[download] 100% of 4.60MiB in 00:04
[ffmpeg] Destination: somevidR4hhU.mp3
ERROR: audio conversion failed: Unknown encoder 'libmp3lame'
I've tried to reinstall youtube-dl and lame with:
brew reinstall youtube-dl lame
but it makes no difference. Any idea what the problem may be?
Thanks in advance!
Homebrew doesn't install the lame. Compile with libmp3lame:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure --enable-libmp3lame
make
make install
ffmpeg -version
That should fix it
The possible issue could be because of the broken symlink to ffmpeg. You could try below brew command if you have installed ffmpeg with brew.
brew link --overwrite ffmpeg
It fixed for me at least.
'libmp3lame' is an encoder for mp3 which is getting used by ffmpeg to convert to mp3.
Installing ffmpeg with this command solved the problem for me:
brew install --build-from-source ffmpeg
I am trying to compile an ffmpeg binary with support for using nvidia GPU's, I am running:
os: ubuntu 18.04
nvidia driver: nvidia-driver-390
cat /usr/local/cuda-9.0/version.txt => CUDA Version 9.0.176
gpu: 2x 1080ti
With the instructions shown on https://developer.nvidia.com/ffmpeg, being:
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
I first found the error ERROR: cuda requested, but not all dependencies are satisfied: ffnvcodec, which was solved with help from https://superuser.com/questions/1299064/error-cuvid-requested-but-not-all-dependencies-are-satisfied-cuda-ffnvcodec. Below is the summary (make and make install just gave a list of commands to run):
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers
sed 's###PREFIX###/usr/local#' ffnvcodec.pc.in > ffnvcodec.pc
sudo install -m 0755 -d '/usr/local/include/ffnvcodec'
sudo install -m 0644 include/ffnvcodec/*.h '/usr/local/include/ffnvcodec'
sudo install -m 0755 -d '/usr/local/lib/pkgconfig'
sudo install -m 0644 ffnvcodec.pc '/usr/local/lib/pkgconfig'
With that done, I removed the ffmpeg folder, recloned it and ran within the folder:
./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda-9.0/include --extra-ldflags=-L/usr/local/cuda-9.0/lib64
make -j 10
Note that the path /usr/local/cuda-9.0 does contain both the include and lib64 folders, and that this resulted in no errors, just deprecation warnings.
Now when running this particular ffmpeg binary, with absolute paths, using the flag -hwaccel cuvid results in:
~/Documents/ffmpeg-cuda/ffmpeg/ffmpeg -y -hwaccel cuvid -c:v h264_cuvid -vsync 0 -i ~/test.mp4 -vf "scale_npp=1920:1072" -vcodec h264_nvenc ~/out1.mp4 -vf scale_npp=1280:720 -vcodec h264_nvenc out2.mp4
Which, is exactly what they have on their website to test it, results in:
[h264_cuvid # 0x556348eb94c0] Cannot load cuvidGetDecodeStatus
[h264_cuvid # 0x556348eb94c0] Failed loading nvcuvid.
I have also prepended: PKG_CONFIG_PATH="/usr/local/lib/pkgconfig" before ./configure, but also did not make a difference.
What am I doing wrong? Is there something important I missed?
With the ffmpeg repo https://github.com/FFmpeg/nv-codec-headers, which is "FFmpeg version of headers required to interface with Nvidias codec APIs", I glanced over the fact that Linux needed a "396.24 or newer driver". And only CUDA toolkit 9.2 at least, supports this driver version. So, the order of commands I used I have forgotten, but was roughly like below in order to remove nvidia drivers and cuda software;
sudo apt remove cuda
sudo aot-get autoremove --purge cuda
cd /var
# Here I removed files like cuda-repo-9-0-local-xxx
cd /etc/apt/sources.list.d
# Here I removed files like cuda-9-0-xxx.list/save
Now using the GUI software & Updates, in the additional drivers tab, sometimes wouldnt let me change from 390 to 396, so I'm pretty sure I first changed to Nouveau display driver, restarted the computer, and then chose 396 NVIDIA driver (open source), restarted the computer again and then now using 396, a check with nvidia-smi showed 396.51.
I then went to https://developer.nvidia.com/cuda-downloads and downloaded the 9.2 Linux Ubuntu 17.04 .deb file and then:
wget https://developer.nvidia.com/compute/cuda/9.2/Prod2/local_installers/cuda-repo-ubuntu1710-9-2-local_9.2.148-1_amd64
mv cuda-repo-ubuntu1710-9-2-local_9.2.148-1_amd64 cuda-repo-ubuntu1710-9-2-local_9.2.148-1_amd64.deb
sudo dpkg -i --force-overwrite cuda-repo-ubuntu1710-9-2-local_9.2.148-1_amd64.deb
sudo apt-key add /var/cuda-repo-9-2-local/7fa2af80.pub
sudo apt-get update
sudo apt-get install cuda
Now with CudaToolKit 9.2 installed with nvidia-drvier version 396.51, re-doing the steps posted in my question, resulted in no errors when running ffmpeg with -hwaccel cuvid. Which by the way makes a MASSIVE difference!
I have linux MINT 17.3 Kernel 4.4.0-81 all update available. (For different reasons I can't move to newer version of ubuntu/mint)
I have installed FFMPEG via PPA (NOT from compiling the source):
sudo add-apt-repository ppa:jonathonf/ffmpeg-3 -y
sudo apt-get update
sudo apt-get install -y ffmpeg
Then I tried to install libfdk-aac with guide:
https://trac.ffmpeg.org/wiki/CompilationGuide/Quick/libfdk-aac
sudo apt-get install pkg-config autoconf automake libtool
git clone https://github.com/mstorsjo/fdk-aac.git
cd fdk-aac
./autogen.sh
./configure --enable-shared --enable-static
make
sudo make install
sudo ldconfig
But I'm still receive from FFMPEG: "unknown encoder 'libfdk_aac'"
How can I check if "libfdk_aac' is correctly installed and HOW CAN I ACTIVATE / ENABLE the 'libfdk_aac' on FFMPEG?
If is not possible in my situation, and if I'm obliged to remove all ffmpeg and follow this:
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
FFmpeg does not have a "plug-n-play" codec system. If you want to add another external codec you must compile FFmpeg.
Alternatively, you could find a static ffmpeg binary that includes your desired codecs, but this is not a likely option due to the non-free/GPL incompatible situation of the fdk-aac license.
Your best option if you want to use libfdk_aac is to follow the compile guide you linked to. You can even keep the ffmpeg you installed from that PPA because the guide does not interfere with any existing repository ffmpeg.
When I try to compile ffmpeg with libx265 (./configure --enable-gpl --enable-libx265), it is getting error as: (ERROR: x265 not found using pkg-config). How to install libx265 and get configure with ffmpeg.
There are two solutions to your problem.
A)
If there are no libx265 available on CentOS 7 then you'll have to build it yourself. It follows the pretty straightforward method of configure/make.
Using mercurial:
hg clone http://hg.videolan.org/x265
cd x265/build/linux
./make-Makefiles.bash
make -j6
make install
ldconfig
Then be sure to specify the path libx265 was installed to when building ffmpeg. With pkg-config: PKG_CONFIG_PATH="/usr/local/lib/pkgconfig".
B)
But it appears there are rpm entries for x265 on CentOS 7:
http://pkgs.org/centos-7/nux-dextop-x86_64/x265-devel-1.2-6.el7.nux.x86_64.rpm.html. If they are compatible on your system you should be able to simply install instead of building.
I wrote a script for Ubuntu recently, but I think it can be applied to CentOS. You need to comment off the Ubuntu apt-get in the script in order to get it running.
Also before you use it, please ensure that you have git and mercurial installed. My script pulls the latest copy of necessary libraries from either from git or mercurial.
https://github.com/tangingw/libx265_installer