
What is video encoding?

I suppose I will not be wrong to say that this is a rather delicate and complex process, fraught with many difficulties and problems.

Well, first of all, you need to understand clearly enough for yourself that the video encoding process, in any scenario of the main and accompanying factors, always leads to an overall decrease in the quality of the video stream. But the whole question and all the excitement, so to speak, is how much will we lose in quality and whether our loss will be proportional to the size of the resulting video file. In general, we try to repackage the video in such a way that with a slight decrease in quality, we get a visible gain in size.
Now let’s move on to more “mundane” things … “It is known for sure” 🙂 that any video sequence is a sequence of images that alternate at a certain speed, the so-called FrameRate (frame rate). Each image has a set of certain parameters such as: frame size (FrameSize), color depth, brightness, contrast, etc. All these parameters are very important and leave a serious mark on the final video. Unfortunately, video quality is a subjective factor in our perception of this or that video stream, for each person the line between acceptable quality and disgusting “screen” is different. In this regard, I would like to point out that although the quality of video material is an important benchmark in the world of encoding, it unfortunately does not have strictly regulated characteristics.
Now in a nutshell, directly about the process itself …
As an example, let’s take the well-known and fairly easy-to-use DrDivX program. Let’s start our debriefing with the terminology …
AC3
Also known as Dolby Digital from Dolby LabsTM. It can support up to 5.1 channels of audio.
AVI
Audio Video Interlacing – Audio Video Interlacing (joining them together) – This is a video and video format commonly used on Windows operating system computers. This format is defined as a kind of combination of audio and video data, without specifying any specific codec.
B-frames / bidirectional encoding
There are three types of frames that are possible in a DivX video stream. These frames are called I-frames (intra), P-frames (predicted), and B-frames (bidirectional). Before the release of the DivX 5.0 codec, only I and P-frames were used. I-frames are encoded using information only from the encoded frame itself and do not use information from other frames (time compression). I-frames are based on conventional single-frame compression to the JPEG format. P (predicted) frames predict next frames and can also refer to I or P frames, that is, E. P frames are encoded using information from previous frames. In any video sequence, there will always be a group of frames, many of which will be the same and will contain the same image. For example, if you are watching news, and you pay attention to any moving character, you may notice that for several frames the background behind him almost always remains unchanged. (Remember that normally the frames are rotated at 25 or 30 frames per second). So instead of encoding each frame in JPEG format independently, you can take advantage of the redundancy of previous frames by applying P-frames. Basically, P-frames are future frames, defining how a block from a previous frame has been moved. at the current P-frame. So instead of spatially encoding the frame, the P-frame just says “Hey block, in the frame above, move to point (X, Y)”. This time encoding algorithm requires much less data than the spatial encoding of each frame. Basically we are passing the difference between adjacent frames, which is more efficient,



