ffmpeg: which file formats support stdin usage?

2019-03-12 12:02发布

问题:

I know ffmpeg is able to read data from stdin rather than reading from disk using ffmpeg -i -. Is this supported for all file formats? If it is not, is there a list which file formats are supported?

回答1:

You need to run ffmpeg -protocols to determine if the pipe protocol (the read and write from stdin and stdout) supported in your version of ffmpeg and then ffmpeg -formats to see the list of supported formats. In the excerpt below you will see the note on output pipe that it must be seekable for some protocols. For input protocols it has no such restriction.

From man ffmpeg-protocols:

PROTOCOLS

Protocols are configured elements in FFmpeg which allow to access resources which require the use of a particular protocol.

When you configure your FFmpeg build, all the supported protocols are enabled by default. You can list all available ones using the configure option --list-protocols.

You can disable all the protocols using the configure option --disable-protocols, and selectively enable a protocol using the option --enable-protocol=PROTOCOL, or you can disable a particular protocol using the option --disable-protocol=PROTOCOL.

The option -protocols of the ff* tools will display the list of supported protocols.

A description of the currently available protocols follows. ... pipe
UNIX pipe access protocol.

Allow to read and write from UNIX pipes.

The accepted syntax is:

       pipe:[<number>]

number is the number corresponding to the file descriptor of the pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If number is not specified, by default the stdout file descriptor will be used for writing, stdin for reading.

Note that some formats (typically MOV), require the output protocol to be seekable, so they will fail with the pipe output protocol.