I couldn't decide whether this was superuser, SO or video production so my apologies if you think I got it wrong.
I've got a number of different video streams from various inputs on the computer (some are via WiFi, some RTMP etc) and I have got them all transcoded into raw h264 frames.
Now I want to output them to an RTMP stream. For example, I will set camera1 to output to a named pipe called CAM01. I can get ffmpeg to read from the pipe, but the problem comes when I want to switch cameras. I was hoping that killing the camera1 output to the pipe, and then starting a new process that output camera2 to the same CAM01 pipe would let ffmpeg pick up the stream, however it hangs on the last frame it received before I killed the first camera.
However, if camera1's output is interrupted for some reason (say, the wireless connection to it drops out) then FFmpeg has no problem picking up the stream when the picture comes back.
Basically, is there a way to get ffmpeg to keep reading from the pipe even when it's temporarily interrupted, or is what I'm trying to do simply not possible this way?
I'm a bit of a noob with named pipes, so please excuse my potential ignorance. The command I'm currently using (note that for now it generates audio because I haven't got audio sorted yet)
ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i CAM01 -vcodec copy -acodec aac -ab 128k -g 120 -strict experimental -f flv "my_rtmp_URL"
If it matters, the CAM01 pipe basically just contains raw h264 frames (like you get out of raspivid)
TIA!
EDIT: Forgot to say, I'm on Linux Mint
For anyone trying to do the same thing
If you start writing to the pipe before the previous input has been killed, ffmpeg appears to continue encoding uninterrupted when the previous input is killed.