[FFmpeg-user] YouTube streaming of a static image...
DopeLabs
dopelabs at dubstep.fm
Thu Feb 8 15:12:50 EET 2018
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 at 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 at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list