I'm using ffmpeg, and I need it to have libfaac, and I understand the only way to make that happen is to compile it from source. I read a bunch of tutorials, and installed mingw, but I can't run the commands ./configure or make. Is there something I'm missing or another way to do this?
I fixed my problem. I gave up on libfaac, and instead just added the following code:
audio_codec: "aac", custom: "-strict experimental -q:v 5 -preset slow -g 30" to the arguments of encode_video for it to not to try to use libfaac.
Also, I had the wrong MinGW. I had the git version, but I needed MSys to run commands such as ./configure and make and make install.
Related
I'm trying to compile FFMPEG with x265 on Win10. I am using the latest full MinGW build from xhmikosr found at:
http://xhmikosr.1f0.de/tools/msys/
FFMEPG without x265 compiles without problems and compiling x265 standalone works without problems too.
However when i --enable-libx265 in ffmpeg i get the following error:
ERROR: x265 not found using pkg-config
and this from the config.log:
require_pkg_config libx265 x265 x265.h x265_api_get
check_pkg_config libx265 x265 x265.h x265_api_get
test_pkg_config libx265 x265 x265.h x265_api_get
false --exists --print-errors x265
ERROR: x265 not found using pkg-config
my config paths seem to be all set correct.
$ echo $PKG_CONFIG_PATH
C:\MYSYS\local\x86_64-w64-mingw32\lib\pkgconfig
and when i look for the libraries x265 is there:
$ pkg-config --list-all
...
x265 x265 - H.265/HEVC video encoder
...
and here the debug log:
$ pkg-config --debug
...
File 'x265.pc' appears to be a .pc file
Will find package 'x265' in file 'C:/MYSYS/local/x86_64-w64-mingw32/lib/pkgconfig\x265.pc'
...
Why does pkg-config still not find the x265 libraries when i try to compile?
After much trial and error, I believe I have found a solution and the root cause under Ubuntu 16.04. This solution may work for other variants of Ubuntu as well.
If you run into the Package Config error described in this thread, try installing the default (repository based) libraries first, and then install your custom version with your ffmpeg build script.
Run these commands as needed prior to running your custom script to compile ffmpeg and your dependent libraries (e.g. x265) from source:
apt install -y libx265-dev
If another library fails, try the same technique and then run your script again to see if it works. For example, some people report compiling ffmpeg from source complains about gnutls. The solution for Ubuntu 16.04 is to first install it via apt and then run your script.
apt install -y gnutls-dev
If you're hung up at compiling the x264 libraries (for H.264 support), simply run this before running your script:
apt install -y libx264-dev
As long as your new script overwrites the old files and does not purge them, this method will work.
Background/History
The source of the problem dates back to at least 2017, and despite numerous claims it does not appear to have actually been fixed. One can find references in various forums and websites of frustrated users unable to get their compile to work correctly regardless of the version of the ffmpeg build, such as here.
It's a difficult problem to solve partly because the VLC Developer instructions for installing x265 library support are broken. Furthermore, the archive of information explaining this problem and how to solve it is no longer available, due to BitBucket's decision to sunset Mercurial support earlier this year. Most archived forum posts explaining the problem and how to solve it are gone. There are a few clues still to be found on GitHub, but they are incomplete snippets of information on the topic; none offer a complete perspective.
Installing ffmpeg from scratch is bound to cause headaches for nearly anyone. NONE of the scripts I found online (dozens) worked correctly as described. Most of the problems with them are incorrect/outdated links. Solutions with GitHub links appear to be the most consistently reliable. Others should be avoided (e.g. hg, which is no longer supported as mentioned above).
In my experience, I configure ffmpeg with x265 in CentOS, it also got error message as
ERROR: x265 not found using pkg-config
After I try this:
$ export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
I configure and compile ffmpeg successfully with x265. You can try this.
x265.pc sometimes doesn't located in "/usr/local/lib/pkgconfig" and instead it is located in "/usr/lib/arm-linux-gnueabihf/pkgconfig/", so, you needs to include it in the export also .
export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig/:/usr/local/lib/pkgconfig/
solution:
add --extra-libs=-lpthread
https://bitbucket.org/multicoreware/x265/issues/371/x265-not-found-using-pkg-config
It's need more library. Please install "libnuma".
I follow to guide from wiki x265
git clone https://bitbucket.org/multicoreware/x265_git
cd x265_git/build/linux
./make-Makefiles.bash
make
And works fine in Red Hat Enterprise Linux 8
You can try
--pkg-config="pkg-config --static"
I believe I found the solution. The issue appears to be that current guide is pulling from master (which may be what a developer wants) but in my case
I actually needed stable. Instead of using the provided command in the current guide:
sudo apt-get install libnuma-dev && \
cd ~/ffmpeg_sources && \
git -C x265_git pull 2> /dev/null || git clone --depth 1 https://bitbucket.org/multicoreware/x265_git && \
cd x265_git/build/linux && \
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off ../../source && \
PATH="$HOME/bin:$PATH" make && \
make install
Use this command:
sudo apt-get install libnuma-dev && \
cd ~/ffmpeg_sources && \
git -C x265_git pull 2> /dev/null || git clone --depth 1 https://bitbucket.org/multicoreware/x265_git -b stable && \
cd x265_git/build/linux && \
PATH="$HOME/bin:$PATH" cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED=off ../../source && \
PATH="$HOME/bin:$PATH" make && \
make install
I can't comment as I have too low reputation. I don't know what it's for :(
Anyway, I had the same problem and I had to do two of tricks mentioned above in solutions:
--extra-libs="-lpthread"
--pkg-config-flags="--static"
Add both of those switches and victory is yours.
I've also come across a case where the x265.pc is not generated, I know this wasn't the issue in original problem but thought worth mentioning.
This occurs if you don't have git installed, in my case I was building inside a container with pre-fetched sources on a corporate network.
This issue is documented at https://bitbucket.org/multicoreware/x265_git/issues/572/pc-file-is-not-generated
It can be worked around either by installing git or fudging it with something as simple as
touch git
chmod a+x git
export PATH="$PWD:PATH"
I am trying to get a live streaming device to work on a raspberry pi. I am running minibian. I roughly follow this guide without the cross compiling.
My problem is probably with the compilation of ffmpeg. I downloaded and compiled both x265 and fdk-aac and compiled them. Next I have to compile ffmpeg, which is in the same folder as the other ones, but the compiler can't find any of the dependencies. x265 also cannot be found using pkg-config, which is the error it produces when I try to run ./configure.
I directly cloned everything into one folder, so that in a folder called ffmpeg_files there are three other folders: ffmpeg, fdk-aac and x265. How do I properly include these dependencies so I can enable them when I compile ffmpeg?
Thank you!
Okay, so this is not really an answer to this question.
After a long time of trial and error and a lot of help by the great user Mulvya I decided not to use Minibian, but Raspbian Stretch Lite. There, everything worked very smoothly. Just remember to run sudo ldconfig after installing the codec libraries like x264/x265 or fdk-aac.
Thanks everybody for your help!
I was stuck getting the same error, and this solution worked for me:
First check if pkg-config can find x265:
$ pkg-config --modversion x265
Package x265 was not found in the pkg-config search path.
Perhaps you should add the directory containing x265.pc to the PKG_CONFIG_PATH environment variable:
No package 'x265' found.
$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
$ pkg-config --modversion x265
0.0
Very much an amateur here, with perhaps even less grasp on the workings of stackoverflow than software compilation, but I hope some positive feedback might help someone else, just as Mulyva has helped me.
After trying and failing to compile ffmpeg on Ubuntu 17.10 (and 16.04 within a virtual machine) with the same error message as the OP and countless others. Compiling x265 rather than using the version in the Ubuntu repos, and using Mulyva's advice in the later chat - "Try with ./configure --enable-static --enable-nonfree --enable-gpl --enable-libx265 --extra-libs=-lm --extra-libs=-lstdc++ --enable-libfdk_aac --extra-libs=-lm --extra-libs=-lstdc++" - has it working for me. Thank you!
Apologies if posting here is embarrasingly out of place...
I am planning to create a new app for personal use on my Mac that uses FFMPEG library, to store a feed from a RTSP IP camera.
Following this official installation procedure from FFMPEG I have manage to successfully achieve the following 2 steps:
To get ffmpeg for OS X, you first have to install ​Homebrew. If you don't want to use Homebrew, see the section below.
ruby -e "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then:
- brew install automake fdk-aac git lame libass libtool libvorbis
libvpx \ opus sdl shtool texi2html theora wget x264 xvid yasm
Question:
My question here because I am confused, is how to import a library into Xcode so I can use it in the application I am about to build for my Mac. I can see plenty of GitHub projects related to FFMPEG with IOS/Android, but none for OSX.
All the FFMPEG commands under terminal are working fine, such as converting a video etc.
If you look in /usr/local/Cellar/ffmpeg you will find the actual ffmpeg package and everything in homebrew is just symbolic links to that. For example:
/usr/local/bin/ffmpeg -> ../Cellar/ffmpeg/3.0.2/bin/ffmpeg
Now, if you stay in that directory and do this, you will find all the pkgconfig configuration settings for the constituent parts of ffmpeg:
find . -name \*.pc
./lib/pkgconfig/libavcodec.pc
./lib/pkgconfig/libavdevice.pc
./lib/pkgconfig/libavfilter.pc
./lib/pkgconfig/libavformat.pc
./lib/pkgconfig/libavresample.pc
./lib/pkgconfig/libavutil.pc
./lib/pkgconfig/libpostproc.pc
./lib/pkgconfig/libswresample.pc
./lib/pkgconfig/libswscale.pc
That means you can now find the include path and library paths that you need to put in the Xcode settings. So, for example, if you want the includes for libavutil, you can do:
pkg-config --cflags libavutil
and it will tell you:
-I/usr/local/Cellar/ffmpeg/3.0.2/include
If you want the library settings for libavfilter, you can do:
pkg-config --libs libavfilter
and it will tell you
-L/usr/local/Cellar/ffmpeg/3.0.2/lib -lavfilter
So that is how you get the settings for the compiler/linker. Then you need to put them into Xcode, and I have described that here - look at the bit with the yellow, red and blue boxes.
Hope that helps. Oh, you need to do:
brew install pkg-config
first to get the pkgconfig binary.
In general, you need to configure the Xcode target build settings to add /usr/local/include to the Header Search Path.
Then your #include <ffmpeg.h> (or whatever it's called) will start to work.
Then for linking to libffmpeg.a (or whatever it's called), you can do one of two things:
Add the file to the Additional Libraries and Frameworks of the build settings (selecting it via a file open dialog).
Add /usr/local/lib to the Library Search Paths and -lffmpeg to the Other Linker Flags.
(1. is better if you ask me).
I use Macports, so for me the paths are /opt/local/{include,lib} however with Homebrew there might be an additional level of directory (like /usr/local/ffmpeg/{include,lib}, but you should be able to work that out yourself.
I won't go into details of how to actually use FFMPEG as that is way too involved (and I know nothing about it).
Although this does not answer the specific question here ("how to import such and such libraries"),
for anyone googling here, these days to use FFmpeg in OSX you just
Use the famous import script of Kewlbear
which you can easily find here
https://github.com/kewlbear/FFmpeg-iOS-build-script
and which does everything.
It is a huge amount of non-trivial work maintaining such a build script, and fortunately there's someone who does that work on an ongoing basis.
I recently installed ffmpeg version 0.8.5-4:0.8.5 on my Ubuntu Linux box.
When I execute "ffprobe -show_frames http://test.com/test.mp4" I get the following error:
Unrecognized option 'show_frames'
I have tried installed all sorts of ffmpeg dependent packages to fix this without any success.
Can someone help to resolve this error by telling me what I need to install exactly to fix this?
Thanks
You're using a crippled, fake version of "ffprobe" that originates from libav, not FFmpeg:
Ubuntu switched from FFmpeg to libav because the Debian/Ubuntu ffmpeg package maintainer is a libav developer. The intentional usage of the names "ffmpeg" and "ffprobe" for something not from FFmpeg was disappointing, and is misguiding to users and misrepresents the work of the FFmpeg developers. Also see Who can tell me the difference and relation between ffmpeg, libav, and avconv?
This bizarro "ffprobe" does not have the -show_frames option. You have three options:
Compile ffmpeg and/or ffprobe
Use Jon Severinsson's FFmpeg PPA
Use a static build of ffmpeg
All three methods will provide a real, working ffprobe. Use the static build if you're lazy.
Uninstalled the current version of ffmpeg(This was a static build downloaded from the ffmpeg site: http://ffmpeg.gusari.org/static/32bit/
show_frames option was deprecated in this version.
Download and installed the latest version from:http://www.ffmpeg.org/releases/ffmpeg-1.1.3.tar.bz2
It seems textdraw.so for ffmpeg is missing. Where could I get one?
Check with the latest revision of ffmpeg. Try build it with default configuration command and verify.