Reputation: 1127
I need to set an overlay (image.png
with alpha channel) on the subpart of a video. Setting it on the whole video works great. But I need to make 10 seconds gap without PNG in the beggining and in the end of a video.
So the overlay should appear on the 10th second after the start and automatically disappear on the (length - 10) second. I spent a day trying to make it work, but it seems that trim
video filter simply doesn't support trimming "single-PNG-image video stream".
In this command
ffmpeg -y -i "$INPUT" -i "$PNG" -c:v libx264 -preset ultrafast -filter_complex \
"[0:v]setpts=0.5*PTS,fps=25[vm]; [1:0]trim=10:190[vo]; [vm][vo]overlay=x=0:y=0:overlay=eof_action=pass[v]; [0:a]atempo=2.0[a]" \
-map "[v]" -map "[a]" qtest_AVUP.avi
the 190 should be replaced with some function/calculations, but the real problem is that the overlay isn't applied at all. As the result we've got normal video without overlays. Could you please help me to solve this?
Upvotes: 1
Views: 299
Reputation: 1900
Try this for your overlay code:
-filter_complex "[0:v][1:v] overlay=25:25:enable='between(t,20,40)'"
This will put your overlay between 20 and 40 seconds. You'll have to do a calculation to get your EOF-10. Here's some code to get your video duration:
DURATION=$(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $INPUT )
Upvotes: 1