ffmpegarchitectureconvertersimagemagick-convertavconv

How multiple file format supporting converters work?


Software like ffmpeg/avconv, imagemagick convert.

Do they use an intermediate format:

format1 -> I. F.
format2 -> I. F.
I. F. -> format2
I. F. -> format3
...

Or do they have a method for converting from and to each supported format:

format1 -> format2
format1 -> format3
format2 -> format1
format2 -> format3
...

Solution

  • From the ffmpeg documentation:

    The decoder produces uncompressed frames (raw video/PCM audio/...) which can be processed further by filtering. After filtering, the frames are passed to the encoder, which encodes them and outputs encoded packets. Finally those are passed to the muxer, which writes the encoded packets to the output file.

    The transcoding process in ffmpeg for each output can be described by the following diagram:

     _______              ______________
    |       |            |              |
    | input |  demuxer   | encoded data |   decoder
    | file  | ---------> | packets      | -----+
    |_______|            |______________|      |
                                               v
                                           _________
                                          |         |
                                          | decoded |
                                          | frames  |
                                          |_________|
     ________             ______________       |
    |        |           |              |      |
    | output | <-------- | encoded data | <----+
    | file   |   muxer   | packets      |   encoder
    |________|           |______________|