Receiving FFMPEG error -22 when piping data to stdout

2

I am attempting to use FFMPEG to transcode avi files to mp4 and pipe the data to stdout using the following command (technically through NodeJS, but I receive the same error when executing the following command directly on the command line):

ffmpeg -i myavi.avi -vcodec libx264 -acodec libvo_aacenc -f mp4 pipe:1

This error will occur:

Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred.

When I execute this next command, everything works as expected:

ffmpeg -i myavi.avi -vcodec libx264 -acodec libvo_aacenc -f mp4 newmp4.mp4

Note that I am using (or attempting) FFMPEG on Windows -- Any ideas as to what's going on here?

Edit: One last note, the version of FFMPEG I am using is N-63439-g96470ca, built on May 25, 2014 (the most recent version of FFMPEG available for the Windows Static files on http://ffmpeg.zeranoe.com/builds/).

dvlsg

Posted 2014-05-29T05:37:46.047

Reputation: 165

Answers

5

the mp4 container requires the ability to seek within the file. A pipe is a stream, and impossible to seek inside of. Try using a streaming container like ts, or flv.

szatmary

Posted 2014-05-29T05:37:46.047

Reputation: 2 181

1

Makes sense. Is WebM a suitable format for piping? My real end goal is to stream to a Chromecast, and the devkit states that the only compatible streaming protocols at this point are MP4 and WebM. (Here is the Chromecast documentation I am referencing: https://developers.google.com/cast/docs/media)

– dvlsg – 2014-05-29T15:45:42.913