[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: record stream using time limit, reconnecting as needed
From: |
Roger |
Subject: |
Re: record stream using time limit, reconnecting as needed |
Date: |
Wed, 22 Feb 2023 06:40:48 -0500 |
> On Wed, Feb 22, 2023 at 04:21:14PM +0900, Koichi Murase wrote:
>2023???2???22???(???) 12:52 Roger <rogerx.oss@gmail.com>:
>> 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?
>
>If you specify a negative integer (e.g. -<PGID> where <PGID> is an
>integer) to `kill', `kill' will kill all the processes that belong to
>the process group PGID. You can give a distinct process group ID to
>the background while loop by specifying `set -m' before starting the
>background job. Then you can pass the PGID (i.e., the PID of the
>`while' loop) to `kill' to kill all the processes including ffmpeg. In
>this way, you do not need to directly specify the PID of ffmpeg. This
>is an example.
>
>#!/usr/bin/env bash
>
>record() {
> local -
> set -m
> while true; do
> ffmpeg http://some.url.m3u8
> done & pgid_task="${!}"
>}
>
>sleep_while_recording() { sleep 30m; }
>
>record
>sleep_while_recording
>kill -INT -"$pgid_task"
Looks like what I've been missing. Especially if ffmpeg -reconnect(options)
are not reliable.
signature.asc
Description: PGP signature
- record stream using time limit, reconnecting as needed, Roger, 2023/02/21
- Re: record stream using time limit, reconnecting as needed, Roger, 2023/02/21
- Re: record stream using time limit, reconnecting as needed, Roger, 2023/02/21
- Re: record stream using time limit, reconnecting as needed, alex xmb ratchev, 2023/02/22
- Re: record stream using time limit, reconnecting as needed, Koichi Murase, 2023/02/22
- Re: record stream using time limit, reconnecting as needed, Koichi Murase, 2023/02/22
- Re: record stream using time limit, reconnecting as needed, Roger, 2023/02/22
- Re: record stream using time limit, reconnecting as needed, Koichi Murase, 2023/02/22
- Re: record stream using time limit, reconnecting as needed,
Roger <=
- Re: record stream using time limit, reconnecting as needed, Roger, 2023/02/23
- Re: record stream using time limit, reconnecting as needed, Roger, 2023/02/23
- Re: record stream using time limit, reconnecting as needed, Greg Wooledge, 2023/02/23
- Re: record stream using time limit, reconnecting as needed, Roger, 2023/02/24