FFMpegCore icon indicating copy to clipboard operation
FFMpegCore copied to clipboard

HardwareAcceleration CUDA

Open YamielVargas opened this issue 3 years ago • 0 comments

Hello, I want to perform a transcoding with HardwareAcceleration (Nvidia GPU), I tested with FFmpeg direct commands in CMD, and it works perfectly, now I am integrating .NetFramework with FFmpegCore, I have achieved good results with "HardwareAccelerationDevice.D3D11VA" but now we need to do it with CUDA, but the hardware acceleration devices don't give me this option, I tried with CUVID believing that it is the same as CUDA but I can't get it to work.

      `FFMpegArguments
            .FromFileInput(fileS, true, options => options
                .WithHardwareAcceleration(HardwareAccelerationDevice.CUVID))
            .OutputToFile(fileT + "." + format.ToLower(), true, options => options
                .WithDuration(mediaInfo.Duration)
                .UsingMultithreading(true)
                //.WithVideoCodec(VideoCodec.LibX264)
                .WithVideoCodec("h264_nvenc")
                .WithAudioCodec(AudioCodec.Aac)
                .WithVideoBitrate(150)
                .WithVideoFilters(filterOptions => filterOptions
                    //CITY
                    .DrawText(DrawTextOptions
                        .Create("CDMX", "/Windows/Fonts/Arial.ttf")
                        .WithParameter("fontcolor", "white")
                        .WithParameter("fontsize", "70")
                        .WithParameter("box", "1")
                        .WithParameter("boxcolor", "[email protected]")
                        .WithParameter("boxborderw", "5")
                        .WithParameter("x", "0")
                        .WithParameter("y", "0"))
                .Resize(340, 260)
                .WithFramerate(15)
                .UsingThreads(6)
                .WithFastStart())
            .NotifyOnProgress(OnPercentageProgess, mediaInfo.Duration)
            .NotifyOnProgress(OnTimeProgess)
            .ProcessSynchronously();`

This is the answer of Attempt with CUVID, anyway, CUVID and CUDA are not the same

image

image

image

This the comand in CMD with -hwaccel cuda

image

YamielVargas avatar Aug 05 '22 21:08 YamielVargas