On Mon, 22 Mar 2021 13:03:01 +0000, adam smith via ffmpeg-user
<ffmpeg-user@ffmpeg.org> wrote:

>Hi group, hope everyone is good,
>
>I am trying to capture an srt stream using ffmpeg as a caller and everything 
>is going well, just a couple of edge cases I would like to resolve that I 
>think are related.
>
>I would like the capture to continue even if the source stream is unavailable 
>for a time. I don’t mean just keep the connection open and reconnect. I need 
>the timing to remain constant, so the output should have gaps in it where the 
>source was unavailable.
>
>I have tried using lavfi -i color=color=blue:size=1920x1080 as an input and 
>then overlaying the SRT stream. But ffmpeg will wait for the stream data to 
>arrive before starting and will pause if the stream becomes unavailable, 
>continuing when the SRT is available again. Basically the same behaviour as 
>without the colour input.
>
>The other issue (which will probably go away if the first issue is resolved, 
>is stopping it :)
>I was setting a record duration using the -t option, but removed it as with 
>current behaviour the duration may never be reached and it will hang around 
>forever waiting for the stream to come back and finish.
>The new plan was to use a terminator script outside of ffmpeg that waits until 
>a set time and then sends the pid.kill.
>
>The terminator works great when the source stream is still active so I can 
>dynamically update the end time; but if the source stream has already stopped, 
>ffmpeg will continue to hang as it needs another pid.kill to stop, which in 
>turn stops it from muxing the mp4 output.
>I have a sort of workaround for this where the mp4 is written as a fragmented 
>mp4 and so doesn’t need the mux stage, but I would prefer to stop it nicely so 
>that I can use other output formats if I want.
>
>Latest command used is below.
>It includes the colour input and overlay which is not acting in the way that I 
>wanted.
>It includes the fragmented mp4 flags which are showing me love but I would 
>prefer not to need.
>I can include a console output if helps but there is no actual error, its just 
>me not knowing how to achieve what I want ;)
>Please ignore the audio filter, I know it could be simpler but this is 
>automated and is set up to cope with random inputs so follows a pattern.
>Please ignore the Tee Muxer, again that is automated and is used because there 
>can be more than one output destination for each.
> 
> <strip command lines>
>
>Thanks in advance for any advice.

Maybe not exactly what you need but...

I have a script that downloads the streaming video starting immediately and
running for a specific duration.
It is executed in an at job on Ubuntu and the at command looks like this:

timeout --signal=2 66m getmsnbcstreamyt 2021-03-25_input13.mp4
The job is created using this:

echo "timeout --signal=2 66m getmsnbcstreamyt 2021-03-25_input13.mp4" | at 17:59


So this process starts at the time set for the at command and ends after 66
minutes in this case.

The script getmsnbcstreamyt uses youtube-dl, which in turn uses ffmpeg.

If I start the script interactively I see lots of féedback from the download
progress and can break it using either Ctrl-C or q from the keyboard, in both
cases youtube-dl exits after finishing the output file by adding the moov atom
and changing the name by removing the .part ending.

Obviously I cannot send q to the process from within the at job so I use the
timeout function with the signal argument --signal=2
And this works just fine.

You could possibly run your script as is but package it inside a timeout call
such that ffmpeg is at least exiting after the timeout has expired?


-- 
Bo Berglund
Developer in Sweden

_______________________________________________
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to