Menu Close

How to record the screen in 4K

Skip to main content
You are here:
Print

How to record the screen in 4K

To record a 4K screen at a correct frame rate, encode the video on the GPU: either natively, with the GPU encoders of Windows, or with the optional Datastead Multipurpose Encoder.

Frame rate: when FrameRate is not set (0), a screen area of 4K or more is recorded at 10 fps. Set FrameRate to the frame rate to record, e.g. VideoGrabber.FrameRate = 30.

1. Recording through the GPU encoders of Windows

With MainDemo.exe:

  • “video source” tab: select “screen recording”, enter 30 in the “Frame rate” box and click “ok”,
  • “recording” tab: select “H264 (Auto)” (or “H264 GPU (Nvidia)”, “H264 GPU (Intel)”) as video compressor, select “mp4” and click “start recording”.

Programmatically:

VideoGrabber.VideoSource = vs_ScreenRecording;
VideoGrabber.FrameRate = 30;
VideoGrabber.VideoCompressor = VideoGrabber.VideoCompressorIndex ("H264 (Auto)"); // best H.264 encoder, GPU first, or e.g. "H264 GPU (Nvidia)", "H264 GPU (Intel)"
VideoGrabber.CompressionMode = cm_CompressOnTheFly;
VideoGrabber.RecordingMethod = rm_MP4;
VideoGrabber.StartRecording();

The bit rate and the other encoder settings are adjusted by invoking VideoGrabber.ShowDialog (dlg_VideoCompressor) after selecting the encoder, see How to record a video source to mp4.

2. Recording through the Datastead Multipurpose Encoder

(this requires the Datastead Multipurpose Encoder: run the .exe installer included in its package, it is then used automatically by TVideoGrabber)

With MainDemo.exe:

  • “video source” tab: select “screen recording”, enter 30 in the “Frame rate” box and click “ok”,
  • “Multipurpose Encoder” tab: enter h264 as video codec name, 6000 as bit rate and select the GPU in the “GPU/HWAccel” list,
  • “recording” tab: select “mp4” and click “start recording”.

Programmatically:

VideoGrabber.VideoSource = vs_ScreenRecording;
VideoGrabber.FrameRate = 30;
VideoGrabber.VideoCompressor = VideoGrabber.VideoCompressorIndex ("Datastead Multipurpose Encoder");
VideoGrabber.Encoder_SetInt (0, Enc_Video_GPU_Encoder, integer (Enc_GPU_NVidia_NVENC)); // (*)
VideoGrabber.Encoder_SetStr (0, Enc_Video_Codec, "h264");
VideoGrabber.Encoder_SetInt (0, Enc_Video_Bitrate_kb, 6000);
VideoGrabber.CompressionMode = cm_CompressOnTheFly;
VideoGrabber.RecordingMethod = rm_MP4;
VideoGrabber.StartRecording();

(*) NVIDIA GPU; Intel GPU: Enc_GPU_Intel_QSV; AMD GPU: Enc_GPU_AMD_AMF; GPU selected automatically: Enc_GPU_Auto

If frames are dropped, lower the frame rate (FrameRate) or the recorded size (ScreenRecordingSizePercent, e.g. 50 to record a 3840×2160 screen in 1920×1080).

Table of Contents