FFMPEG视频从图像到nvidia GPU中的mp4

时间:2019-08-16 13:34:30

标签: ffmpeg nvenc cuvid

我正在尝试使用1070ti nvidia cuda功率对从.jpg图像创建的h264 .mp4视频进行编码,每个图像之间都有交叉淡入淡出过渡。 我可以使用标志-c:v h264_nvenc在GPU中渲染视频,我看到GPU编码中出现了一个短暂的峰值,但是随着计算机CPU长时间的高负载,我想准备了过渡图像。但是由于-filter_complex的原因,它在cpu / ram上进行图像准备的过程很慢。 这有效:

ffmpeg.exe, -y, 
-loop, 1, -t, 2.5, -i, 1565957420594_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565957453659_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565957487743_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565957525280_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565957587308_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565957644898_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565957859119_labeled.jpg, 
-loop, 1, -t, 2.5, -i,1565959133561_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565959412948_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565959501884_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565959755432_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565959882380_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565960023185_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565960157174_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565960683303_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565961151548_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565961230278_labeled.jpg, 
-loop, 1, -t, 2.5, -i, 1565961671766_labeled.jpg, 
-loop, 1, -t, 2.5, -i, final.jpg, 
-loop, 1, -t, 2.5, -i, final.jpg, 
-c:v, h264_nvenc, -preset, fast, 
-filter_complex, [1]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+0.5/TB[f0];
[2]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+1.0/TB[f1];
[3]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+1.5/TB[f2];
[4]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+2.0/TB[f3];
[5]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+2.5/TB[f4];
[6]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+3.0/TB[f5];
[7]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+3.5/TB[f6];
[8]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+4.0/TB[f7];
[9]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+4.5/TB[f8];
[10]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+5.0/TB[f9];
[11]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+5.5/TB[f10];
[12]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+6.0/TB[f11];
[13]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+6.5/TB[f12];
[14]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+7.0/TB[f13];
[15]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+7.5/TB[f14];
[16]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+8.0/TB[f15];
[17]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+8.5/TB[f16];
[18]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+9.0/TB[f17];
[19]fade=d=0.5:t=in:alpha=1,setpts=PTS-STARTPTS+9.5/TB[f18];
[0][f0]overlay[bg1];
[bg1][f1]overlay[bg2];
[bg2][f2]overlay[bg3];
[bg3][f3]overlay[bg4];
[bg4][f4]overlay[bg5];
[bg5][f5]overlay[bg6];
[bg6][f6]overlay[bg7];
[bg7][f7]overlay[bg8];
[bg8][f8]overlay[bg9];
[bg9][f9]overlay[bg10];
[bg10][f10]overlay[bg11];
[bg11][f11]overlay[bg12];
[bg12][f12]overlay[bg13];
[bg13][f13]overlay[bg14];
[bg14][f14]overlay[bg15];
[bg15][f15]overlay[bg16];
[bg16][f16]overlay[bg17];
[bg17][f17]overlay[bg18];
[bg18][f18]overlay[v], 
-map, [v], -movflags, +faststart, output.mp4

我正在尝试在GPU中完成所有工作,从理论上讲,我可以在每个-i中使用标志“ -hwaccel cuvid -c:v mjpeg_cuvid”对GPU内存中的所有图像进行编码,我收到以下错误消息:

[mjpeg_cuvid @ 00000000024ef980] ignoring invalid SAR: 0/0
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 1: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

有没有一种方法可以在应用了“ fade”标志的情况下在GPU中加载图像?

谢谢!

0 个答案:

没有答案