[FFmpeg-user] filter_complex - manage missing input

Enrico Vittorini forforumita at outlook.com
Sun Dec 15 18:50:40 EET 2019

Hello Gents,
i would need an help. I am generating a mosaic with the following code:

ffmpeg -re -y -i input.ts -map_chapters -1 -an -sn -dn
-filter_complex "color=c=black:size=1920x1080 [base];

[0:#0xb0] setpts=PTS-STARTPTS, scale=320x240, drawtext=fontsize=30:x=(w-text_w)/2:y=(h-text_h)/2:y=200:fontcolor=white:alpha=0.8:box=1:boxcolor=black at 0.5:boxborderw=5:text="Channel1" [r1p1];

[base][r1p1] overlay=shortest=0 [tmp1];
[tmp1][r1p1a1] overlay=shortest=0:x=0 [tmp2];
[tmp2][r1p1a2] overlay=shortest=0:x=0:y=80
-c:v libx264 -b:v 4M -minrate 4M -maxrate 4M out.ts

The problem i need to face is that if the video with PID 0xb0 does not exist, the ffmpeg command fails at startup. I would need a way to go on... and eventually to replace that video with an image.

Can you help me?

More information about the ffmpeg-user mailing list