-1

I need your help. I stream to Twitch with this Command:

ffmpeg -i input.mp4 -i image.jpg -filter_complex 'overlay=x=10:x=10' -s \
  1920x1200 -framerate 15  -c:v libx264 -preset ultrafast -pix_fmt yuv420p \
  -threads 0 -f flv 'rtmp://'

How is it possible to change the image.jpg picture to another picture on a variable time? I will don't restart the FFMPEG Command.

2

Add the -f image2 -loop 1 input options for the image input, then atomically replace image.jpg when desired such as by using mv.

Basic example:

ffmpeg -i input.mp4 -f image2 -loop 1 -i image.jpg -filter_complex overlay output.mp4

Streaming example:

ffmpeg -re -i input.mp4 -f image2 -loop 1 -i image.jpg -filter_complex "overlay,format=yuv420p" -c:v libx264 -preset fast -g 50 -b:v 4000k -maxrate 4000k -bufsize 8000k -f flv 'rtmp://'
0

To answer the "variable time" part of your question use a cron job to run scripts that update the overlay image at a specified time i.e. every 5 mins. For example you can create a folder of various overlays and select one randomly every 5 minutes and copy it to image.jpg. FFMPEG will then render the new image to your stream.

It is important to use -f image 2 -loop 1 -thread_queue_size 512 -i image.jpg especially when rendering other image formats.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.