This is a great example in demonstrating the versatility of using ‘inputs’, ‘outputs’ and ‘formats’ with ffmpeg.
By setting -f data ahead of -i input.txt we instruct FFmpeg to treat the input file as ‘raw data’. For a full list of supported input/output formats, run ffmpeg -formats.
The params following the input (i.e. everything after -i) will define the output we intend ffmpeg to generate.
First, we would like to ‘map’ the input stream 0:0 to the output stream. Next, we set the encoding to ‘Raw text subtitle’. For a full list of supported encoders, run ffmpeg -encoders. Then, we set the format of the output stream to ‘raw data’. Lastly, normally ffmpeg generates a file, however in this case we would like to dump our raw data stream into STDOUT using by adding the - at the end of the command.