Patent attributes
A method and an apparatus for transcoding are disclosed. The method includes obtaining an initial resolution of a media file; determining a first definition level and a second definition level corresponding to the media file; determining a first resolution corresponding to the first definition level and a second resolution corresponding to the second definition level; pre-coding the media file using a first preset rule to obtain a first pre-coding rate corresponding to the first definition level and a second pre-coding rate corresponding to the second definition level based on the first resolution and the second resolution; adjusting the first resolution and the second resolution if the first pre-coding rate is greater than the preset coding threshold; and transcoding the media file using the first preset rule based on the adjusted first resolution and the adjusted second resolution.