The adaptive resolution code-transferring method of cbr (constant bit rate)
Technical field
The present invention relates to MultiMedia Field, particularly audio/video multimedia field.
Background technology
In current video code conversion, set cbr (constant bit rate) to control bandwidth and flow, after code check is fixing, the resolution of corresponding transcoding video has also been fixed simultaneously, and this is current more general way.
But this way exists a problem to be exactly: different video content is in same code check coding situation, and the fixed resolution of setting may not be the resolution of the optimum definition of this video under this code check.
Such as some picture variation is less or picture lines are simply educated speech and cartoon class video, very low code check (such as for 250Kbps/H.264) also can show very high resolution content (such as 1920x1080), if what these videos were not also added identification is encoded into general fixed video resolution (such as being all 512x288) under low code check, the experience that brings so user certainly will be than (in the enough situations of subscriber set ability) far short of what is expected of high resolution and frame per second.
Prior art is to the fixed resolution that obtains and the irrelevant distribution of the content of video own after constant bit rate, has ignored the impact of video content on encoding efficiency itself.Technology of the present invention is relatively selected optimum transcoding resolution without the effect of coding convergent-divergent having introduced video code conversion effect and video, different video contents can obtain different code distinguishabilities, to improve definition, and the code check of transcoding is constant, does not need to increase extra bandwidth cost.
Summary of the invention
For the defect existing in prior art, the present invention analyzes the best transcoding resolution of transcoding video under certain cbr (constant bit rate) by the error that relatively Y-PSNR of transcoding video and the scaling video of this video are introduced, and this resolution information is applied to transcoding.
According to the solution of the present invention, the video that needs transcoding for each, analyzes the best transcoding resolution in the situation that of fixing transcoding code check and transcoding instrument and compression parameters.
Specific implementation step is as follows:
1. set the target bit rate of transcoding video, experience resolution, concrete transcoding instrument and transcoding parameter;
2. set the analytical sampling time of resolution adjustment scope and video, resolution adjustment intensity lamda; Also can above-mentioned parameter not set, the default value of resolution adjustment scope is arbitrary value, and the default value of analytical sampling time is whole video, and the default value of resolution adjustment intensity lamda is 1;
3. according to transcoding instrument and the parameter set, sample time and experience resolution, encode, and obtains its Y-PSNR P1 simultaneously;
4. according to the sample time, video source is narrowed down to experience resolution and obtain video 1, video source is narrowed down to comparison resolution and obtain video 2, the wide geometric ratio of height that described relatively resolution is experience resolution is amplified 0.25 times;
5. video 1 is stretched to the resolution identical with video 2 and obtains video 3, calculate the Y-PSNR P2 of 3 pairs of videos 2 of video;
6. calculate adjustable range DR=lamda * 2^ (0.25 * (P1-P2));
7. if, DR>1, the target resolution that geometric ratio regulates video to the DR of experience resolution doubly, if this value surpasses the original resolution of video, is adjusted to original resolution; Otherwise target resolution keeps experience resolution.
Beneficial effect: technical solution of the present invention, in the situation that not increasing bandwidth traffic, promotes the definition of quite a few video.
Embodiment
Below the technical scheme in the embodiment of the present invention is clearly and completely described, obviously, described embodiment is only the present invention's part embodiment, rather than whole embodiment.Embodiment based in the present invention, those of ordinary skills, not making the every other embodiment obtaining under creative work prerequisite, belong to the scope of protection of the invention.
Embodiment mono-
Picture changes definite method of the optimum transcoding resolution of less educational training class video.
Main performing step following (video source resolution is 1920 * 1080):
The 1.1 transcoding code checks of setting SD version (smooth version) are 250Kbps, (transcoding fixing with resolution is identical, and every pair of video flowing carries out single pass, is called a pass with corresponding transcoding parameter for transcoding instrument X264, if there are a plurality of pass, have corresponding many group parameters);
1.2 setting resolution adjustment scopes are 512x288~1280x720, and the analytical sampling time is whole video, resolution adjustment intensity lamda=1;
1.3 according to the parameter of 1pass coding (if only coding once, with regard to the parameter with this time) this video of transcoding when coding is made as 512x288, exports the Y-PSNR P1=50.3 when 512x288 resolution encoding simultaneously;
1.4 by video source without compression narrow down to 512x288, obtain video V1; The 640x360 that narrows down to by video source without compression, obtains video V2; V1 resolution is stretched to 640x360, obtains video V3; Calculate V3 simultaneously the signal to noise ratio P2=41.5(of V2 is realized by add corresponding function in Open-Source Tools ffmpeg, convergent-divergent algorithm is used the most frequently used bicubic interpolation algorithm);
1.5 calculating DR=2^ (0.25 * (50.3-41.5))=4.59>1, so will amplify resolution;
1.6 calculate target resolution, and wide is 512x4.59=2350, and height is 288 * 4.59=1322; Due to 2350 * 1322>1280 * 720, so target resolution is 1280 * 720, just with this resolution, carry out transcoding afterwards.
Embodiment bis-
Picture changes definite method (video source resolution is 1280 * 720) of the optimum transcoding resolution of more sports cast:
The 1.1 transcoding code checks of setting SD version (smooth version) are 250Kbps, transcoding instrument X264 and corresponding transcoding parameter (transcoding fixing with resolution is identical, if a plurality of pass has corresponding many group parameters);
1.2 setting resolution adjustment scopes are 512x288~1280x720, and the analytical sampling time is whole video, resolution adjustment intensity lamda=1;
1.3 according to the parameter of 1pass coding (if only coding once, with regard to the parameter with this time) this video of transcoding when coding is made as 512x288, exports the Y-PSNR P1=31.5 when 512x288 resolution encoding simultaneously;
1.4 by video source without compression narrow down to 512x288, obtain video V1; The 640x360 that narrows down to by video source without compression, obtains video V2; V1 resolution is stretched to 640x360, obtains video V3; Calculate V3 realizes by add corresponding function in Open-Source Tools ffmpeg the signal to noise ratio P2=40.2(of V2 simultaneously);
1.5 calculating DR=2^ (0.25 * (31.5-40.2))=0.22<1, so do not need to amplify resolution;
1.6 keep the resolution of 512x288 to carry out transcoding.
The above; be only the present invention's embodiment preferably, but protection scope of the present invention is not limited to this, is anyly familiar with those skilled in the art in technical scope disclosed by the invention; the variation that can expect easily or replacement, within all should being encompassed in protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claim.