CPC H04N 19/14 (2014.11) [H04N 19/105 (2014.11); H04N 19/159 (2014.11); H04N 19/172 (2014.11)] | 14 Claims |
1. A method for coding a video, the method comprising:
determining an initial video frame structure based on a preset threshold for a B-frame number;
in response to determining that the initial video frame structure meets a preset condition, shortening the initial video frame structure to obtain a candidate video frame structure set, wherein shortening the initial video frame structure to obtain the candidate video frame structure set comprises:
determining at least one value of a shortened B-frame number based on at least one preset shortening ratio and the preset threshold for the B-frame number;
determining at least one video frame structure based on the at least one value of the shortened B-frame number; and
determining, based on the at least one video frame structure, the candidate video frame structure set, wherein determining the candidate video frame structure set comprises: replacing a non-reference B frame located at a middle of a sequence of non-reference B frames in a video frame structure of the at least one video frame structure with a Bref frame, to obtain a candidate video frame structure, the Bref frame being a B-frame used as a reference frame;
determining a target video frame structure from the candidate video frame structure set; and
performing video coding on video frames in a to-be-coded video frame sequence according to the target video frame structure.
|