Ffmpeg使用cuvid将视频文件与硬件加速连接起来
我正在尝试使用Nvidia硬件加速来实现使用cuvid的FFmpeg。我想使用复杂过滤器合并多个h264/mp4文件(简化示例): 我使用以下版本的FFmpeg和Ubuntu 16.04:Ffmpeg使用cuvid将视频文件与硬件加速连接起来,ffmpeg,video-processing,Ffmpeg,Video Processing,我正在尝试使用Nvidia硬件加速来实现使用cuvid的FFmpeg。我想使用复杂过滤器合并多个h264/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 如果运行该命令,则会出现以下错误
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负载。如何结合cuvid硬件加速使用concat complex_过滤器
解决方案
康考特的分辩成功了。编码器的输出现在为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
解决方案
康考特的分辩成功了。编码器的输出现在为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
ffmpeg-y-f concat-safe 0-i list.txt-c copy result.mp4直接的解决方案是预先转换像素格式[0:v:0]格式=yuv420p[v];[v] [0:a]concat=n=1:v=1:a=1
。但是在这种情况下,concat需要什么呢?我用一个文件简化了示例,只是为了使命令尽可能简单。如果我定义格式,我会得到相同的错误:fmpeg-hwaccel cuvid-c:v h264_cuvid-i input.ts-y-fflags+genpts-filter_complex“[0:v:0]format=yuv420p[v];[v][0:a:0]concat=n=1:v=1:a=1[outv][outa]“-map”[outv]“-map”[outa]”output.mp4无法在筛选器“graph 0 input from stream 0:0”和筛选器“auto_scaler_0”重新初始化筛选器时出错所支持的格式之间转换!无法将帧注入筛选器网络:功能不可用implemented@Gyan我想使用cuvid硬件加速将多个文件连接到一个mp4中。目前,这只有在我移除hwaccel标志时才有效,但它不使用GPU,并且我得到了大量的CPU峰值。concat过滤器在任何情况下都不会使用GPU。您可以通过使用硬件编码器来加快运算速度。并放弃硬件解码。感谢您的宝贵反馈。我将尝试通过我们的调谐器(录制实况电视)将视频输出为h264,并使用ffmpeg concat解复用器代替filter_复杂解决方案。