Use PotPlayer to check the CPU and GPU usage when soft and hard decoding 4K HD videos

Table of contents

1. Problem description

2. Introduction to PotPlayer player

3. Soft and hard interpretation of video

4. Use PotPlayer to check the CPU usage during soft and hard decoding of 4K HD video

4.1. CPU and GPU usage when using soft solution

4.2. CPU and GPU usage when using hard solution

5. Finally


Summary of the development of common functions of VC++ (list of column articles, welcome to subscribe, continuous updates...)icon-default.png?t=N7T8https://blog.csdn.net/chenlycly/article/details/124272585 C++ software anomaly troubleshooting series of tutorials from entry to mastery (list of column articles, welcome to subscribe, continuous updates...)icon-default.png?t=N7T8https://blog.csdn. net/chenlycly/article/details/125529931C++ software analysis tools from entry to mastery case collection (column article, continuously updated...)icon-default.png?t=N7T8https: //blog.csdn.net/chenlycly/article/details/131405795C/C++ basics and advanced (column article, continuously updated...)icon-default.png?t=N7T8https://blog.csdn.net/chenlycly/category_11931267.htmlOpen source components and database technology (column article, continuously updated...)icon-default.png?t=N7T8 https://blog.csdn.net/chenlycly/category_12458859.html       Recently, our software encountered a problem of insufficient efficiency when hard decoding and playing 4K resolution high-definition videos. In order to understand the reason, We need to use other audio and video software to do a comparison test to test the CPU and GPU capabilities of the current PC. We chose the video player software PotPlayer to see the resource usage of the player when decoding 4K high-definition videos softly and hard. Here is an overview of the test process for reference.

1. Problem description

       During the test, we found that our software would make errors when hard decoding and playing the 4K high-definition video transmitted from the remote end, and then automatically switch to soft decoding. After switching to soft decoding, the efficiency obviously could not keep up, and the video had obvious lags. (The decoding speed is very slow, resulting in obvious delays in video playback).

       In order to roughly figure out this decoding problem, we need to find an audio and video software to compare and test the CPU and GPU usage when decoding and playing 4K resolution videos to see if the current CPU and GPU performance can meet the current requirements. Decoding requirements. Currently our software only involves video decoding and playback, not video encoding, so we just need to find a video player.

       We have used PotPlayer video player before. It is very powerful and supports switching between soft and hard decoding. You can view detailed decoding statistics, which is very useful for audio and video developers. So I downloaded a 4K resolution test video online and used PotPlayer to play the video to see how it occupies the CPU and GPU.


        Here, I would like to recommend my two popular and best-selling columns:

Column 1: (This column has nearly 350 subscriptions, has strong practical reference value, and is widely praised!)

C++ software anomaly troubleshooting series of tutorials from entry to mastery (list of column articles, welcome to subscribe, continuous updates...)icon-default.png?t=N7T8https://blog.csdn.net/chenlycly/ article/details/125529931

Based on the project practice of C++ software exception troubleshooting in recent years, this column systematically summarizes the common causes of C++ software exceptions and common ideas and methods for troubleshooting C++ software exceptions. It also details the debugging methods and methods of C++ software. The method gives specific examples of practical problem analysis in the form of pictures and texts, leading everyone to gradually master the related technologies of C++ software debugging and exception troubleshooting, which is suitable for basic introduction. Level and related C++ developers who want to improve their technology!

The articles in the column are all summarized through actual project operations (a large amount of anomaly troubleshooting materials and cases have been accumulated through actual project operations), and have strong practical reference value! The column articles are still being updated, and the number of articles is expected to be updated to more than 200!

专栏2: 

C/C++ Basics and Advanced (column articles, continuously updated...)icon-default.png?t=N7T8https://blog.csdn.net/chenlycly/category_11931267.html

Based on many years of practical development, this book summarizes and explains some basic and advanced content of C/C++, and expands and elaborates on relevant knowledge points in detail with pictures and texts! The column covers many aspects of the C/C++ field, and also gives common written interview questions in C/C++ and networking, and details commonly used debugging methods and techniques in Visual Studio!

专栏3: 

Open source components and database technologyicon-default.png?t=N7T8https://blog.csdn.net/chenlycly/category_12458859.html

Based on years of practical development, we share some open source components and database technologies!


2. Introduction to PotPlayer player

       Many friends who are engaged in audio and video development should have heard of or used the PotPlayer player.

        PotPlayer is a versatile video player from South Korea. It is a new generation work after Mr. Jiang Yongxi (South Korea), the original producer of KMPlayer, entered Daum Company. It not only inherits KMPlayer's filters and management system, but Daum also implements DXVA hardware decoding (DXVA's full name is DirectX Video Acceleration, video hardware acceleration) and multi-threaded decoding functions that KMPlayer has not implemented, allowing PotPlayer to play more smoothly. HD movies.

The full name of DXVA is DirectX Video Acceleration, video hardware acceleration. DXVA is a video acceleration specification specially customized by Microsoft. It has two versions, namely DXVA 1.0 and DXVA 2.0. The DXVA specification is not only a decoding calculation specification during video playback, it is also closely related to video post-processing, such as deinterlacing, color space conversion or image scaling, etc. What has the greatest impact on CPU utilization during video playback, and is usually what we are most concerned about, is video decoding, especially HD video decoding (hardware decoding). For systems with weak CPUs, it is best to let the graphics card complete the decoding. the best choice.

       Potplayer supports most video formats in a relatively small size. Ordinary users can play video files in mainstream formats without installing a third-party decoder, and supports the playback of BD and MKV large video files. The Potplayer program calls modified FFmpeg and MP3Lame open source codecs and follows their LGPL open source license agreement.

