[FFmpeg-user] Send ffmpeg segments to stdout so they can be processed by next pipe

Szymon Danielczyk danielczyk.szymon at gmail.com
Fri Jan 29 01:30:09 EET 2021


I have a pipeline like this in which I simulate a video stream 

ffmpeg -i input.mov -f matroska - |\
ffmpeg -i - -codec copy -map 0 -reset_timestamps 1 \
-segment_time 10 -f segment  output/out%03d.mov

which works and it is splitting the input video into 10 sec long segment files saved into output folder. Now I would like to instead tell ffmpeg to pass them to stdout so in the next pipe I can hook up a script to decide what to do which each segment based on a presence of another file

ffmpeg -i input.mov -f matroska - |\
ffmpeg -i - -codec copy -map 0 -reset_timestamps 1 \
-segment_time 10 -f segment |\
NEXT_PIPE_SCRIPT

The NEXT_PIPE_SCRIPT should be something like
{
TEST_FILE=".do"
if [ -f "$TEST_FILE" ]; then
     echo "$TEST_FILE exists going to redirect videos to a folder"
    >> output/$RANDOM.mov
 else 
    >> /dev/null
fi
}

The idea is that depends if the file is there or not some segments should go to /dev/null and some to the output folder.
After much googling I've found this old thread which sais that writing segmented files to stdout is not supported 

https://ffmpeg.org/pipermail/ffmpeg-user/2017-November/037718.html

Also I do not see any example in the ffmpeg documentation of outputing segments to stdout. 

If this is true will anyone have an idea how to solve it in some other way?

Cheers
Simon 
 


More information about the ffmpeg-user mailing list