Create a live video stream from a single image file

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Create a live video stream from a single image file

Weydson Lima
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://127.0.0.1:3333?listen

Thank you

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Create a live video stream from a single image file

Carl Eugen Hoyos-2
Am Sa., 21. Dez. 2019 um 22:04 Uhr schrieb Weydson Lima <[hidden email]>:
>
> 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://127.0.0.1:3333?listen

Did you test the loop option of the image2 demuxer and its friends?

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Create a live video stream from a single image file

Weydson Lima
On 12/22/19 10:03 AM, Carl Eugen Hoyos wrote:

> Am Sa., 21. Dez. 2019 um 22:04 Uhr schrieb Weydson Lima <[hidden email]>:
>> 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://127.0.0.1:3333?listen
> 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
"udp://127.0.0.1:3333?listen"

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://127.0.0.1:3333?listen"

but ffmpeg complained that the output file is empty.

I'm not sure what else to try now.

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Create a live video stream from a single image file

kumowoon1025
> 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:

Are the images the same size, format, etc.? Also, try setting an input framerate.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Create a live video stream from a single image file

Carl Eugen Hoyos-2
In reply to this post by Weydson Lima
Am So., 22. Dez. 2019 um 22:41 Uhr schrieb Weydson Lima <[hidden email]>:

>
> On 12/22/19 10:03 AM, Carl Eugen Hoyos wrote:
> > Am Sa., 21. Dez. 2019 um 22:04 Uhr schrieb Weydson Lima <[hidden email]>:
> >> 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://127.0.0.1:3333?listen
> > 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
> "udp://127.0.0.1:3333?listen"

Complete, uncut console output missing.

> I tried different approaches to update source.png:
>
> cat new.png > source.png
> cp new.png source.png
> mv -f new.png source.png

(I just overwrote the source file with ffmpeg in my tests.)

> Apparently ffmpeg isn't refreshing source.png?

Works fine here and if I rm the file, ffmpeg exits
with an error message.

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".