Trying to understand how Pipe works in this situation
by regstuff from LinuxQuestions.org on (#55SR2)
I'm using ffmpeg to pull in an input rtmp stream and then push that out to a destination. In case the main input fails, I would like my ffmpeg process to switch to a backup input.
Unfortunately, ffmpeg CLI does not seem to have this ability built in.
So I came across a solution which uses pipes to manage this.
The input rtmp is pushed to a pipe file first.
Code:PIPE_FILE= /path/to/pipe/file
mkfifo $PIPE_FILE
exec 7<>$PIPE_FILE
ffmpeg -i rtmp://127.0.0.1/main/stream1 -acodec copy -vcodec copy -vbsf h264_mp4toannexb -f mpegts pipe:1 > $PIPE_FILEThe pipe file is then used as an input to restream to the final destination.
Code:ffmpeg -re -i $PIPE_FILE -c:v libx264 -preset veryfast -r 25 -g 50 -f flv $RTMP_ENDPOINTI;m trying to understand if this pipe file is an actual file or just a temporary construct.
Also, if it is an actual file, will it's size keep increasing as the stream continues.
Also, what are mkfifo and the exec 7 commands actually doing?
Thanks


Unfortunately, ffmpeg CLI does not seem to have this ability built in.
So I came across a solution which uses pipes to manage this.
The input rtmp is pushed to a pipe file first.
Code:PIPE_FILE= /path/to/pipe/file
mkfifo $PIPE_FILE
exec 7<>$PIPE_FILE
ffmpeg -i rtmp://127.0.0.1/main/stream1 -acodec copy -vcodec copy -vbsf h264_mp4toannexb -f mpegts pipe:1 > $PIPE_FILEThe pipe file is then used as an input to restream to the final destination.
Code:ffmpeg -re -i $PIPE_FILE -c:v libx264 -preset veryfast -r 25 -g 50 -f flv $RTMP_ENDPOINTI;m trying to understand if this pipe file is an actual file or just a temporary construct.
Also, if it is an actual file, will it's size keep increasing as the stream continues.
Also, what are mkfifo and the exec 7 commands actually doing?
Thanks