avconv在多个线程上
是否可以在多个处理器或线程上运行作业以加速avconv?
有没有正在进行的function,如果不是我想知道为什么?
您正在使用avconv的-threads选项。 最安全的设置是:
-threads auto
但如果你想稍微试验一下,你也可以在那里设置一个整数。 现代FFmpeg(现在是Ubuntu中的标准)设置默认为auto
,如’ffmpeg-all’手册页的这一部分所示:
threads integer (decoding/encoding,video) Set the number of threads to be used, in case the selected codec implementation supports multi-threading. Possible values: auto, 0 automatically select the number of threads to set Default value is auto.
注意2重点:
- 仅当所选编解码器支持multithreading时,此设置才有效
- 可以为各个流设置线程计数,而不是简单地尝试全局线程设置
如果您正在对大量文件进行音频转码,请查看使用GNU Parallel。 它将把一个文件列表作为输入,并根据系统中的核心数并行处理它们。 例如,这是一个bash示例,它将使用ffmpeg将音乐并行转换为opus音频格式。
find ./* -depth -type f -name \*.ogg -o -name \*.flac -o -name \*.m4a -o -name \*.mp3 -o -name \*.ogg | parallel -j+0 --gnu nice -n 19 ffmpeg -i "{}" -acodec libopus "{.}.opus" -loglevel quiet