问题
I am currently using this code to overlay an image over a stream . I would like to change the image being overlayed regularly. I am using a second script to cp a randomly selected jpg from a folder to a specific folder/advert.jpg every minute. When i run ffmpeg it keeps on using the original image even though the original image in the directory would have been overwritten.
ffmpeg -re -i "http://127.0.0.1:8000/251.m3u8" -loop 1 -i "/home/johan/CurrentAd/advert.jpg" -filter_complex "[1]trim=0:600,fade=in:st=0:d=2:alpha=1,fade=out:st=8:d=2:alpha=1,loop=999:1750:0,setpts=N/5/TB[w];[0][w]overlay=(W-w)/2:(H-h)/2:shortest=1" /var/www/html/sevo/sevo.m3u8 >/dev/null
回答1:
Force the generic image muxer:
ffmpeg -re -i "http://127.0.0.1:8000/251.m3u8" -loop 1 -f image2 -i ...
Without -f image2
, ffmpeg invokes jpeg_pipe for JPG input, which doesn't update the input with loop set.
来源:https://stackoverflow.com/questions/44123816/ffmpeg-reloading-changed-image-overlay-whilst-using-a-complex-filter