Hello, I'm trying to stream (on YouTube) an image... This image is a PNG file on my computer... The dimensions of my PNG file are 1280x720... This image usually don't change but from times to times it might change and of course the stream must refresh/update it... The goal is to stream this image on YouTube without any interruption (I guess with -stream_loop) even if there is some dropped frames during a modification of my image... Moreover is it possible to add a background music (with a loop) to the stream? Thank you in advance for your help, Maxime. -- Sent from: http://www.ffmpeg-archive.org/
there really isnt a easy way to loop audio or video (that i have found).. only images.. and im actually surprised they havent added a 'loop 1' option for audio or video files yet.. it must be among the top requested things to be added... so instead we can loop (sort of) by using concat. ffmpeg -f concat -safe 0 -i 'music.txt' -loop 1 -i 'image.jpg' -c:v libx264 -preset ultrafast -c:a copy -f flv rtmp://rtmp.youtube.com/live/stream the contents of the text file would look something like this file '/path/to/music.mp3' file '/path/to/music.mp3' file '/path/to/music.mp3' file '/path/to/music.mp3' file '/path/to/music.mp3' file '/path/to/music.mp3' file '/path/to/music.mp3' file '/path/to/music.mp3' file '/path/to/music.mp3' file '/path/to/music.mp3' this would effectively loop the audio 10 times... add more lines if you need to. ffmpeg by default streams video out at 25fps. you can save a bit of bandwidth if you specify a lower frame rate (though youtube might complain if its too low). you should also be able to change the image in real time as ffmpeg is still streaming by replacing the image.jpg with a new one, but you must replace it atomically, or ffmpeg will most likely crash. using the mv command instead of cp or overwriting... mv newimage.jpg image.jpg its also a good idea to make sure the image you are replacing with has the same attributes (size, etc) cheers DL
On Jan 28, 2018, at 1:10 24AM, pigeon33 <pigeon33@harakirimail.com> wrote:
Hello,
I'm trying to stream (on YouTube) an image...
This image is a PNG file on my computer...
The dimensions of my PNG file are 1280x720...
This image usually don't change but from times to times it might change and of course the stream must refresh/update it...
The goal is to stream this image on YouTube without any interruption (I guess with -stream_loop) even if there is some dropped frames during a modification of my image...
Moreover is it possible to add a background music (with a loop) to the stream?
Thank you in advance for your help,
Maxime.
-- Sent from: http://www.ffmpeg-archive.org/ _______________________________________________ ffmpeg-user mailing list ffmpeg-user@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request@ffmpeg.org with subject "unsubscribe".
On 2/8/2018 6:42 PM, DopeLabs wrote:
there really isnt a easy way to loop audio or video (that i have found).. only images.. and im actually surprised they havent added a 'loop 1' option for audio or video files yet.. it must be among the top requested things to be added...
The (input) option for this is -stream_loop. Value of -1 is for infinite loop. In the past, there were issues with smooth PTS generation, but I believe they have been recently fixed. Regards, Gyan
2018-02-08 14:17 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:
The (input) option for this is -stream_loop.
If the input is an image (as in this case), "-loop 1" is the better option, as you wrote in your mail, "stream_loop" is a hack and sometimes has issues. (May need -shortest) Carl Eugen
On 2/9/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
2018-02-08 14:17 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:
The (input) option for this is -stream_loop.
If the input is an image (as in this case), "-loop 1" is the better option, as you wrote in your mail, "stream_loop" is a hack and sometimes has issues. (May need -shortest)
You should really use loop filter as it will decode image only once.
2018-02-09 16:09 GMT+01:00 Paul B Mahol <onemda@gmail.com>:
On 2/9/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
2018-02-08 14:17 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:
The (input) option for this is -stream_loop.
If the input is an image (as in this case), "-loop 1" is the better option, as you wrote in your mail, "stream_loop" is a hack and sometimes has issues. (May need -shortest)
You should really use loop filter as it will decode image only once.
That sounds like a much better solution, thanks! I wonder though how this filter works... Carl Eugen
On 2018-02-09 16:20, Carl Eugen Hoyos wrote:
2018-02-09 16:09 GMT+01:00 Paul B Mahol <onemda@gmail.com>:
On 2/9/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
2018-02-08 14:17 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:
The (input) option for this is -stream_loop.
If the input is an image (as in this case), "-loop 1" is the better option, as you wrote in your mail, "stream_loop" is a hack and sometimes has issues. (May need -shortest)
You should really use loop filter as it will decode image only once.
That sounds like a much better solution, thanks!
I'm not so sure. The original message has this paragraph:
This image usually don't change but from times to times it might change and of course the stream must refresh/update it...
The image should be opened, decoded, and closed for every frame so that changes will be seen in the output stream. An optimised solution might check for changes in file modify time or watch for changes with a platform specific feature. I don't think either of these are present in ffmpeg.
2018-02-10 0:50 GMT+01:00 James Darnley <james.darnley@gmail.com>:
On 2018-02-09 16:20, Carl Eugen Hoyos wrote:
2018-02-09 16:09 GMT+01:00 Paul B Mahol <onemda@gmail.com>:
On 2/9/18, Carl Eugen Hoyos <ceffmpeg@gmail.com> wrote:
2018-02-08 14:17 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:
The (input) option for this is -stream_loop.
If the input is an image (as in this case), "-loop 1" is the better option, as you wrote in your mail, "stream_loop" is a hack and sometimes has issues. (May need -shortest)
You should really use loop filter as it will decode image only once.
That sounds like a much better solution, thanks!
I'm not so sure. The original message has this paragraph:
This image usually don't change but from times to times it might change and of course the stream must refresh/update it...
(I would still like to know how the filter can be used though)
The image should be opened, decoded, and closed for every frame so that changes will be seen in the output stream.
Isn't that what -loop does? Or is the input stream never closed? Carl Eugen
participants (6)
-
Carl Eugen Hoyos -
DopeLabs -
Gyan Doshi -
James Darnley -
Paul B Mahol -
pigeon33