我正在使用Windows 10命令行中的ffmpeg,想尝试使用GPU加速来提高执行时间。像这样的简单剪切命令运行良好,其执行时间减少了60-70%。太棒了。
ffmpeg -hwaccel cuvid -c:v h264_cuvid -ss 00:00:10 -i in.mp4 -c:v h264_nvenc out.mp4
现在我尝试使用-filter_complex标志来叠加、淡入淡出和平移一张png图片到一个视频上。这是非GPU增强命令的工作原理:
ffmpeg -i in.mp4 -loop 1 -t 75 -i overlay.png -filter_complex "[1:v]fade=t=in:st=30:d=0.3:alpha=1,fade=t=out:st=35.7:d=0.3:alpha=1[png1];[0:v][png1]overlay=x='if(gte(t,30), (t-30)*10, NAN)'" -movflags +faststart out.mp4
然后,我像这样将与GPU相关的标志添加到命令中。
ffmpeg -hwaccel cuvid -c:v h264_cuvid -i in.mp4 -loop 1 -t 75 -i overlay.png -filter_complex "[1:v]fade=t=in:st=30:d=0.3:alpha=1,fade=t=out:st=35.7:d=0.3:alpha=1[png1];[0:v][png1]overlay=x='if(gte(t,30), 60-tanh((t-30)*30/5)*60, NAN)'" -movflags +faststart -c:v h264_nvenc out.mp4
但是它不能工作。我收到了这个错误。
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
我甚至不知道它的含义。我是否可以在GPU上使用GPU加速来运行任何ffmpeg命令?我找到了一些关于hwupload_cuda标志的信息,但我不确定该如何使用它。我的尝试目前都失败了。
你有什么建议可以修改命令,让它在GPU上运行?