Ffmpeg vfilters at specific timecodes

I want to add a watermark to some videos, but I only want the watermark to appear on certain time codes in the video (like start / middle / end) and only for a few seconds.

I got ffmpeg to make a watermark by following the directions here: http://ffmpeg.arrozcru.org/forum/viewtopic.php?f=8&t=1400

But I can't figure out how to enable or disable the watermark on different timecodes. Here's the command I'm using to add a watermark:

ffmpeg -i test.mpg -vf "movie=0:png:wm.png [wm];[in][wm] overlay=10:10:1 [out]" wm_test.mpg


Any advice would be appreciated!


source to share

1 answer

He is still not implemented and I have not heard of his plans. I've been in this situation several times before and I came up with an ugly yet working solution.

Just split the video in parts, so for example your video is 30 seconds long and you want a different watermark for every 10 seconds, then divide the video into 3 parts like this:

ffmpeg -i in.mpg -t 00:00:10 // First 10 seconds
ffmpeg -i in.mpg -ss 00:00:10 -t 00:00:10 // middle 10 seconds
ffmpeg -i in.mpg -ss 00:00:20 -t 00:00:10 // last 10 seconds.

-ss // starting position
-t  // length to process


After you have 3 watermarked pieces, you can simply glue them on. For mpg, you can use a simple unix CAT tool because of the mpeg format.

Example: cat part1.mpg part2.mpg part3.mpg > whole.mpg



All Articles