[FFmpeg-user] filter_complex with 2 images generates 3 files instead of one
Gabriel Dina
gabriel.dina at gmail.com
Wed Mar 1 11:39:25 EET 2023
Updated command:
ffmpeg -i *uploads/test.png* -i ./assets/logo.png -i ./assets/telefon.png
-filter_complex
"[1][0]scale2ref=w='iw*1/5':h='ow/mdar'[v1];[2][0]scale2ref=w='iw*9/10':h='ow/mdar'[v2];[0][v1]overlay=main_w-overlay_w-5:5[vid];[vid][v2]overlay=10:main_h-overlay_h-10"*
test.png*
Result:
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg
developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1
--toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu
--incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl
--disable-stripping --enable-gnutls --enable-ladspa --enable-libaom
--enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca
--enable-libcdio --enable-libcodec2 --enable-libdav1d --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-librabbitmq
--enable-librubberband --enable-libshine --enable-libsnappy
--enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh
--enable-libtheora --enable-libtwolame --enable-libvidstab
--enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265
--enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq
--enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl
--enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg
--enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883
--enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
Input #0, png_pipe, from 'uploads/test.png':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: png, rgba(pc), 512x512 [SAR 3779:3779 DAR 1:1], 25
fps, 25 tbr, 25 tbn, 25 tbc
Input #1, png_pipe, from './assets/logo.png':
Duration: N/A, bitrate: N/A
Stream #1:0: Video: png, rgba(pc), 350x206 [SAR 11811:11811 DAR 175:103],
25 fps, 25 tbr, 25 tbn, 25 tbc
Input #2, png_pipe, from './assets/telefon.png':
Duration: N/A, bitrate: N/A
Stream #2:0: Video: png, rgba(pc), 1650x200 [SAR 11811:11811 DAR 33:4],
25 fps, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 (png) -> scale2ref:ref
Stream #0:0 (png) -> scale2ref:ref
Stream #0:0 (png) -> overlay:main
Stream #1:0 (png) -> scale2ref:default
Stream #2:0 (png) -> scale2ref:default
scale2ref:ref -> Stream #0:0 (png)
scale2ref:ref -> Stream #0:1 (png)
overlay -> Stream #0:2 (png)
Press [q] to stop, [?] for help
Output #0, image2, to 'test.png':
Metadata:
encoder : Lavf58.76.100
Stream #0:0: Video: png, rgba(pc, progressive), 512x512 [SAR 3779:3779
DAR 1:1], q=2-31, 200 kb/s, 25 fps, 25 tbn
Metadata:
encoder : Lavc58.134.100 png
Stream #0:1: Video: png, rgba(pc, progressive), 512x512 [SAR 3779:3779
DAR 1:1], q=2-31, 200 kb/s, 25 fps, 25 tbn
Metadata:
encoder : Lavc58.134.100 png
Stream #0:2: Video: png, rgba(pc, gbr/unknown/unknown, progressive),
512x512 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 25 fps, 25 tbn
Metadata:
encoder : Lavc58.134.100 png
[image2 @ 0x5641d478bf80] Could not get frame filename number 2 from
pattern 'test.png'. Use '-frames:v 1' for a single image, or '-update'
option, or use a pattern such as %03d within the filename.
Error writing trailer of test.png: Invalid argument
frame= 1 fps=0.0 q=-0.0 Lq=-0.0 q=-0.0 size=N/A time=00:00:00.04
bitrate=N/A speed=0.539x
video:150kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: unknown
On Wed, Mar 1, 2023 at 11:25 AM Michael Koch <astroelectronic at t-online.de>
wrote:
> Am 01.03.2023 um 10:23 schrieb Michael Koch:
> > Am 01.03.2023 um 10:12 schrieb Gabriel Dina:
> >> ffmpeg -i uploads/image.mp4 -i ./assets/logo.png -i ./assets/info.png
> >> -filter_complex "[1][0]scale2ref=w='iw
> >>
> *1/5':h='ow/mdar'[v1];[2][0]scale2ref=w='iw*9/10':h='ow/mdar'[v2];[0][v1]overlay=main_w-overlay_w-5:5[vid];[vid][v2]overlay=10:main_h-overlay_h-10"
>
> >>
> >> uploads/image%0d.mp4
> >>
> >> If I remove %0d from the output I get an error.
> >
> > please post the full console output.
>
> P.S. I mean with %0d removed.
>
> Michael
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-user
mailing list