开发者

Can't Stream Ogg From ffmpeg Through stdout

To get the the crux of it, why does the first command work, but the second command does not. They produce slightly differently sized files with different contents:

ffmpeg -i test.wav -f ogg -acodec libvorbis test.a.ogg

ffmpeg -i test.wav -f ogg -acodec libvorbis - > test.b.ogg
开发者_如何学编程

test.a.ogg will play properly and has no problems. test.b.ogg starts in the middle of the source audio and has stops and gaps in the audio. It also does not report the length of the track.

I want to transcode source files on the fly into ogg for a program I am writing and I am trying to pipe the stdout from ffmpeg into my program. Putting the results into an intermediary file will kill performance since the transcoding is supposed to happen on demand.


OGG might be required to be seekable. From ffmpeg docs:

For writing to stdout with ffmpeg:

ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi

...this is the same as...

ffmpeg -i test.wav -f avi pipe: | cat > test.avi

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