Error in FFMpeg and png images (glob/libavformat) [closed] - ffmpeg

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm trying to use FFMpeg to produce an animation based on several png images
that don't follow a sequence number. With
the following command line
ffmpeg -f image2 -r 1 -pattern_type glob -i '*.png' -c:v libx264 mov.mp4
I obtain the following error
ffmpeg version N-53033-g56ba331 Copyright (c) 2000-2013 the FFmpeg developers
built on May 13 2013 22:18:29 with gcc 4.7.3 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enable-iconv --enable-libass --enable-libbluray
--enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc
--enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb
--enable-libopenjpeg --enable-libopus --enable-librtmp
--enable-libschroedinger --enable-libsoxr --enable-libspeex
--enable-libtheora --enable-libtwolame --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 31.100 / 52. 31.100
libavcodec 55. 9.100 / 55. 9.100
libavformat 55. 7.100 / 55. 7.100
libavdevice 55. 0.100 / 55. 0.100
libavfilter 3. 65.100 / 3. 65.100
libswscale 2. 3.100 / 2. 3.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 3.100 / 52. 3.100
[image2 # 0268b600] Pattern type 'glob' was selected but globbing is not
supported by this libavformat build
'*.png': Function not implemented
I am working on Windows 7.

As you
can see here,
for globbing to work you need glob.h.
From my quick looking MinGW-w64 does not contain this file, so you would need to use a Cygwin compiler. However this might not be desirable because the resulting FFmpeg would require the Cygwin dll.

Related

how to enable libx264 for ffmpeg on macos

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.

H.264 video file size from camera is much bigger than x264 output

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.

Unable to use concat in stripped down version of ffmpeg

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.

Laradock FFMpeg in php-fpm container

Followed the docs to install FFMpeg in laradock. Seems to work fine with the workspace, however following the instructions for php-fpm does not.
At first I thought it was permission thing however when I looked in the container it had not been installed. A manual install and everything works as it should (access binary from php).
Any ideas on how to get Laradock to provision the container with FFmpeg without hacking it each time?
Thanks!
To enable FFmpeg in php-fpm, enable it in your .env config file :
PHP_FPM_FFMPEG=true
After building with docker-compose build it will be installed within the php-fpm container. Docker-compose just executes apt-get -y install ffmpeg when building.
Verified with latest laradock (Nov'19)
$ docker-compose up -d php-fpm
$ docker-compose exec php-fpm bash
root#d12d797c08da:/var/www# ffmpeg
ffmpeg version 4.1.4-1~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
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'
root#d12d797c08da:/var/www#

rtsp server using ffmpeg c code

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.

Resources