Since you can't write FFMpeg to stdout with flv to mp4 is there a workaround?

1

I've been trying for a while to figure out a way in which I can have FFMpeg input a flv url and output to stdout mp4.

Apparently mp4 requires to read the size of the file to fully work.

Is there a way in which I could use FFMpeg by piping it?

nadermx

Posted 2016-01-04T08:17:45.250

Reputation: 387

1Will outputting to MPEG-TS do? – Gyan – 2016-01-04T08:28:52.810

It makes the file, but it is unplayable without other codecs installed – nadermx – 2016-01-04T19:09:11.870

Answers

6

The MP4 muxer needs the ability to seek back in a stream to update the metadata after the stream is written. Seeking backwards is impossible on stdout—or pipes in general.

Hence, there's no way to pipe an MP4 container in a meaningful way. That does however not restrict you from using any specific codec, such as H.264 which is referred to as MPEG-4 (AVC) as well. Just make sure to use a container format that allows for streaming, such as MPEG-TS or Matroska.

If you are willing to accept a solution that does not truly stream the resulting frames, but does still adhere to your specification (read FLV from URL resource, output MP4 to stdout), you can always try to first encode the FLV to a temporary file and then output that to stdout.

bertm

Posted 2016-01-04T08:17:45.250

Reputation: 151