ffmpeg over https fails - https

If I feed url with http, such as this:
ffmpeg -i http://vjs.zencdn.net/v/oceans.mp4 videojs.mp4
It works perfectly. However, when I feed url with https, such as this:
ffmpeg -i https://s3-us-west-2.amazonaws.com/bucket/check.mp4 video.mp4
This gives me an error:
https protocol not found, recompile FFmpeg with openssl, gnutls, or
securetransport enabled.
https://s3-us-west-2.amazonaws.com/bucket/check.mp4: Protocol not
found
What should I do to enable https?

The answer can be found in the error message.
Recompile FFmpeg with openssl, ...
So, recompile ffmpeg with the required dependencies.
You can read more about the process here, and during the ./configure step, just add --enable-openssl.
Make sure that you have these packages installed: build-essential, openssl, libssl-dev
In the comments, you said that you're using Ubuntu, so you can easily install these packages using apt-get install.
After installation, you can execute ffmpeg -protocols to make sure that you have https listed there.
By the way, your video (on AWS), can be accessed via the http protocol.

The correct answer to this question as of Sep 2015 is
./configure --enable-openssl and if you have ubuntu then make sure you sudo apt-get install libssl-dev.

Add --enable-openssl to the ./configure line.
The --with-openssl does not work presently.
This is my whole line:
$ ./configure --prefix="$HOME/scr1/ffmpeg_build" --extra-cflags="-
I$HOME/scr1/ffmpeg_build/include" --extra-ldflags="-
L$HOME/scr1/ffmpeg_build/lib" --bindir="$HOME/scr1/bin" --pkg-config-
flags="--static" --enable-gpl --enable-nonfree --enable-libfdk-aac --
enable-libfreetype --enable-libmp3lame --enable-libopus --enable-
libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-openssl

Related

Can someone help me to install the netflix's VMAF library in Ubuntu

First of all, I have to say that I am not very experienced in ubuntu.
I would like to install this library to use with FFMPEG.
I am following these steps, but I can manage to install it well...
https://github.com/Netflix/vmaf/blob/master/resource/doc/VMAF_Python_library.md
Could someone tell me what are the exact steps (commands) that I have to follow.
On the other hand, someone knows if there are other metrics that can ffmpeg calculates directly (apart from PSNR or SSIM)?
Many thanks
The link you provided is just to install the VMAF python library. To use VMAF with ffmpeg you need to install libvmaf first and then compile ffmpeg with libvmaf filter enabled. However, as one user suggests, you can use already compiled ffmpeg packages https://www.johnvansickle.com/ffmpeg/
Moving to your questions. These are the step by step I followed to install FFmpeg+VMAF over an Ubuntu 20.04:
Installing dependencies:
apt update -qq
apt install pkg-config -y
apt-get install --no-install-recommends\
ninja-build \
python3 \
python3-pip \
python3-setuptools \
python3-wheel \
ninja-build \
wget \
doxygen \
autoconf \
automake \
cmake \
g++ \
gcc \
pkg-config \
make \
nasm \
yasm -y
pip3 install --user meson
Installing libvmaf:
export PATH="$PATH:$HOME/.local/bin"
wget https://github.com/Netflix/vmaf/archive/v1.5.1.tar.gz
tar -xzf v1.5.1.tar.gz
cd vmaf-1.5.1/libvmaf/
meson build --buildtype release
ninja -vC build
ninja -vC build test
ninja -vC build install
Installing ffmpeg:
wget https://ffmpeg.org/releases/ffmpeg-4.2.2.tar.bz2 && tar xjf ffmpeg-4.2.2.tar.bz2
cd ffmpeg-4.2.2
./configure --enable-libvmaf --enable-version3
make
make install
Sometimes, depending on your OS, you also need to setup your $PATH, $LD_LIBRARY_PATH, $PKG_CONFIG_PATH.
Download an already compiled ffmpeg from johnvansickle.com. It supports the libvmaf filter. For instructions on how to install it see the FAQ.
Here is a detailed guide on OTTVerse for compiling and installing FFmpeg with VMAF support on Ubuntu 18.04. It shouldn't take you more than a few minutes.
Be aware, that VMAF's libvmaf library will soon be dropped and replaced with a new library called libvmaf_rc. Hopefully, its compilation with FFmpeg will remain smooth as well.
sudo apt-get install nasm doxygen ninja-build meson
Download VMAF source from here and extract it.
cd into the vmaf source code folder.
cd into the libvmaf folder.
meson build --buildtype release
ninja -vC build
ninja -vC build install
Download ffmpeg source code from here.
Extract the source code and cd into the ffmpeg source code folder.
./configure --enable-gpl --enable-libx264 --enable-libx265 --enable-nonfree --enable-libvmaf --enable-version3
sudo make
sudo make install
Add the following export line to ~/.bashrc or ~/.bash_profile: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/x86_64-linux-gnu/.
Run source ~/.bashrc or source ~/.bash_profile.
Attribution.

compiling ffmpeg with nvidia/cuda failed loading nvcuvid

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!

FFMPEG Install/enable 'libfdk_aac' after installed FFMPEG via PPA

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.

Installing libmp3lame to work with FFMPEG on raspberry pi

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

how to install libx265 for ffmpeg build on centos 7

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

Resources