How to enable avresample when build ffmpeg from source? - ffmpeg

I am cross compiling ffmpeg for aarch64-none-linux-gnu platform.
I build this ffmpeg, is for my OpenCV built (VideoIO module requires ffmpeg).
After specifing my build-and-installed ffmpeg directories, build OpenCV, the cmake stage summary complains:
-- Video I/O:
-- FFMPEG: NO
-- avcodec: YES (59.1.100)
-- avformat: YES (59.2.101)
-- avutil: YES (57.0.100)
-- swscale: YES (6.0.100)
-- avresample: NO
-- GStreamer: NO
-- v4l/v4l2: YES (linux/videodev2.h)
I would like to enable avresample for my ffmpeg build. However, I tried --enable-avresample but it says not-recognized.
How do I enable avresample during ffmpeg cross-compiling?

Seems that I should't find avresample lib.
Finally solved opencv videoio module build, by specifying rpath in toolchain.cmake
References:
https://github.com/opencv/opencv/issues/19906

Related

compile ffmpeg with x264

I need ffmpeg with hardware acceleration.
I am compiling ffmpeg following this guide:
https://gist.github.com/Brainiarc7/eb45d2e22afec7534f4a117d15fe6d89
x264 never works after compile.
I follow the official guide, adding "--enable-shared", compile again, still no luck.
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
Simply installing libx264-dev does not work as well.
$ ldd ~/bin/ffmpeg | grep x264 libx264.so.155 => not found
Does anyone know how to make x264 work?
Thanks.
Is there not any error message when you configure ffmpeg?
Or you can command ffmpeg, and show the configuration like
configuration: --enable-shared --enable-libx264 --enable-libx265 --enable-gpl --enable-nonfree
Maybe you can try install x264 from source.
You can use VCPKG to install ffmpeg with x264 support this project is avaliable on GIT.
Its a straight forward installation using VCPKG.
how to use vcpkg
https://www.youtube.com/watch?v=wRnjahwxZ8A&t=114s

How to --enable-protocol=SRT of ffmpeg?

all I am trying to --enable-protocol=SRT of ffmpeg. What I do as the following:
1.Check current configuration of ffmpeg which shows it doesn't suppport protocol of SRT.
2.So I trying to use msys64 to compile ffmpeg with --enable-protocol=SRT,and the command
$ ./configure --toolchain=msvc --arch=x64 --enable-yasm --enable-asm --enable-shared --enable-protocol=SRT
but the result as the following:
it's showing that the config is no use.Can you help me,thanks!
SRT is provided via an external library, so you'll need that library available for linking via pkg-config.
configure flags are --enable-protocol=libsrt --enable-libsrt. The former flag is only needed if you have disabled all components or protocols. Won't hurt to keep it, though.

FFmpeg compilation with encoder x264 not found Windows

FFmpeg compilation with encoder x264 not found Windows
I am trying to compile FFmpeg with several encoder (x264, NVENC). I already
managed to compile FFmpeg with MinGW and also x264 but I do not know how I can
tell where my compiled encoders are.
I have a folder where my FFmpeg sources are and in this directory I have my
compiled x264 encoder in a subfolder called x264.
OS: Windows 10
Compiler: MinGW
You need to install x264 to the correct place. When building x264, use this
or similar:
./configure --prefix=/usr/x86_64-w64-mingw32/sys-root/mingw
Example
Use the appropriate options when compiling FFmpeg, for example:
./configure --arch=x86_64 --target-os=mingw32 --cross-prefix=x86_64-w64-mingw32-
Example
This will allow FFmpeg to find your build tools and libraries.

Compile OpenCV 2.4.3-rc with gstreamer on Mac OS X 10.8

