I'm using a program which continuously writes MPEG-TS video data to a file while it's running. I'm expecting it to run continuously for many days.
I want to use ffmpeg to transcode this video data live. So that the .mts file doesn't grow continuously until I run out of hard drive space, I'm trying to get the first program to write to a named pipe and for
ffmpeg to read from that pipe.
I tried doing
ffmpeg -i /tmp/test.mts -c:v libx264 test.mp4 but it seems that ffmpeg quits once it reaches the end of the pipe, instead of waiting for new data. For example if I start the program, wait 30 seconds and then run ffmpeg, I'll only get ~50 seconds of video out. (30 seconds + the time it takes ffmpeg to catch up)
I have managed to get it working by doing
ffmpeg -i pipe:0 -c:v libx264 test.mp4 < /tmp/test.mts but this feels kind of hacky to me, using stdin to do this. Is there a way I can directly provide the named pipe as an input to ffmpeg and have it wait for new data once it reaches the end of the current data?