PotPlayer is a player that was completely rewritten in C++ by Jiang Yongxi, the original author of KMPlayer, after he switched to Daum Company. PotPlayer basically inherits KMPlayer's convenient filters and plug-in management system. The main interface of PotPlayer is relatively simple, and PotPlayer has a powerful built-in decoder, which makes the playback very stable. PotPlayer is compatible with special effects subtitles and online search subtitles for real-time translation.

The advantage of PotPlayer lies in its powerful built-in decoder; while the advantage of KMPlayer lies in its powerful customization capabilities and personalization functions. PotPlayer is written in VC++ and KMPlayer is written in Delphi. The copyright of PotPlayer belongs to Daum Company and was not originally created by Mr. Jiang Longxi. It is currently being subsequently developed by Jiang Longxi, the original author of KMPlayer.

The current KMPlayer (version 1428 and later) is collectively developed by the PandoraTV team. At the request of PandoraTV, PotPlayer will not add some popular features in KMPlayer, but Jiang Longxi promised to add some similar features to PotPlayer.

3. Soft and hard interpretation of video

       Video decoding and playback mainly involves two operations. First, decode the video (the video data is compressed), and then play the video. Video decoding consumes more CPU or GPU resources.

       Video decoding is to decode the video compressed by the encoding algorithm. It is divided into soft decoding and hard decoding. Soft decoding uses the CPU for decoding (using the computing power of the CPU), and hard decoding uses the GPU for hardware decoding. The hardware decoding is The efficiency is higher.

If the software terminal needs to send the images collected by the local camera to the server, it needs to encode the images from the camera collector. Compared with decoding, encoding consumes more CPU (soft decoding uses CPU) or GPU (hardware decoding). Solution uses GPU) resources.

       For high-resolution 4K videos, to ensure decoding efficiency and less delay, we give priority to hard decoding, and then switch to soft decoding when hard decoding fails. However, soft decoding of 4K high-definition videos will occupy a lot of CPU resources. The pressure on the CPU will be much greater.

In addition to decoding, the CPU, as the main control chip of the machine, also needs to run other software and handle other transactions. If the system CPU usage is too high, it will cause obvious system lags.

When using hard decoding, it mainly occupies GPU resources, which can effectively share the pressure of the CPU in processing data and effectively reduce the CPU usage, thus not affecting the operation of other software in the current system.

4. Use PotPlayer to check the CPU usage during soft and hard decoding of 4K HD video

       After opening the video in PotPlayer, you can click the SW-Software/HW-Hardware button in the toolbar at the bottom of the main window to switch between software and hardware, as shown below:

Then you can right-click the video area, click the properties menu item in the pop-up right-click menu, and view the decoder type currently used for decoding in the properties window that opens.

4.1. CPU and GPU usage when using soft solution

       When opening a video with PotPlayer, the soft decoder is used by default. Right-click the video area, click Properties in the pop-up right-click menu, and see that the decoder type used is AVC1-built-in FFmpeg decoder (h264, Thread Frame), as follows Show:

You can also see the current decoding frame rate in the picture above. When accelerating video playback (playing at several times the speed), the player will automatically increase the decoding frame rate. You can test it yourself.

       Open the Windows Task Manager and check the CPU and GPU usage at this time, as shown below:

As can be seen from the figure, the current CPU usage is about 36%, GPU 3D usage is about 48%, and Video Decode and Video Processing usage are both 0. The occupation of these three parts is explained as follows: (Note that the video playback here actually contains two parts, video decoding and video playback, which must be distinguished)

1) 3D (video playback): Hardware acceleration should be used when drawing videos, such as using D3D drawing.
2) Video Decode (video hard decoding): : Hard decode the encoded and compressed video data.
3) Video Processing (video hard decoding): : Perform scaling and other operations on the hard decoded video.

Because the soft solution currently used does not use the hard solution, the proportions of Video Decode and Video Processing are both 0.

4.2. CPU and GPU usage when using hard solution

       Click the SW-Software/HW-Hardware button in the toolbar below the video window to switch the current decoding mode from soft decoding to hard decoding. The decoder type used is: AVC1 - Native D3D9 DXVA Decoder(VLD) - Intel(R) UHD Graphics 630, as shown below:

Then we go to task management to take a look at the changing trends of CPU and GPU usage, as shown below:

       First, the CPU usage is reduced to 16%. Because the hard solution mainly uses GPU hard solution, the CPU usage is reduced. Then we see that Video Decode and Video Processing are immediately occupied. Video Decode is mainly used for hard decoding of video data, and Video Processing is mainly used for scaling processing after hard decoding.

       Then we saw two obvious changes. One is that the 3D occupancy ratio has decreased, and the other is that the shared GPU memory has increased from 0.5GB to 0.9GB. The explanation is as follows:

1) Reasons for 3D degradation: Mainly because hardware acceleration is used when drawing videos, so 3D hardware acceleration resources are occupied. Because it was soft decoding before, the decoded video data stored in the memory needs to be copied to the GPU for rendering and display. This copying process consumes 3D space. Currently, we have switched to hard decoding. Hard decoding of video data is processed directly in the GPU. The decoded video data is directly drawn using the GPU, eliminating the need to copy the video data, so the 3D usage is reduced.
2) The GPU shared memory has increased. : The video data hard-decoded using the GPU must be stored in the GPU shared memory, so the GPU shared memory has increased. About 0.4 GB.

Using GPU resources to do video hard decoding effectively shares the pressure on the CPU to process data and effectively reduces CPU usage. When processing large-resolution video data, it is recommended to use hard decoding first.

5. Finally

       This article mainly demonstrates how to use the PotPlayer video player to observe the CPU and GPU usage during soft and hard video decoding for reference.

Guess you like

Origin blog.csdn.net/chenlycly/article/details/134637464