I am able to compile OpenCV on my Mac without gstreamer.
The problem is, gstreamer doesn't seem to be picked up by cmake, even though I have the following libraries installed via Macports:
ffmpeg-devel #20121205 multimedia/ffmpeg-devel
...
gst-ffmpeg #0.10.13 gnome/gst-ffmpeg
gst-plugins-bad #0.10.23 gnome/gst-plugins-bad
gst-plugins-base #0.10.36 gnome/gst-plugins-base
gst-plugins-gl #0.10.3 gnome/gst-plugins-gl
gst-plugins-good #0.10.31 gnome/gst-plugins-good
gst-plugins-math #0.1.0 science/gst-plugins-math
gstreamer #0.10.36 gnome/gstreamer
My cmake generate log looks like this (most omitted):
-- Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.1.3)
-- FFMPEG: YES
-- codec: YES (ver Unknown)
-- format: YES (ver Unknown)
-- util: YES (ver Unknown)
-- swscale: YES (ver Unknown)
-- gentoo-style: YES
-- OpenNI: NO
-- OpenNI PrimeSensor Modules: NO
-- PvAPI: NO
-- GigEVisionSDK: NO
-- QuickTime: NO
-- QTKit: YES
As you can see, gstreamer doesn't exist on the generated logs.
I am trying to use OpenCV for an Apexis IP Camera, which serves the video feed via HTTP. With Gstreamer, I am able to build on Ubuntu 12.10 Server edition---and the IP Camera works---but I would prefer to be able to have a GUI session on my Mac.
Any insights are welcome.
Thanks to #yiding, I found the issue.
OpenCV blacklisted gstreamer on the Mac for some reason. I was able to unblacklist it by simply changing the cmake configurations (CMakeLists.txt).
Change
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT APPLE AND NOT ANDROID) )
to
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON IF (UNIX AND NOT ANDROID) )
Then, I reinstalled both ffmpeg and gstreamer and all dependencies, and recompiled with make -j8. sudo make install. That was it.
Now I have IP Camera streaming to my Mac using OpenCV!
Edit: For context, this is OpenCV 2.4.3-rc and Mac OS X 10.8.

How can I get FFmpeg to locate installed libraries when --sysroot is pointing to another directory?

