help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: record stream using time limit, reconnecting as needed


From: alex xmb ratchev
Subject: Re: record stream using time limit, reconnecting as needed
Date: Wed, 22 Feb 2023 08:10:41 +0100

On Wed, Feb 22, 2023, 4:52 AM Roger <rogerx.oss@gmail.com> wrote:

> Here's something similar to what I wrote within another script, written
> approximately ten years ago.
>
> Far more simplified than using timeout.
>
> However, I'm still stumped for how to background an endless loop with the
> included ffmpeg stream recording, so the stream is easily reconnected if
> dropped, while falling through to get the PID of the backgrounded endless
> loop
> or ffmpeg, for killing after so many (eg 30) minutes?
>
> Think this gets down to proper placement of the ampersand sign for
> backgrounding?
>
> Sample script follows.
>
> # FUNCTIONS
>
> record()
> {
>     # created a function for the (endless) while recording loop, then
>     # backgrounded.
>     while/loop
>         ffmpeg http://some.url.m3u8
>         pid_task="${!}"
>     done &
>
>     # FIXME: Where or how do I put the background & sign, to background
> the
>     # ffmpeg/while loop?
> }
>
> sleep_while_recording()
> {
>     # number of desired minutes of recording stream
>     # converted minutes to seconds, if need to perform math on time
>     sleep 30m
> }
>
> # MAIN
>
> record
>
> sleep_while_recording
>
> kill $pid_task
>

why not just timeout 30m ffmpeg

>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]