fefwfefefwfwe
fefwfefefwfwe

Reputation: 1545

ffmpeg audio copy failing with pipe

In a command line, if I run:

ffmpeg -i inputVideo.mp4 -vn -f mp4 -acodec copy outputAudio.aac

everything works perfectly fine. However if I do the same thing, except standard out instead of the output file ("pipe:1" instead of "outputAudio.aac") then I get this error: "Could not write header for output file #0 (incorrect codec parameters ?)"

Help from anyone with ffmpeg experience is greatly appreciated

Thanks

Upvotes: 2

Views: 2815

Answers (1)

av501
av501

Reputation: 6729

Well the trouble is you are asking for a mp4 file with a filename of outputAudio.aac. So if you check outputAudio.aac it is actually a mp4 file. To write mp4 files ffmpeg will need a seekable file descriptor which stdout is not. [this is because mp4 moov atom is written at the end in the beginning of the file.
If you want aac to be dumped to stdout you should ask for a adts file

ffmpeg -i input.mp4 -acodec copy -vn -f adts -strict -2 -

If you need it in a mp4.. mux it after that into a file

mp4 is not a streaming format: see here Fix 3GP file after streaming from Android Media Recorder for my answer to a different question which explains this.

Upvotes: 1

Related Questions