0
Is there any solution to stream an image like a video to rtmp server with ffmpeg. But with difference that it should be played for specific duration.
For example show an image on rtmp server (youtube) for like 2 minutes. then stop streaming?
0
Is there any solution to stream an image like a video to rtmp server with ffmpeg. But with difference that it should be played for specific duration.
For example show an image on rtmp server (youtube) for like 2 minutes. then stop streaming?
1
Use -re -t 120
in an ffmpeg command line to stop the encoding after 120 seconds.
An alternative solution could be to start the command from a script and kill the process after two minutes. This can be done by starting the process asynchronously, remembering the process ID, and killing it after sleeping for two minutes. Or using the timeout
utility from GNU coreutils.
Note: -re
is required when you want to stream directly to RTMP or UDP. because without this flag, ffmpeg will render the output as fast as it can, which stops the stream early. When you want to create an output video file from a picture, -re
together with -t 120
means that the encoding stops after 120 seconds.
1You mean just starting the
ffmpeg
command and then stopping it after 2 minutes? What's preventing you from doing that? Or do you need this to be automated? If so, either use the-t 120
option to stop encoding after 120 seconds, or write a script that stops the ffmpeg process after two minutes. – slhck – 2019-09-04T09:15:03.590I was using
-t
flag. but problem was that i did missed the-re
in start of command. Now it's working fine – Reza Torkaman Ahmadi – 2019-09-04T09:23:20.937