Video Coding technology is an important part of NetEase video cloud technology, here to provide everyone to learn, welcome to NetEase Video Cloud with the discussion of technical exchanges.
First, Overview
Video coding includes separating, decoding, encoding, synthesizing four parts, in the separation and decoding, the synthesis part can be considered a lossless operation, and the commonly used encoding such as H264, MPEG-4, etc. (except lossless compression) is a lossy compression.
To improve the quality of the video encoding, we tried to add a preprocessing before the encoder data input to compensate for the loss of brightness and chroma during the encoding process. This improves the clarity of the video.
Second, preprocessing methods
By changing the brightness, contrast, saturation (chroma) of the video, the sharpness of the edge is changed so that the sharpness of the video is increased. sharpening produces noise, thereby increasing the denoising filter. At present, only by adjusting brightness and contrast to increase edge sharpening, saturation is not adjusted. Because the saturation adjustment will introduce some new problems, such as the generation of color blocks, color distortion.
2.1 ffmpeg Pre-treatment: Increase brightness
Ffmpeg-i E:\music\1\1.mov-vcodec libx264-profile baseline-level 3.1-preset slow-b 2400k-maxrate 6000k-bufsize 900 0K-VF "scale=-1:720,unsharp=luma_msize_x=7:luma_msize_y=7:luma_amount=1.5"-threads 12-nr 6-an-y-F mp4 E:\music\1\ou T_2400k_sharpen.mp4
2.2 AVS the preprocessing
AVS by increasing the sharpening filter, adjust the saturation and contrast before encoding pre-processing.
Directshowsource ("E:\music\1\1.mov"). Lanczosresize (1280,720). Sharpen (0.2)
2.3 mencoder Pre-treatment: Increases brightness and contrast
Mencoder.exe-sws 9-OAC mp3lame-vf SCALE=1280:720,UNSHARP=L7X7:1.5,EQ=1:15-OVC X264-FFOURCC h264-x264encopts bit Rate=2400:turbo=2:frameref=6:me=umh:me_range=16 E:\music\1\1.mov-o E:\music\1\mencoder_out_1_4.avi
Third, Effect comparison
The sequence of the screen display is chip source, ffmpeg encoding, mencoder encoding.
3.1 Comparison Chart 1
The edges of ffmpeg and mencoder are sharper when compared with the chip source.
3.2 Comparison Chart 2
MEncoder increase the contrast of the picture color more full, closer to the chip source.
3.2 Comparison Chart 3
The mencoder increases the contrast more prominently than the FFmpeg details. The picture is more clear.
Four, Conclusion
1): By preprocessing the YUV data, it can increase the video sharpness and improve the video quality under the same bit rate. But it also causes a decrease in the encoding speed, about 30% less.
2): Through the comparison of three kinds of tools, the encoding quality of mencoder pretreatment is higher than that of ffmpeg, the color loss is smaller, the color is more full. But the coding speed is nearly 50% lower than ffmpeg.
3): For high-definition chip source, at the premise of equalization encoding speed and encoding quality, we recommend using FFmpeg for sharpening and denoising. If you do not care about the encoding speed, it is recommended to increase the mencoder contrast processing.
Sharpening is not recommended for low-quality chip sources.
Video preprocessing technology of NetEase video cloud technology