Ffmpeg使用cuvid

时间:2018-05-15 11:58:46

标签: ffmpeg video-processing

我正在尝试使用cuvid对FFmpeg使用Nvidia硬件加速。我想使用复杂的过滤器(简化示例)合并多个h264 / mp4文件:

ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input.ts -y -fflags +genpts -filter_complex "[0:v:0][0:a:0]concat=n=1:v=1:a=1[outv][outa]" -map "[outv]" -map "[outa]" output.mp4

我使用以下版本FFmpeg和Ubuntu 16.04:

version 3.4.2-1~16.04.york0.2 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609

如果我运行该命令,我会收到以下错误:

Impossible to convert between the formats supported by the filter 'Parsed_concat_0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented

当我删除hwaccel标志时,该命令运行但我得到了大量的CPU负载。如何将concat complex_filter与cuvid hw加速结合使用?

concat demuxing工作了。编码器的输出现在为h264。我将文件分组到list.txt

file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'

然后运行ffmpeg:

ffmpeg -y -f concat -safe 0 -i list.txt -c copy result.mp4

1 个答案:

答案 0 :(得分:0)

concat demuxing工作了。编码器的输出现在为h264。我将文件分组到list.txt:

file' / path / to / file1' file' / path / to / file2' file' / path / to / file3' 然后运行ffmpeg:

ffmpeg -y -f concat -safe 0 -i list.txt -c copy result.mp4