[FFmpeg-user] Create a live video stream from a single image file

Weydson Lima weyseal at gmail.com
Sun Dec 22 23:44:16 EET 2019

On 12/22/19 10:03 AM, Carl Eugen Hoyos wrote:
> Am Sa., 21. Dez. 2019 um 22:04 Uhr schrieb Weydson Lima <weyseal at gmail.com>:
>> I'm trying to create a live video stream from a single image. Once this
>> image gets overwritten, a new video frame would then be created
>> otherwise the last image would be used as the current video frame.
>> Is there a way to accomplish that using the ffmpeg command line? I was
>> thinking about something like this pseudo code:
>> cat -forever source.jpg | ffmpeg -i pipe:0 udp://
> Did you test the loop option of the image2 demuxer and its friends?
Thanks. I looked at the loop option in the documentation before posting 
to the mailing list but wasn't sure if it was the right approach. I've 
tried the following but am unable to update the video once the source 
file changes:

ffmpeg -f image2 -loop 1 -i source.png -f mpegts 

I tried different approaches to update source.png:

cat new.png > source.png
cp new.png source.png
mv -f new.png source.png

Apparently ffmpeg isn't refreshing source.png?

Someone from IRC suggested that:

(while :; do cat source.png; sleep 1; done) | ffmpeg -f image2pipe -i - 
-f mpegts "udp://"

but ffmpeg complained that the output file is empty.

I'm not sure what else to try now.

More information about the ffmpeg-user mailing list