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?

  • 1
    Will outputting to MPEG-TS do?
    – Gyan
    Jan 4 '16 at 8:28
  • It makes the file, but it is unplayable without other codecs installed
    – nadermx
    Jan 4 '16 at 19:09

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.