I need to execute ffmpeg process from windows service and capture it's standard output. It works fine until I use hardware acceleration. Because accessing DirectX from windows service is restricted, the subprocess also fails to access it.
When I'm executing the same code from console application, everything works OK, but the same code executed from windows service fails to use hardware acceleration.
string ffmpegArgs = /*-hwaccel dxva2 */"-threads 0 -probesize 100512 -i c:/Temp/test.mp4 -vf yadif -vcodec libx264 -preset ultrafast -tune zerolatency -profile baseline -x264-params keyint=20:min-keyint=20:scenecut=-1 -acodec aac -b:a 48k -flags +cgop -f mp4 -movflags empty_moov+default_base_moof+frag_keyframe c:/temp/output.avi";
var psi = new ProcessStartInfo
{
FileName = "c:/Temp/ffmpeg4/ffmpeg.exe",
Arguments = ffmpegArgs,
WorkingDirectory = "c:/Temp/ffmpeg4",
CreateNoWindow = false,
WindowStyle = ProcessWindowStyle.Hidden,
RedirectStandardInput = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
UseShellExecute = false
};
var processVideo = new Process { StartInfo = psi }.Start();
I need somehow break the inherited restrictions to be able to execute ffmpeg with hardware acceleration (access DirectX API). Any suggestions?