0

I made formula for screenrecording via FFmpeg, and it works with Counter-Strike and Dota 2. But it doesn't work with World of Tanks. So I faced with troubles. World of Tanks crashs after few minutes. And speed of recording is less then 1x (about 0.87x and it become slower and slower). So I think that I need to raise up the priority process of FFmpeg. Look for test of it on my Youtube Channel: my test of ffmpeg screen recording

So I would like to set 'High' or 'Realtime' priority for this process automatically!

But right now I can do it via 2 ways:

  1. via Task Manager;
  2. via second PowerShell Window and second "copy-paste".

But both methods require a time (5-20 seconds). It is no good. I cannot to set Start-Process ffmpeg -NoNewWindow -Wait -ArgumentList for setting PriorityClass as here stackoverflow because my ArgumentList of FFmpeg is too huge. And I cannot start-process pwsh -ArgumentList for new powershell window for setting PriorityClass. It write me about an error. My tested formula for Youtube:

ffmpeg -hide_banner -loglevel +repeat+level+info `
-f dshow -thread_queue_size 8192 -audio_buffer_size 100 -rtbufsize 2147M `
-i 'audio=@device_sw_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\{8E146464-DB61-4309-AFA1-3578E927E935}' `
-f dshow -thread_queue_size 8192 -audio_buffer_size 100 -rtbufsize 2147M `
-i 'audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{472DBE92-04B3-48AB-A937-ED4CD6A85625}' `
-f gdigrab -hwaccel_device cuda -hwaccel cuda -hwaccel_output_format cuda -video_size 1920:1080 -thread_queue_size 8192 -draw_mouse 1 -show_region 0 -offset_x 0 -offset_y 0 -rtbufsize 2147M -probesize 500M -analyzeduration 500M -framerate 60 -i desktop `
-noautoscale -shortest `
-map '0:a:0' -c:a copy -f wav "FFmpeg_Screen_Recording_$(get-date -f yyyy-MM-dd_HH-mm-ss).wav" `
-map '1:a:0' -c:a copy -f wav "FFmpeg_WebCAM_Recording_$(get-date -f yyyy-MM-dd_HH-mm-ss).wav" `
-map '2:v:0' -c:v h264_nvenc -gpu 0 -vsync 1 -r 60 -video_size 1920x1080 -video_track_timescale 60 -copytb 0 -delay 0 -rc constqp -qp 0 -rc-lookahead 0 -zerolatency 1 -maxrate:v 512M -bufsize:v 512M -pix_fmt yuv444p -profile:v high444p -preset p1 -tune ull -level 6.2 -coder vlc -weighted_pred 0 `
-f mov "FFmpeg_Screen_Recording_$(get-date -f yyyy-MM-dd_HH-mm-ss).mov"

My current formula for High priority - first tab:

start-process pwsh -ArgumentList '-noexit' 
Get-Process -name 'pwsh' | foreach { $_.PriorityClass = "High" }
$startExe = ffmpeg -hide_banner -loglevel +repeat+level+info `
-f dshow -thread_queue_size 8192 -audio_buffer_size 100 -rtbufsize 2147M `
-i 'audio=@device_sw_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\{8E146464-DB61-4309-AFA1-3578E927E935}' `
-f dshow -thread_queue_size 8192 -audio_buffer_size 100 -rtbufsize 2147M `
-i 'audio=@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{472DBE92-04B3-48AB-A937-ED4CD6A85625}' `
-f gdigrab -hwaccel_device cuda -hwaccel cuda -hwaccel_output_format cuda -video_size 1920:1080 -thread_queue_size 8192 -draw_mouse 1 -show_region 0 -offset_x 0 -offset_y 0 -rtbufsize 2147M -probesize 500M -analyzeduration 500M -framerate 60 -i desktop `
-noautoscale -shortest `
-map '0:a:0' -c:a copy -f wav "FFmpeg_Screen_Recording_$(get-date -f yyyy-MM-dd_HH-mm-ss).wav" `
-map '1:a:0' -c:a copy -f wav "FFmpeg_WebCAM_Recording_$(get-date -f yyyy-MM-dd_HH-mm-ss).wav" `
-map '2:v:0' -c:v h264_nvenc -gpu 0 -vsync 1 -r 60 -video_size 1920x1080 -video_track_timescale 60 -copytb 0 -delay 0 -rc constqp -qp 0 -rc-lookahead 0 -zerolatency 1 -maxrate:v 512M -bufsize:v 512M -pix_fmt yuv444p -profile:v high444p -preset p1 -tune ull -level 6.2 -coder vlc -weighted_pred 0 `
-f mov "FFmpeg_Screen_Recording_$(get-date -f yyyy-MM-dd_HH-mm-ss).mov"

Second tab (second copy-paste action):

Get-Process -name 'ffmpeg' | foreach { $_.PriorityClass = "High" }

How can I do it in the only one action?

Andrew
  • 11
  • If I use a lot of " and a lot of , as I got in one anser, it don't work too. `[error] Could not find audio only device with name ... among source devices of type audio.` `I/O error` `InvalidOperation: $(get-date -f yyyy-MM-dd_HH-mm-ss) The property 'PriorityClass' cannot be found on this object. Verify that the property exists and can be set` I just copy-pasted, and it don't work. – Andrew Apr 25 '21 at 19:07
  • Look for screenshot https://ibb.co/GktfnFJ – Andrew Apr 25 '21 at 19:19
  • At screenshot above you can see, that here are 2 problems 1) system cannot see my Sennheiser GSP 550 but see `virtual-audio-capturer` 2) system cannot understand that `$(get-date -f yyyy-MM-dd_HH-mm-ss)` is not applicable for `PriorityClass` – Andrew Apr 25 '21 at 19:29
  • Look for my first-ever formula in my Question https://ibb.co/3WfMyMR – Andrew Apr 25 '21 at 19:59
  • Later I modified formula: https://ibb.co/FzZqXwk But I need to use 2 PowerShell tabs in any way for stetting process priority of ffmpeg – Andrew Apr 25 '21 at 21:37
  • My later FFMPEG formula https://justpaste.it/1q1w7 – Andrew Apr 25 '21 at 22:10

0 Answers0