ffmpeg: “Impossible to convert between the formats” when using Cuda hardware acceleration









up vote
0
down vote

favorite












I'm using ffmpeg from the command line on Windows 10 and I wanted to gave Cuda a try to improve execution times. A simple cut command like this works fine and its execution time is reduced by 60-70%. Awesome.



ffmpeg -hwaccel cuvid -c:v h264_cuvid -ss 00:00:10 -i in.mp4 -c:v h264_nvenc out.mp4


Now I tried to use the -filter_complex flag to overlay, fade and translate a png image over a video. The working non-cuda enhanced command is this one:



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


Then, I added the cuda-related flags to the command like this.



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


But it won't work. I get this error.



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


I don't even know what it means. Can I actually run ANY ffmpeg command on the GPU with Cuda? I've found some information about the hwupload_cuda flag but I'm not sure if I should use it and how. My attempts have failed so far.
Any advice on how I should modify the command to make it work on the GPU?
Thanks.










share|improve this question





















  • The overlay filter is s/w so decoded frames from the GPU have to be transferred to system RAM first and then after overlay sent back to GPU for h/w encoding.
    – Gyan
    Nov 12 at 8:57










  • Thanks, how do I move frames to and from the system RAM? Do I need to use hwdownload and hwupload_cuda?
    – MorenoGentili
    Nov 12 at 10:23














up vote
0
down vote

favorite












I'm using ffmpeg from the command line on Windows 10 and I wanted to gave Cuda a try to improve execution times. A simple cut command like this works fine and its execution time is reduced by 60-70%. Awesome.



ffmpeg -hwaccel cuvid -c:v h264_cuvid -ss 00:00:10 -i in.mp4 -c:v h264_nvenc out.mp4


Now I tried to use the -filter_complex flag to overlay, fade and translate a png image over a video. The working non-cuda enhanced command is this one:



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


Then, I added the cuda-related flags to the command like this.



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


But it won't work. I get this error.



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


I don't even know what it means. Can I actually run ANY ffmpeg command on the GPU with Cuda? I've found some information about the hwupload_cuda flag but I'm not sure if I should use it and how. My attempts have failed so far.
Any advice on how I should modify the command to make it work on the GPU?
Thanks.










share|improve this question





















  • The overlay filter is s/w so decoded frames from the GPU have to be transferred to system RAM first and then after overlay sent back to GPU for h/w encoding.
    – Gyan
    Nov 12 at 8:57










  • Thanks, how do I move frames to and from the system RAM? Do I need to use hwdownload and hwupload_cuda?
    – MorenoGentili
    Nov 12 at 10:23












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm using ffmpeg from the command line on Windows 10 and I wanted to gave Cuda a try to improve execution times. A simple cut command like this works fine and its execution time is reduced by 60-70%. Awesome.



ffmpeg -hwaccel cuvid -c:v h264_cuvid -ss 00:00:10 -i in.mp4 -c:v h264_nvenc out.mp4


Now I tried to use the -filter_complex flag to overlay, fade and translate a png image over a video. The working non-cuda enhanced command is this one:



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


Then, I added the cuda-related flags to the command like this.



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


But it won't work. I get this error.



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


I don't even know what it means. Can I actually run ANY ffmpeg command on the GPU with Cuda? I've found some information about the hwupload_cuda flag but I'm not sure if I should use it and how. My attempts have failed so far.
Any advice on how I should modify the command to make it work on the GPU?
Thanks.










share|improve this question













I'm using ffmpeg from the command line on Windows 10 and I wanted to gave Cuda a try to improve execution times. A simple cut command like this works fine and its execution time is reduced by 60-70%. Awesome.



ffmpeg -hwaccel cuvid -c:v h264_cuvid -ss 00:00:10 -i in.mp4 -c:v h264_nvenc out.mp4


Now I tried to use the -filter_complex flag to overlay, fade and translate a png image over a video. The working non-cuda enhanced command is this one:



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


Then, I added the cuda-related flags to the command like this.



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


But it won't work. I get this error.



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


I don't even know what it means. Can I actually run ANY ffmpeg command on the GPU with Cuda? I've found some information about the hwupload_cuda flag but I'm not sure if I should use it and how. My attempts have failed so far.
Any advice on how I should modify the command to make it work on the GPU?
Thanks.







ffmpeg






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 at 22:31









MorenoGentili

322




322











  • The overlay filter is s/w so decoded frames from the GPU have to be transferred to system RAM first and then after overlay sent back to GPU for h/w encoding.
    – Gyan
    Nov 12 at 8:57










  • Thanks, how do I move frames to and from the system RAM? Do I need to use hwdownload and hwupload_cuda?
    – MorenoGentili
    Nov 12 at 10:23
















  • The overlay filter is s/w so decoded frames from the GPU have to be transferred to system RAM first and then after overlay sent back to GPU for h/w encoding.
    – Gyan
    Nov 12 at 8:57










  • Thanks, how do I move frames to and from the system RAM? Do I need to use hwdownload and hwupload_cuda?
    – MorenoGentili
    Nov 12 at 10:23















The overlay filter is s/w so decoded frames from the GPU have to be transferred to system RAM first and then after overlay sent back to GPU for h/w encoding.
– Gyan
Nov 12 at 8:57




The overlay filter is s/w so decoded frames from the GPU have to be transferred to system RAM first and then after overlay sent back to GPU for h/w encoding.
– Gyan
Nov 12 at 8:57












Thanks, how do I move frames to and from the system RAM? Do I need to use hwdownload and hwupload_cuda?
– MorenoGentili
Nov 12 at 10:23




Thanks, how do I move frames to and from the system RAM? Do I need to use hwdownload and hwupload_cuda?
– MorenoGentili
Nov 12 at 10:23

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253908%2fffmpeg-impossible-to-convert-between-the-formats-when-using-cuda-hardware-acc%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253908%2fffmpeg-impossible-to-convert-between-the-formats-when-using-cuda-hardware-acc%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

政党

天津地下鉄3号線