Skip to content

4K and 8K playback

The TVideoGrabber player plays 4K video clips up to 120 fps and 8K video clips up to 60 fps, with text and image overlays and frame capture.

No specific setting is required. By default, for the clips of 3840 columns or 2160 lines and more:

  • the video is decoded by the GPU,
  • the frames stay in NV12, the output format of the GPU decoders, from the decoder to the video window: no conversion to RGB (an 8K frame takes 49.8 MB in NV12, 132.7 MB in RGB32).

GPU decoding

With PlayerHwAccel = hw_Auto (default setting), the clips are opened by the built-in Media Foundation source of TVideoGrabber and decoded on the GPU through Direct3D 11. On a PC with several GPUs, a GPU able to decode the video stream is selected automatically.

Video codecs decoded on the GPU (the GPU must have a hardware decoder for the codec, e.g. AV1: recent GPUs only):

  • H.264: decoder of Windows,
  • HEVC (H.265): requires the Microsoft HEVC Video Extensions (Microsoft Store),
  • AV1: Microsoft AV1 Video Extension when installed, otherwise the built-in Datastead AV1 GPU decoder (AV1 Main 8 bit 4:2:0; the 10-bit clips require the AV1 Video Extension or the LAV Filters),
  • VP9: Microsoft VP9 Video Extensions when installed, otherwise the built-in Datastead VP9 GPU decoder (profile 0, 8 bit 4:2:0).

The video codec in use and the GPU that decodes it are returned by PlayerVideoCodec, e.g. "HEVC (Nvidia GPU)", "H264 (Intel GPU)" or "HEVC (CPU)".

When the LAV Filters are installed

The LAV Filters open the clips first and, with PlayerHwAccel = hw_Auto, decode them on the CPU. To decode the 4K / 8K clips on the GPU, set PlayerForcedCodec = "MF" before invoking OpenPlayer: the local clips are then opened first by the built-in Media Foundation source.

VideoGrabber.PlayerForcedCodec = "MF"
VideoGrabber.PlayerFileName = "c:\videos\clip_8k60.mp4"
VideoGrabber.OpenPlayer()

Frame rate

The maximum frame rate depends on the GPU (hardware decoder), on the bit rate of the clip, and also on the CPU and the memory bandwidth of the PC.

It is lower when the frames are converted to RGB (FrameGrabberRGBFormat = fgf_RGB32, or features that need RGB frames, see below), and when the video is decoded by the CPU (no GPU decoder for the codec, or LAV Filters with PlayerHwAccel = hw_Auto).

OnFrameBitmap, OnFrameOverlayUsingDC and OnFrameOverlayUsingDIB not raised

With FrameGrabberRGBFormat = fgf_Default (default setting), the frame grabber keeps the frames of the 4K / 8K clips in NV12. The OnFrameBitmap, OnFrameOverlayUsingDC and OnFrameOverlayUsingDIB events, which pass RGB bitmaps, are then not raised.

When one of these events is assigned before invoking OpenPlayer, a warning is reported by OnLog, e.g.:

OnFrameBitmap not raised: 4K / 8K video played in NV12 (FrameGrabberRGBFormat = fgf_Default). To receive these events, set FrameGrabberRGBFormat = fgf_RGB32 before opening the video.

To receive these events with the 4K / 8K clips, set FrameGrabberRGBFormat = fgf_RGB32 before invoking OpenPlayer:

VideoGrabber.FrameGrabberRGBFormat = fgf_RGB32
VideoGrabber.PlayerFileName = "c:\videos\clip_4k.mp4"
VideoGrabber.OpenPlayer()

The frames are then converted to RGB32: the maximum frame rate is lower (8K at 60 fps is generally out of reach), and the time spent in these events adds to the processing time of each frame.

Other settings:

  • FrameGrabberRGBFormat = fgf_NV12: frames kept in NV12 whatever the video size, in preview and playback (RGB32 when NV12 is not possible, see below); these 3 events are not raised.
  • FrameGrabberCurrentRGBFormat returns fgf_NV12 while the frames are kept in NV12.

What works with the NV12 frames

Features that keep the frames in RGB

The frames of the 4K / 8K clips are converted to RGB32, as for the smaller videos, and the events above are raised, when:

Enable these features before invoking OpenPlayer: when one of them is enabled during the playback, OnLog reports "reopen the player to apply the changes (... needs the RGB frames, the frame grabber is in NV12)".

When the video renderer (EVR, VMR9, VMR7) does not accept the NV12 frames (e.g. Microsoft Basic Display Adapter, virtual machine, Remote Desktop session), the RecordingPriority renderer is used instead.

Text overlays on 4K / 8K videos

  • The font size and the positions of a text overlay are given in pixels of the video: the same font size looks 4 times smaller on an 8K video than on a 1080p video. Enable SetTextOverlay_Proportional to give them for a 1080-line video, scaled to the height of the video.
  • A text that does not change is rendered once, then blended into each frame. A text whose variables change on every frame (%frame_count%, %time_full%, %time_100ns%...) is drawn again on every frame, which costs several ms per 8K frame: prefer a fixed text, or variables that change once per second (e.g. %sys_time[hh:nn:ss]%).
VideoGrabber.SetTextOverlay_String (0, "Camera 1")
VideoGrabber.SetTextOverlay_FontSize (0, 24)
VideoGrabber.SetTextOverlay_Proportional (0, true)
VideoGrabber.SetTextOverlay_Enabled (0, true)
VideoGrabber.PlayerFileName = "c:\videos\clip_8k60.mp4"
VideoGrabber.OpenPlayer()

See Text overlays.