I've been going at this, literally for days. I'm trying to build FFmpeg with libmp3lame for use in an Android application. The build script sets a --sysroot flag that points to the Android NDK directory necessary to build these libraries in a way that Android can use them.
The problem comes when I add the flag to --enable-libmp3lame; I get ERROR: libmp3lame >= 3.98.3 not found during the build start up. I know that LAME, and it's libraries are installed, because I can just run ./configure --enable-libmp3lame manually and the configuration launches without a hitch, and shows that libmp3lame is enabled for this build. However, building like this will simply not work for what I need it for, since I need the Android NDK to do some work.
I've tracked the problem down to the fact that this build script is declaring the sysroot, and through some research, I've tried adding -Luser/include, -L/user/includeto the extra cflags, and ldflags (which I've read is the default search location for gcc). I've tried several other things as well, but I'm confident that someone out here can help with this specific problem. This entire build script is as follows:
Extra info:
Build OS: Ubuntu 11.10
FFmpeg Ver: Latest from git
LAME Ver: 3.9.x
Android NDK: r7
build.sh
#!/bin/bash
if [ "$NDK" = "" ]; then
echo NDK variable not set, assuming ${HOME}/android-ndk
export NDK=${HOME}/android-ndk
fi
SYSROOT=$NDK/platforms/android-3/arch-arm
# Expand the prebuilt/* path into the correct one
TOOLCHAIN=`echo $NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/*-x86`
export PATH=$TOOLCHAIN/bin:$PATH
rm -rf build/ffmpeg
mkdir -p build/ffmpeg
cd ffmpeg
# Don't build any neon version for now
for version in armv5te armv7a; do
DEST=../build/ffmpeg
FLAGS="--target-os=linux --cross-prefix=arm-linux-androideabi- --arch=arm"
FLAGS="$FLAGS --sysroot=$SYSROOT"
FLAGS="$FLAGS --soname-prefix=/data/data/net.smartnotes/lib/"
FLAGS="$FLAGS --enable-shared --disable-symver"
FLAGS="$FLAGS --enable-small --optimization-flags=-O2"
FLAGS="$FLAGS --disable-everything --enable-protocol=file"
FLAGS="$FLAGS --enable-libmp3lame --enable-encoder=nellymoser"
case "$version" in
neon)
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp -mfpu=neon"
EXTRA_LDFLAGS="-Wl,--fix-cortex-a8"
# Runtime choosing neon vs non-neon requires
# renamed files
ABI="armeabi-v7a"
;;
armv7a)
# I have tried many things here.
EXTRA_CFLAGS="-march=armv7-a -mfloat-abi=softfp"
EXTRA_LDFLAGS=""
ABI="armeabi-v7a"
;;
*)
# I have tried many things here.
EXTRA_CFLAGS="-Luser/include"
EXTRA_LDFLAGS=""
ABI="armeabi"
;;
esac
DEST="$DEST/$ABI"
FLAGS="$FLAGS --prefix=$DEST"
mkdir -p $DEST
echo $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" > $DEST/info.txt
./configure $FLAGS --extra-cflags="$EXTRA_CFLAGS" --extra-ldflags="$EXTRA_LDFLAGS" | tee $DEST/configuration.txt
[ $PIPESTATUS == 0 ] || exit 1
make clean
make -j4 || exit 1
make install || exit 1
done
Instead of changing the include paths, why don't you try copying all the libmp3lame files that were created by 'make install' to the relevant directory where the script will look for them. Insert ECHO statements to find out what exactly the PATH/CFLAGS/LDFLAGS are at the point where you get the error, and copy the files there so it does find them.
I saw you were using the project located at
http://bambuser.com/opensource
I had the same problem and resolved like this:
compile lame for android using https://github.com/intervigilium/liblame
this is a small diff between the original build.sh from "bambuser.com" and the one I used:
3c3,6
< export NDK=${HOME}/downloads/android-ndk # r8d
---
> if [ "$NDK" = "" ]; then
> echo NDK variable not set, assuming ${HOME}/android-ndk
> export NDK=${HOME}/android-ndk
> fi
15,16c18
< #for version in armv5te armv7a; do
< for version in armv7a; do
---
> for version in armv5te armv7a; do
24c26
< FLAGS="$FLAGS --disable-everything --enable-libmp3lame"
---
> FLAGS="$FLAGS --disable-everything"
from "intervigilium" project copy the folder liblame/jni/lame to PATH_TO_NDK/platforms/android-3/arch-arm/usr/include
from "intervigilium" project copy liblame/libs/armeabi-v7a/liblame.so to PATH_TO_NDK/platforms/android-3/arch-arm/usr/libs and RENAME it in libmp3lame.so.
finally run build.sh.
you should be fine:
install prefix ../build/ffmpeg/armeabi-v7a
source path /home/samuele/downloads/ffmpeg/ffmpeg-android/ffmpeg
C compiler arm-linux-androideabi-gcc
ARCH arm (generic)
big-endian no
runtime cpu detection no
ARMv5TE enabled yes
ARMv6 enabled yes
ARMv6T2 enabled yes
ARM VFP enabled yes
IWMMXT enabled no
NEON enabled no
debug symbols yes
strip symbols yes
optimizations small
static yes
shared yes
postprocessing support no
new filter support yes
network support yes
threading support pthreads
SDL support no
Sun medialib support no
AVISynth enabled no
frei0r enabled no
libdc1394 support no
libdirac enabled no
libfaac enabled no
libgsm enabled no
**libmp3lame enabled yes**
libnut enabled no
libopencore-amrnb support no
libopencore-amrwb support no
libopencv support no
libopenjpeg enabled no
librtmp enabled no
libschroedinger enabled no
libspeex enabled no
libtheora enabled no
libvorbis enabled no
libvpx enabled no
libx264 enabled no
libxavs enabled no
libxvid enabled no
zlib enabled no
bzlib enabled no
Enabled decoders:
Enabled encoders:
mpeg2video nellymoser
Enabled hwaccels:
Enabled parsers:
Enabled demuxers:
Enabled muxers:
Enabled protocols:
Enabled filters:
buffer
Enabled bsfs:
Enabled indevs:
Enabled outdevs:
License: LGPL version 2.1 or later
Creating config.mak and config.h...
libavutil/avconfig.h is unchanged
Be aware, I still need to test the resulting FFmpeg build.
To say the truth, now I have to learn how to use it in my App... ;)
EDIT: I tried removing --disable-everything and it builds OK the same, with a lot of encoders, decoders etc, but increasing to ~40MB for the build dir.

Resources