How can I pipe the output of ffmpeg to ffplay?
At the moment I use a workaround in bash :
mkfifo spam
(ffplay spam 2> /dev/null &) ; capture /dev/stdout | ffmpeg -i - spam
I do not know if it is ffmpeg that cannot output its data to stdout, or ffplay that cannot take its input from stdin.
If it is ffmpeg that cannot output its data to stdout:
capture /dev/stdout | ffmpeg -i - >(ffplay 2> /dev/null)
(You migth need to add a - argument to ffplay so it takes its input from stdin.)
If it is ffplay that cannot take its input from stdin:
ffplay <(capture /dev/stdout | ffmpeg -i -) 2> /dev/null
For more informations about the <(command) and >(command) construct, see the Process Substitution section of the bash manual.
capture is? Ideally a link to a repo or the official website.
ffmpeg -i input.avi <options> -f matroska - | ffplay -
will work; you need to set a container format for the output. This is normally set with ffmpeg looking at the extension you give the output, but here you have to set it manually with -f. I recommend matroska (MKV) because it can contain almost any video, so whatever you're transcoding it to should work perfectly well.
Note that if you are using Ubuntu 12.04, ffmpeg has been replaced by the libav fork, and you should use avconv and avplay instead; the syntax is otherwise identical. There is a sort-of ffmpeg there, but it's crippled by design.
pipe:: Invalid data found when processing inputK in Power Shell, but works well in command prompt
ffmpeg supports piping operations. See that section of the documentation here.
I don't know how ffplay works, but to pipe the output of ffmpeg to standard output, you can add the pipe command to the end of the ffmpeg command. Example:
ffmpeg -i input.flv pipe:1 | ffplay -i -
man ffplay, I cannot see ffplay supporting the -i switch - is it maybe ffmpeg only?
pipe:1 vs -? - works on ffmpeg 2.8.6.
ffplay does not support -i, though the above might work/might have worked in the past. This should also work: ffmpeg -i input.flv <options> -f matroska - | ffplay -
looks like normal pipes work (at least in windows):
ffmpeg -i sintel.mpg -pix_fmt yuv420p -f rawvideo - | ffplay -f rawvideo -pix_fmt yuv420p -s 720x480 -
haven't tried it with more complicated input/output though...
Here's another variation that seems to have a slightly faster startup:
ffmpeg -f dshow -i video=screen-capture-recorder -pix_fmt yuv420p -f mpegts - | ffplay -analyzeduration 10 -f mpegts -
Unable to find a suitable output format for 'pipe:' - I needed to specify a codec with -f.
-video_size and -pixel_format instead of -s and -pix_fmt (ffmpeg 8)