【问题标题】:How multiple file format supporting converters work?支持转换器的多种文件格式如何工作?
【发布时间】:2018-02-03 06:44:05
【问题描述】:
ffmpeg/avconv、imagemagick convert等软件。
他们是否使用中间格式:
format1 -> I. F.
format2 -> I. F.
I. F. -> format2
I. F. -> format3
...
或者他们是否有一个方法用于从和转换到每个支持的格式:
format1 -> format2
format1 -> format3
format2 -> format1
format2 -> format3
...
【问题讨论】:
标签:
ffmpeg
architecture
converter
imagemagick-convert
avconv
【解决方案1】:
来自ffmpeg documentation:
解码器产生未压缩的帧(原始视频/PCM 音频/...)
可以通过过滤进一步处理。过滤后,
帧被传递给编码器,编码器对其进行编码并输出
编码的数据包。最后,这些被传递给 muxer,它写道
编码后的数据包到输出文件。
ffmpeg 中每个输出的转码过程可以描述为
下图:
_______ ______________
| | | |
| input | demuxer | encoded data | decoder
| file | ---------> | packets | -----+
|_______| |______________| |
v
_________
| |
| decoded |
| frames |
|_________|
________ ______________ |
| | | | |
| output | <-------- | encoded data | <----+
| file | muxer | packets | encoder
|________| |______________|
【解决方案2】:
ImageMagick 使用委托库在格式之间进行转换。例如 TIFF 的 libtif 和 PNG 的 libpng 等。一些格式转换直接内置在 ImageMagick 中。
【解决方案3】:
解码器和编码器是分开的。中间格式通常被称为“原始”。这是实际显示的格式。