Ffmpeg 使用 cuvid 将视频文件与硬件加速连接起来
Ffmpeg concatenate video file with hw acceleration using cuvid
我正在尝试使用 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
当我删除命令 运行s 的 hwaccel 标记时,我得到了巨大的 CPU 负载。我如何将 concat complex_filter 与 cuvid 硬件加速结合使用?
解决方案
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
解决方案
concat demuxing 成功了。编码器的输出现在是 h264。我将文件分组为 list.txt:
文件'/path/to/file1'
文件'/path/to/file2'
文件'/path/to/file3'
然后 运行 ffmpeg:
ffmpeg -y -f concat -safe 0 -i list.txt -c copy result.mp4
我正在尝试使用 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
当我删除命令 运行s 的 hwaccel 标记时,我得到了巨大的 CPU 负载。我如何将 concat complex_filter 与 cuvid 硬件加速结合使用?
解决方案
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
解决方案
concat demuxing 成功了。编码器的输出现在是 h264。我将文件分组为 list.txt:
文件'/path/to/file1' 文件'/path/to/file2' 文件'/path/to/file3' 然后 运行 ffmpeg:
ffmpeg -y -f concat -safe 0 -i list.txt -c copy result.mp4