I'm trying to convert a series of image frames into a video with ffmpeg. For some of the image series, I am getting a strange yellow/green artifact and I'm not sure what setting in the conversion is causing the artifact or the best way to fix it.
The command I'm using for the conversion is
ffmpeg -f concat -safe 0 -i inputs.txt -c:v libx264 -pix_fmt yuv420p -r 10 -vf "scale=1024:-2" -movflags +faststart video.mp4
A reproducible example with three image files and an associated inputs.txt file indicating the files and associated durations can be downloaded here (Dropbox link)
Here's the resulting artifact
And the GIF of the output
What settings could be causing this artifact, and what can I do to try to reduce/remove the artifact from the video? This happens on both versions of ffmpeg that I have tried:
ffmpeg version 3.4.1 Copyright (c) 2000-2017 the FFmpeg developers
built with Apple LLVM version 9.0.0 (clang-900.0.39.2)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
ffmpeg version 3.1-tessus Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
Any insight is appreciated.
Your first input is grayscale 1-bit so I think that's throwing off the swscale chroma interpolation routine. Convert to RGBA before scaling.
-vf "format=rgba,scale=1024:-2"
Related
I am trying to stream to Facebook with ffmpeg. As of late 2019 the connection requirement is rtmps. Using the stock Debian Buster ffmpeg the TLS connection fails.
FFMPEG Version
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 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
Stream command
$ ffmpeg -i "rtmp://127.0.0.1/restream/STREAMKEY" -threads 1 -vcodec copy -acodec copy -f flv "rtmps://live-api-s.facebook.com:443/rtmp/FSTREAMKEY"
Error
[rtmps # 0x55d9e0e3ea40] Cannot open connection tls://live-api-s.facebook.com:443
rtmps://live-api-s.facebook.com:443/rtmp/FSTREAMKEY: Resource temporarily unavailable
Am I missing something?
I had to compile ffmpeg to get it working. I updated to ffmpeg 4.4 and made sure I was using gnutls and built in rtmp (not librtmp). Those configs are the same from my original test so it appears it is updating to ffmpeg 4.4 that fixed it.
Here's the compile setup that worked for me.
./configure --arch=amd64 --enable-gnutls --enable-libx264 --enable-gpl
I am trying to convert some MKV to MP4 with ffmpeg, and I keep getting the error below. Any thoughts?
I have installed ffmpeg and installed:
sudo apt install -y libopus-dev libmp3lame-dev libfdk-aac-dev libvpx-dev libx264-dev yasm libass-dev libtheora-dev libvorbis-dev mercurial cmake
Command I ran with output:
ffmpeg -i 'video.mkv' -codec copy 'video.mp4' -strict -2 -y
ffmpeg version 4.0.2-2 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 8 (Ubuntu 8.2.0-7ubuntu1)
configuration: --prefix=/usr --extra-version=2 --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-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-libopencv --enable-libx264 --enable-shared
[mp4 # 0x560e85326100] track 1: codec frame size is not set
[mp4 # 0x560e85326100] opus in MP4 support is experimental, add '-strict -2' if you want to use it.
Could not write header for output file #0 (incorrect codec parameters ?): Experimental feature
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Last message repeated 1 times
I also tried adding -strict -2 to no avail.
The order of options is important:
ffmpeg [global options] [input options] -i input [output options] output
Your example has trailing options which are often ignored.
In your case you are trying to mux Opus audio into the MP4 container, but outdated versions of ffmpeg consider this to be experimental. So you have to add -strict experimental or -strict -2. Use:
ffmpeg -y -i 'video.mkv' -codec copy -strict -2 'video.mp4'
Recent versions (FFmpeg 4.3 and newer & the git master branch) no longer need -strict -2 / -strict experimental to mux Opus into MP4:
ffmpeg -y -i 'video.mkv' -codec copy 'video.mp4'
If anyone encounters the no-audio problem after using -strict -2 option, you could try to use -c:a aac option after -c copy like this:
ffmpeg -y -i 'input.mkv' -c copy -c:a aac 'output.mp4'
I use my mac to compile the ffmpeg3.3 for Mac OS according to https://trac.ffmpeg.org/wiki/CompilationGuide/macOS.I tried the first(which through Homebrew) and third(which builds it yourself) method,the first method is ok.
But the third, compiling FFmpeg myself and Installing dependencies with Homebrew.I don't know the meaning of this sentence enter image description here
after this step:
./configure --prefix=/usr/local --enable-gpl --enable-nonfree --enable-libass \
--enable-libfdk-aac --enable-libfreetype --enable-libmp3lame \
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libopus --enable-libxvid \
--samples=fate-suite/
terminal show:
RROR: libmp3lame >= 3.98.3 not found
when I use locate libmp3lame.a,it is at '/usr/local/Cellar/lame/3.99.5/lib/libmp3lame.a'.
I also try --enable-libmp3lame --extra-ldflags=-L/usr/local/lib to solve,but it is no effect.
How to solve thisERROR: libmp3lame >= 3.98.3 not found
I am trying to build FFmpeg from source on CentOS 6.7 using below Config options:
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-iconv
--enable-gnutls --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc
--enable-libmodplug --enable-libopenjpeg --enable-librtmp
--enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtwolame
--enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc
--enable-libwavpack --enable-libwebp --enable-libxavs
--enable-decklink
--enable-zlib
Where can I find the documentation for the location of source code and compilation instruction for different Codec supported by FFmpeg?
Do I have to google for every option above to find the source code and compilation instruction on CentOS/RedHat Linux platform?
I get the following warning while trying to cross compile ffmpeg as below
$ ./configure --enable-gpl --enable-version3 --enable-libgsm --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libopencore_amrwb --enable-libopencore_amrnb --arch=x86 --enable-runtime-cpudetect --enable-static --disable-shared --enable-libxvid --enable-libx264 --target-os=mingw32 --enable-avisynth --enable-w32threads --cross-prefix=i686-mingw32- --cc='i686-mingw32-gcc' --enable-memalign-hack --disable-doc --enable-avfilter --disable-ffplay --disable-ffserver --disable-ffprobe
Configure ran fine but with the following warning
License: GPL version 3 or later
Creating config.mak and config.h...
libavutil/avconfig.h is unchanged
WARNING: i686-mingw32-pkg-config not found, library detection may fail.
How do I provide i686-mingw32-pkg-config to configure?
The missing library is located in the package mingw-w64-tools.
Install it with
sudo apt-get install mingw-w64-tools
I am using MinGw64. There it's this missing package:
pacman -S mingw-w64-x86_64-toolchain