I have compiled ffmpeg for my android app to have only essential components. I have enabled following components.
--disable-everything \
--enable-demuxer=concat \
--enable-muxer=concat,mp4 \
--enable-protocol=file,subfile \
--enable-filter=amix,adelay,volume \
But when I am trying to concatenate mp4 files using following command
ffmpeg -y -f concat -safe 0 -i files.txt -c copy output.mp4
I am receiving following error
[concat # 0x7bd7d14400] Impossible to open 'file1.mp4'
files.txt: Invalid data found when processing input
Here is complete ffmpeg output for reference
Command execution failed with rc=1 and the output below.
Command execution failed ffmpeg version v4.3-dev-2955 Copyright (c) 2000-2020 the FFmpeg developers
built with Android (6454773 based on r365631c2) clang version 9.0.8 (https://android.googlesource.com/toolchain/llvm-project 98c855489587874b2a325e7a516b99d838599c6f) (based on LLVM 9.0.8svn)
configuration: --cross-prefix=aarch64-linux-android- --sysroot=/home/amit/Android/Sdk/ndk/21.3.6528147/toolchains/llvm/prebuilt/linux-x86_64/sysroot --prefix=/home/amit/work/mobile-ffmpeg/prebuilt/android-arm64/ffmpeg --pkg-config=/usr/bin/pkg-config --enable-version3 --arch=aarch64 --cpu=armv8-a --cc=aarch64-linux-android21-clang --cxx=aarch64-linux-android21-clang++ --target-os=android --enable-neon --enable-asm --enable-inline-asm --enable-cross-compile --enable-pic --enable-jni --enable-optimizations --enable-swscale --enable-shared --enable-v4l2-m2m --disable-outdev=fbdev --disable-indev=fbdev --disable-openssl --disable-xmm-clobber-test --enable-debug --disable-neon-clobber-test --disable-programs --disable-postproc --disable-doc --disable-htmlpages --disable-manpages --disable-podpages --disable-txtpages --disable-static --disable-sndio --disable-schannel --disable-securetransport --disable-xlib --disable-cuda --disable-cuvid --disable-nvenc --disable-vaapi --disable-vdpau --disable-videotoolbox --d libavutil 56. 42.102 / 56. 42.102
libavcodec 58. 78.102 / 58. 78.102
libavformat 58. 42.100 / 58. 42.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.101 / 7. 77.101
libswscale 5. 6.101 / 5. 6.101
libswresample 3. 6.100 / 3. 6.100
[concat # 0x7bd7d14400] Impossible to open 'absolute path here/1.mp4'
absolute path here/files.txt: Invalid data found when processing input
Command execution 7
Exact same command works when I compile complete ffmpeg. What components I might be missing for getting this error? Help is appreciated.
Related
I am running a code that runs ffmpeg and breaks down because of libx264 with the following error:
Unknown encoder 'libx264'
File "/anaconda3/lib/python3.6/site-packages/imageio/plugins/ffmpeg.py", line 661, in _append_data
self._proc.stdin.write(im.tostring())
BrokenPipeError: [Errno 32] Broken pipe
So I upgrade ffmpeg to the latest and see that libx264 is installed as shown: Using Brew on MacOs
==> Pouring x264-r3027_1.high_sierra.bottle.tar.gz
/usr/local/Cellar/x264/r3027_1: 11 files, 5.5MB
But when I do
ffmpeg encoders | grep 264
I get --disable-libx264 on the last line:
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
built with clang version 4.0.1 (tags/RELEASE_401/final)
configuration: --prefix=/anaconda3 --cc=x86_64-apple-darwin13.4.0-clang --disable-doc --enable-shared --enable-static
--enable-zlib --enable-pic --enable-gpl
--enable-version3 --disable-nonfree --enable-hardcoded-tables --enable-avresample --enable-libfreetype --disable-openssl --disable-gnutls --enable-libvpx --enable-pthreads --enable-libopus --enable-postproc --disable-libx264
Seems like I have to change --disable-libx264 to --enable-libx264 but not sure where and how it is done. Could not find it under /anaconda3 since: --prefix=/anaconda3
If you install x264 and ffmpeg using Conda, you need today (might change in the future) to specify the versions to install. For instance, this combination works fine for me:
$ conda install -c conda-forge x264=='1!161.3030' ffmpeg=4.3.2
If I now run the command ffmpeg, I can see that I have the flag --enable-libx264. The full output is:
$ ffmpeg
ffmpeg version 4.3.2 Copyright (c) 2000-2021 the FFmpeg developers
built with clang version 11.1.0
configuration: --prefix=/Users/vincent/opt/anaconda3/envs/test2 --cc=x86_64-apple-darwin13.4.0-clang --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-gpl --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-libx264 --enable-pic --enable-pthreads --enable-shared --enable-static --enable-version3 --enable-zlib --enable-libmp3lame --pkg-config=/Users/runner/miniforge3/conda-bld/ffmpeg_1627813741069/_build_env/bin/pkg-config
libavutil 56. 51.100 / 56. 51.100
libavcodec 58. 91.100 / 58. 91.100
libavformat 58. 45.100 / 58. 45.100
libavdevice 58. 10.100 / 58. 10.100
libavfilter 7. 85.100 / 7. 85.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 7.100 / 5. 7.100
libswresample 3. 7.100 / 3. 7.100
libpostproc 55. 7.100 / 55. 7.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
I guess the problem comes from the version of ffmpeg installed by default today (when this post was written). Indeed, if in a newly created virtual environment I install x264 and ffmpeg without specifying the versions to use, I get x264 1!161.3030 and ffmpeg 4.0. Using a newer version of ffmpeg seems to solve the problem.
The idea is to use compatible package versions. To create the installation line I propose above, I simply specified the latest versions available on conda-forge of both x264 and ffmpeg package. To get the list of available Conda packages for x264 and ffmpeg, simply use:
conda search -c conda-forge -f x264
conda search -c conda-forge -f ffmpeg
I removed Brew and instead ran conda install ffmpeg and it is enabled there.
I have a UVC camera which supports h264 protocol. we can see the h264 listed below when we list all formats supported.
msm8909:/data # ./ffmpeg -f v4l2 -list_formats all -i /dev/video1
ffmpeg version N-53546-g5eb4405fc5-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libxml2 --enable-libxvid --enable-libzimg
libavutil 56. 56.100 / 56. 56.100
libavcodec 58. 97.100 / 58. 97.100
libavformat 58. 49.100 / 58. 49.100
libavdevice 58. 11.101 / 58. 11.101
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
[video4linux2,v4l2 # 0x4649140] Compressed: h264 : H.264 : 1920x1080 1280x720 640x480 320x240
[video4linux2,v4l2 # 0x4649140] Compressed: mjpeg : MJPEG : 1920x1080 1280x720 640x480 320x240
I am running the ffmpeg cmd to record UVC camera video to local device.
ffmpeg -f v4l2 -input_format h264 -framerate 30 -video_size 1280*720 -i /dev/video1 -c copy /sdcard/Movies/output.mkv
The video size is way bigger than running the command below:
ffmpeg -f v4l2 -input_format mjpeg -framerate 30 -video_size 1280*720 -i /dev/video1 -c:v libx264 -vf format=yuv420p /sdcard/Movies/output.mp4
I assume the camera already supports h264 protocol. Thus I don't need to re-encode to 264 formats. However, the video size does not look like an H264 encoded video.
Not all H.264 encoders are equal
x264 is a very efficient H.264 encoder meaning it provides a higher quality at a lower bitrate.
Your camera has a comparatively inefficient H.264 encoder. It is optimized for speed on a small piece of hardware with limited resources. So it is unable to do the fancy stuff that x264 can. Result is a much higher bitrate for a similar quality.
How to using FFmpeg download a video file with https.
I have using FFmpeg on Android to download a video file with https. But can't download. because of FFmpeg doesn't support https.
ffmpeg -i https://example.com/video.mp4 -c copy b.mp4
Logs
ffmpeg version 3.2.9 Copyright (c) 2000-2017 the FFmpeg developers configuration:
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
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
https protocol not found, recompile FFmpeg with openssl, gnutls or securetransport enabled.
I am using ffmpeg lib:
ffmpeg version git-2017-09-16-08ec828
Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --enable-pic --enable-shared --extra-libs=-ldl --enable-gpl --enable-libass --enable-libfdk-aac --enable-libmp3lame --enable-libopus --enable-postproc --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
libavutil 55. 75.100 / 55. 75.100
libavcodec 57.106.101 / 57.106.101
libavformat 57. 82.100 / 57. 82.100
libavdevice 57. 8.101 / 57. 8.101
libavfilter 6.105.100 / 6.105.100
libswscale 4. 7.103 / 4. 7.103
libswresample 2. 8.100 / 2. 8.100
libpostproc 54. 6.100 / 54. 6.100
Hyper fast Audio and Video encoder
I am trying to write an RTSP server using the above version of ffmpeg libs. I have tried a large variety of approachess with no success. Has anyone already written such code with this ffmpeg version or does anyone know of such code? Or, do I need to change versions? Any suggestions or answers are welcome.
I'm trying to install pHash , but when I execute ./configure this message is returned:
...
*** Configuring video Hash ***
checking whether FFmpeg is present... checking for avcodec_alloc_frame in -lavcodec... no
configure: error:
*** libavcodec not found.
You need FFmpeg. Get it at <http://ffmpeg.org/>
But FFMPEG is correctly installed, in fact executing ffmpeg it returns:
ffmpeg version 3.0.2 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
configuration:
libavutil 55. 17.103 / 55. 17.103
libavcodec 57. 24.102 / 57. 24.102
libavformat 57. 25.100 / 57. 25.100
libavdevice 57. 0.101 / 57. 0.101
libavfilter 6. 31.100 / 6. 31.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.101 / 2. 0.101
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
Use -h to get full help or, even better, run 'man ffmpeg'
Why this happens?
Unfortunately, I didn't solve the problem on Ubuntu 15. I installed Ubuntu 16 (which include FFMPEG again) and everything went fine.