Reputation: 1708
Can I use FFMPEG to insert an image every 20 frames in a video? I'm trying to create a subliminal message experiment and I thought it would be an easy way to make it but I can't find anything online.
I tried to make something myself and created a script that:
1.splits a file into audio and video files
2.splits the video into frames
3.overwrites every 20th image in the sequence with the message image
4.re-encoding the video
5.concatenating it with the original audio
this works but it's way more disk space consuming to be comfortable, is there a better way to do this?
any advice or thought would be happily welcome.
Upvotes: 2
Views: 3494
Reputation: 92928
Make sure your message image is the same resolution as the video. Then run
ffmpeg -i video.mp4 -loop 1 -i msg.png
-filter_complex "[0][1]overlay=enable='not(mod(n,20))':shortest=1[v]"
-map "[v]" -map 0:a -c:a copy out.mp4
This will imprint the image on the very first frame as well. To avoid that,
ffmpeg -i video.mp4 -loop 1 -i msg.png
-filter_complex "[0][1]overlay=enable='if(gt(n,0),not(mod(n,20)),0)':shortest=1[v]"
-map "[v]" -map 0:a -c:a copy out.mp4
Upvotes: 6