using pipes to channel file i/o to another process

前端 未结 2 1322
南笙
南笙 2021-01-25 04:13

Just started learning/using pipes and was wondering how to route file output of an application into a pipe so that another application can use it.

To be exact, I want t

相关标签:
2条回答
  • 2021-01-25 04:57

    ffmpeg can be persuaded to output to a pipe:

    ffmpeg -i whatever.avi -f mp4 -
    

    The "-" tells it to output to stdout instead of to a file, and the "-f" tells it what output the output file should be.

    You could redirect that to a named pipe, of course, but calling it with popen to get the output as a file descriptor directly seems the way to go to me.

    0 讨论(0)
  • 2021-01-25 05:08

    ffmpeg can also read from stdin and write to stdout like this:

    ffmpeg -i pipe:0 -f wav pipe:1
    

    where 0 and 1 are the standard POSIX file descriptors.

    0 讨论(0)
提交回复
热议问题