Commands:
ffmpeg -framerate 0.5 -i %03d.png ffmpeg-framerate0.5.webm
and
ffmpeg -r 0.5 -i %03d.png ffmpeg-r0.5.webm
create a working .webm videos, just as expected. But
ffmpeg -framerate 0.5 -i %03d.png -vf minterpolate ffmpeg-framerate0.5-vfminterpolate.webm
and
ffmpeg -r 0.5 -i %03d.png -vf "minterpolate=fps=30:mi_mode=blend" ffmpeg-r0.5-vfminterpolatefps30mi_modeblend.webm
do not work, producing empty files and messages
Input #0, image2, from '%03d.png':
Duration: 00:00:12.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 1374x1980 [SAR 11811:11811 DAR 229:330], 0.50 fps, 0.50 tbr, 0.50 tbn
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x5644694f3800] v1.11.0
[libvpx-vp9 @ 0x5644694f3800] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, webm, to 'ffmpeg-framerate0.5-vfminterpolate.webm':
Metadata:
encoder : Lavf59.16.100
Stream #0:0: Video: vp9, yuva420p, 1374x1980 [SAR 1:1 DAR 229:330], q=2-31, 60 fps, 1k tbn
Metadata:
encoder : Lavc59.18.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
and
Input #0, image2, from '%03d.png':
Duration: 00:00:00.24, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 1374x1980 [SAR 11811:11811 DAR 229:330], 25 fps, 25 tbr, 25 tbn
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x55674fe6e140] v1.11.0
[libvpx-vp9 @ 0x55674fe6e140] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, webm, to 'ffmpeg-r0.5-vfminterpolatefps30mi_modeblend.webm':
Metadata:
encoder : Lavf59.16.100
Stream #0:0: Video: vp9, yuva420p, 1374x1980 [SAR 1:1 DAR 229:330], q=2-31, 30 fps, 1k tbn
Metadata:
encoder : Lavc59.18.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
What I want to do is use PNG image data to create a video running with each input frame lasting two seconds, and with motion interpolation or frame blending/blurring between frames, to create a slideshow with transitions between slides because I am learning ffmpeg for fun and to create videos from images to share online.
I tried a variety of different commands, and found that they sometimes work and sometimes don't, very inconsistently with different images, different browsers, different video players, and different video effects. The information I've found online has been contradictory and confusing.
I've tried importing all images to GIMP, then making them all the exact same resolution, and then exporting them ass as PNGs with identical settings so that all frames are the same file format. This has been insufficient to get this command to work consistently, even though I've had the same commands work with other input frames. The most frustrating thing is the empty output file with no error message, and that -ss and -t would be confusing to use, since the original input PNG image data has no timestamp-type information. using the -frames option didn't help. What am I doing wrong, and what are some good examples of creating slideshows from PNGs or JPGs with transition effects to WEBM, OGG, or MP4 using as simple commands as possible?
EDIT:
rosemary@xps-13-9370 ~/P/m/ffmpeg> ffmpeg -framerate 1 -pattern_type glob -i '*.png' -vf minterpolate ffmpeg--framerate-1--pattern_type-glob--i----png--vf-minterpolate.webm
ffmpeg version 5.0.1 Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 12 (GCC)
configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --docdir=/usr/share/doc/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection' --extra-ldflags='-Wl,-z,relro -Wl,--as-needed -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 ' --extra-cflags=' -I/usr/include/rav1e' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --enable-chromaprint --disable-crystalhd --enable-fontconfig --enable-frei0r --enable-gcrypt --enable-gnutls --enable-ladspa --enable-libaom --enable-libdav1d --enable-libass --enable-libbluray --enable-libbs2b --enable-libcdio --enable-libdrm --enable-libjack --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libilbc --enable-libmp3lame --enable-libmysofa --enable-nvenc --enable-openal --enable-opencl --enable-opengl --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librav1e --enable-librtmp --enable-librubberband --enable-libsmbclient --enable-version3 --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtesseract --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-version3 --enable-vapoursynth --enable-libvpx --enable-vulkan --enable-libglslang --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libxml2 --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-avfilter --enable-libmodplug --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-lto --enable-libmfx --enable-runtime-cpudetect
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100
Input #0, image2, from '*.png':
Duration: 00:00:06.00, start: 0.000000, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 1374x1980 [SAR 11811:11811 DAR 229:330], 1 fps, 1 tbr, 1 tbn
File 'ffmpeg--framerate-1--pattern_type-glob--i----png--vf-minterpolate.webm' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x55e2a4f71540] v1.11.0
[libvpx-vp9 @ 0x55e2a4f71540] Neither bitrate nor constrained quality specified, using default CRF of 32
Output #0, webm, to 'ffmpeg--framerate-1--pattern_type-glob--i----png--vf-minterpolate.webm':
Metadata:
encoder : Lavf59.16.100
Stream #0:0: Video: vp9, yuva420p, 1374x1980 [SAR 1:1 DAR 229:330], q=2-31, 60 fps, 1k tbn
Metadata:
encoder : Lavc59.18.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
frame= 0 fps=0.0 q=0.0 Lsize= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
rosemary@xps-13-9370 ~/P/m/ffmpeg> ll
total 6.2M
-rw-r--r--. 1 rosemary rosemary 1.7M Sep 26 19:51 001.png
-rw-r--r--. 1 rosemary rosemary 1.7M Sep 26 19:51 002.png
-rw-r--r--. 1 rosemary rosemary 1.1M Sep 26 19:52 003.png
-rw-r--r--. 1 rosemary rosemary 1.1M Sep 26 19:52 004.png
-rw-r--r--. 1 rosemary rosemary 416K Sep 26 19:56 005.png
-rw-r--r--. 1 rosemary rosemary 416K Sep 26 19:56 006.png
-rw-r--r--. 1 rosemary rosemary 506 Sep 28 17:02 ffmpeg-framerate0.5-vfminterpolate.webm
-rw-r--r--. 1 rosemary rosemary 506 Sep 28 17:07 ffmpeg--framerate-1--pattern_type-glob--i----png--vf-minterpolate.webm
rosemary@xps-13-9370 ~/P/m/ffmpeg> identify *
001.png PNG 1374x1980 1374x1980+0+0 8-bit sRGB 1.63795MiB 0.000u 0:00.002
002.png PNG 1374x1980 1374x1980+0+0 8-bit sRGB 1.63795MiB 0.000u 0:00.001
003.png PNG 1374x1980 1374x1980+0+0 8-bit sRGB 1.00419MiB 0.000u 0:00.001
004.png PNG 1374x1980 1374x1980+0+0 8-bit sRGB 1.00419MiB 0.000u 0:00.001
005.png PNG 1374x1980 1374x1980+0+0 8-bit sRGB 425251B 0.000u 0:00.000
006.png PNG 1374x1980 1374x1980+0+0 8-bit sRGB 425251B 0.000u 0:00.000
identify: delegate failed `'ffmpeg' -nostdin -v -1 -i '%i' -vframes %S -vcodec pam -an -f rawvideo -y '%u.pam' 2> '%u'' @ error/delegate.c/InvokeDelegate/1994.
rosemary@xps-13-9370 ~/P/m/ffmpeg [1]> file *
001.png: PNG image data, 1374 x 1980, 8-bit/color RGBA, non-interlaced
002.png: PNG image data, 1374 x 1980, 8-bit/color RGBA, non-interlaced
003.png: PNG image data, 1374 x 1980, 8-bit/color RGB, non-interlaced
004.png: PNG image data, 1374 x 1980, 8-bit/color RGB, non-interlaced
005.png: PNG image data, 1374 x 1980, 8-bit/color RGBA, non-interlaced
006.png: PNG image data, 1374 x 1980, 8-bit/color RGBA, non-interlaced
ffmpeg--framerate-1--pattern_type-glob--i----png--vf-minterpolate.webm: WebM
ffmpeg-framerate0.5-vfminterpolate.webm: WebM
-
1Which ffmpeg version are you using? I could not reproduce your problem, and got a non-empty output with your commands.PierU– PierU2022年09月27日 06:43:39 +00:00Commented Sep 27, 2022 at 6:43
-
My problem appears to be specific to these PNG files, somehowSage– Sage2022年09月29日 00:08:22 +00:00Commented Sep 29, 2022 at 0:08
-
As a matter of fact I used JPG files as input, but I would be surprised if ffmpeg was not able to properly decode PNG files...PierU– PierU2022年09月29日 06:37:45 +00:00Commented Sep 29, 2022 at 6:37
-
It's more like these specific PNG files. I wonder...Sage– Sage2022年10月05日 23:48:42 +00:00Commented Oct 5, 2022 at 23:48
1 Answer 1
The Problem:
It was broken because some files were PNG image data, 1374 x 1980, 8-bit/color RGBA, non-interlaced
while others were PNG image data, 1374 x 1980, 8-bit/color RGB, non-interlaced. You can tell by looking at the output of file * in my most recent edit to the question, at the very bottom of the question
The solution:
I simply opened all RGBA files in GIMP, removed transparency, and exported them all to RGB. Always be sure to check all your files are exactly the same format using file and pay very careful attention to the output.
P.S.
I sure do wish that ffmpeg issued better error messages! It looks like ffmpeg itself can handle mixing RGB with RGBA, but the minterpolate filter cannot! I feel like it is too often software will encounter an error without telling me exactly why.