TW201828696A - Transcoding method and device capable of guaranteeing that the media document can be played smoothly and clearly - Google Patents

Transcoding method and device capable of guaranteeing that the media document can be played smoothly and clearly Download PDF

Info

Publication number
TW201828696A
TW201828696A TW106102479A TW106102479A TW201828696A TW 201828696 A TW201828696 A TW 201828696A TW 106102479 A TW106102479 A TW 106102479A TW 106102479 A TW106102479 A TW 106102479A TW 201828696 A TW201828696 A TW 201828696A
Authority
TW
Taiwan
Prior art keywords
resolution
bit rate
preset
media file
definition
Prior art date
Application number
TW106102479A
Other languages
Chinese (zh)
Inventor
江文斐
孟辰
裴銀祥
Original Assignee
阿里巴巴集團服務有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 阿里巴巴集團服務有限公司 filed Critical 阿里巴巴集團服務有限公司
Priority to TW106102479A priority Critical patent/TW201828696A/en
Publication of TW201828696A publication Critical patent/TW201828696A/en

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The embodiment of the present invention discloses a transcoding method and device. The method comprises: obtaining an initial resolution of a media document; confirming a first clearness gear position and a second clearness gear position corresponding to the media document; confirming a first resolution corresponding to the first clearness gear position, and a second resolution corresponding to the second clearness gear position; using a first preset rule to proceed with precoding based on the first resolution and the second resolution, so as to obtain a first precoding bit rate corresponding to the first clearness gear rate, and a second precoding bit rate corresponding to the second clearness gear rate; if the first precoding bit rate is greater than a preset bit rate threshold, adjusting the first resolution and the second resolution; and using the first preset rule to proceed with transcoding on the media document based on the adjusted first resolution and second resolution. With the transcoding method and device provided in the embodiment of the present invention, it is able to guarantee that the media document can be played smoothly and clearly.

Description

轉碼方法及裝置  Transcoding method and device  

本發明關於資訊處理技術領域,特別關於一種轉碼方法及裝置。 The present invention relates to the field of information processing technologies, and in particular, to a transcoding method and apparatus.

隨著行動通訊技術的不斷發展,網路存取速度的飛速提升,行動終端的越趨智慧化,以及數位壓縮技術的日益優化,行動終端已從簡單的通訊、聯絡工具,發展成為一個多媒體智慧平臺。行動串流媒體是行動通訊和串流媒體傳輸的結合,藉由行動網路在行動終端上採用串流媒體技術進行資料傳輸,為使用者提供包括視頻點播、行動視頻聊天、行動視頻監控等服務。 With the continuous development of mobile communication technology, the rapid increase of network access speed, the more intelligent mobile terminals, and the increasingly optimized digital compression technology, mobile terminals have evolved from simple communication and communication tools to a multimedia wisdom. platform. Mobile streaming media is a combination of mobile communication and streaming media transmission. The mobile network uses streaming media technology to transmit data on mobile terminals, providing users with services including video on demand, mobile video chat, and motion video surveillance. .

轉碼是將高清的超大媒體文件(例如視頻文件)壓縮成適合在某些網路場景下(如光纖網路、WIFI網路、3G網路等)、某些終端上(如電視、PC、手機、PAD等)播放的文件/串流的過程。通常媒體文件案壓縮得越小,就越適合在頻寬受限的環境下傳輸,但是媒體文件的顯示畫質也可能越差。 Transcoding is to compress high-definition large media files (such as video files) into suitable network scenarios (such as fiber-optic network, WIFI network, 3G network, etc.) and some terminals (such as TV, PC, The process of file/streaming played by mobile phones, PADs, etc.). Generally, the smaller the media file is compressed, the more suitable it is to transmit in a bandwidth-limited environment, but the display quality of the media file may be worse.

現有的轉碼方法通常包括:預先設置好不同清晰度對 應的轉碼參數,例如清晰度可以包括:流暢、標清、高清和超清四種,可以分別設置所述四種清晰度對應的解析度和上限位元率。根據預先設置的解析度和媒體文件的內容,即時計算所述媒體文件的瞬間位元率,當瞬間位元率大於所述解析度對應的上限位元率時,為了防止媒體文件出現卡頓的現象,可以利用所述上限位元率代替當前的瞬間位元率,以保證媒體文件可以流暢地播放。 The existing transcoding method generally includes: setting transcoding parameters corresponding to different definitions in advance, for example, the definition may include: smooth, standard definition, high definition, and ultra clear, and the resolutions corresponding to the four definitions may be separately set. Degree and upper bit rate. Instantly calculating the instantaneous bit rate of the media file according to the preset resolution and the content of the media file, and preventing the media file from being stuck when the instantaneous bit rate is greater than the upper limit bit rate corresponding to the resolution Phenomenon, the upper limit bit rate can be used to replace the current instantaneous bit rate to ensure that the media file can be played smoothly.

在實現本發明過程中,發明人發現現有技術中至少存在如下問題:現有的轉碼方法中的位元率瞬間位元率是根據預先設置的解析度和媒體文件的內容計算得到的,在所述預先設置的解析度和位元率瞬間位元率兩個參數下,媒體文件的當前內容可以清晰地播放,當位元率瞬間位元率大於所述解析度對應的上限位元率時,採用所述上限位元率來進行轉碼,保證媒體文件播放流暢的情況下可能無法保證媒體文件的當前內容播放的清晰度。 In the process of implementing the present invention, the inventors have found that at least the following problems exist in the prior art: the bit rate instantaneous bit rate in the existing transcoding method is calculated according to the preset resolution and the content of the media file, Under the two parameters of the preset resolution and the bit rate instantaneous bit rate, the current content of the media file can be clearly played. When the bit rate instantaneous bit rate is greater than the upper limit bit rate corresponding to the resolution, The upper limit bit rate is used for transcoding, and the clarity of the current content playback of the media file may not be guaranteed if the media file is played smoothly.

本發明實施例的目的是提供一種轉碼方法及裝置,以保證媒體文件流暢且清晰地進行播放。 An object of the embodiments of the present invention is to provide a transcoding method and apparatus to ensure that media files are played smoothly and clearly.

為解決上述技術問題,本發明實施例提供一種轉碼方法及裝置是這樣實現的:一種轉碼方法,包括:獲取媒體文件的屬性資訊,所述屬性資訊包括初始解析度; 根據所述媒體文件的初始解析度、預設的多個清晰度檔位和各清晰度檔位對應的解析度範圍,確定所述媒體文件對應的第一清晰度檔位,將所述預設的多個清晰度檔位中的最低清晰度檔位的作為所述媒體文件對應的第二清晰度檔位;以所述媒體文件的初始解析度作為第一解析度,根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位,來確定在第二清晰度檔位對應的解析度範圍中具有相同排位的第二解析度;根據所述第一解析度和第二解析度,利用第一預設規則對所述媒體文件進行預編碼,得到第一清晰度檔位對應的第一預編碼位元率和第二清晰度檔位對應的第二預編碼位元率;若所述第一預編碼位元率大於第一清晰度檔位對應的預設位元率閾值,根據所述第一預編碼位元率和預設位元率閾值,調整所述第一清晰度檔位對應的第一解析度和第二清晰度檔位對應的第二解析度;基於所述調整後的第一解析度和調整後的第二解析度,利用第一預設規則對所述媒體文件進行轉碼。 In order to solve the above technical problem, an embodiment of the present invention provides a transcoding method and apparatus, which are implemented by: a transcoding method, comprising: acquiring attribute information of a media file, where the attribute information includes an initial resolution; The initial resolution, the preset plurality of resolution gears, and the resolution range corresponding to each of the resolution gears, determining a first definition gear position corresponding to the media file, and the preset plurality of resolutions a second definition gear position corresponding to the media file in the lowest definition gear position in the gear position; using the initial resolution of the media file as the first resolution, and the first resolution according to the first resolution Determining a rank in the resolution range corresponding to the gear position to determine a second resolution having the same rank in the resolution range corresponding to the second sharpness gear; according to the first resolution and the second resolution And precoding the media file by using a first preset rule, to obtain a first precoding bit rate corresponding to the first definition gear position and a second precoding bit rate corresponding to the second definition gear position; If the first precoding bit rate is greater than a preset bit rate threshold corresponding to the first definition bit position, adjusting the first clear according to the first precoding bit rate and the preset bit rate threshold a first resolution corresponding to the degree gear and a second resolution corresponding to the second definition gear; and based on the adjusted first resolution and the adjusted second resolution, using the first preset rule The media file is transcoded.

一種轉碼裝置,包括:媒體文件獲取模組、清晰度檔位確定模組、解析度確定模組、預編碼位元率確定模組、解析度調整模組和轉碼模組;其中,所述媒體文件獲取模組,用於獲取媒體文件的屬性資訊,所述屬性資訊包括初始解析度; 所述清晰度檔位確定模組,用於根據所述媒體文件的初始解析度、預設的多個清晰度檔位及各清晰度檔位對應的解析度範圍,確定所述媒體文件對應的第一清晰度檔位,將所述預設的多個清晰度檔位中的最低清晰度檔位作為所述媒體文件對應的第二清晰度檔位;所述解析度確定模組,用於以所述媒體文件的初始解析度作為第一解析度,根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位,來確定在第二清晰度檔位對應的解析度範圍中具有相同排位的第二解析度;所述預編碼位元率確定模組,用於根據所述第一解析度和第二解析度,利用第一預設規則對所述媒體文件進行預編碼,得到第一清晰度檔位對應的第一預編碼位元率和第二清晰度檔位對應的第二預編碼位元率;所述解析度調整模組,用於當第一預編碼位元率大於第一清晰度檔位對應的預設位元率閾值時,根據所述第一預編碼位元率和預設位元率閾值,調整所述第一清晰度檔位對應的第一解析度和第二清晰度檔位對應的第二解析度;所述轉碼模組,用於基於所述解析度調整模組調整後的第一解析度和調整後的第二解析度,利用第一預設規則對所述媒體文件進行轉碼。 A transcoding device includes: a media file acquisition module, a definition gear position determination module, a resolution determination module, a precoding bit rate determination module, a resolution adjustment module, and a transcoding module; a media file obtaining module, configured to obtain attribute information of a media file, where the attribute information includes an initial resolution; the definition gear position determining module is configured to be based on an initial resolution of the media file, and a preset Determining a range of resolutions corresponding to the plurality of definition gears and the resolution points corresponding to the respective resolution gears, determining a first definition gear position corresponding to the media file, and setting a minimum resolution file among the preset plurality of resolution gear positions a second resolution gear corresponding to the media file; the resolution determining module is configured to use the initial resolution of the media file as a first resolution, and the first resolution according to the first resolution Determining a rank in the resolution range corresponding to the sharpness scale to determine a second resolution having the same rank in the resolution range corresponding to the second sharpness scale; the precoding bit rate determining module, Used according to the The first resolution and the second resolution are used to pre-code the media file by using a first preset rule to obtain a first pre-coding bit rate corresponding to the first sharpness level and a second-definition position corresponding to the second resolution a second pre-coding bit rate; the resolution adjusting module, configured to: when the first pre-encoding bit rate is greater than a preset bit rate threshold corresponding to the first sharpness level, according to the first pre-coding a bit rate and a preset bit rate threshold, adjusting a first resolution corresponding to the first definition gear and a second resolution corresponding to the second definition gear; the transcoding module is configured to The adjusted first adjustment degree and the adjusted second resolution of the resolution adjustment module, and the media file is transcoded by using the first preset rule.

由以上本發明實施例提供的技術方案可見,本發明實施例提供的一種轉碼方法及裝置,可以根據媒體文件的初始解析度來確定不同清晰度檔位的解析度,基於所述確定 的解析度,對所述媒體文件進行預編碼,當所述預編碼位元率大於預設的位元率閾值時,可能導致所述媒體文件不能流暢播放,此時根據所述預編碼位元率和預設位元率閾值來調整各清晰度對應的解析度,再根據調整後的解析度來對所述媒體文件進行轉碼,可以保證所述媒體文件流暢且清晰地播放。 According to the technical solution provided by the embodiment of the present invention, the method and device for transcoding according to the embodiment of the present invention can determine the resolution of different resolution files according to the initial resolution of the media file, and the analysis is based on the determination. And precoding the media file, when the precoding bit rate is greater than a preset bit rate threshold, the media file may not be played smoothly, according to the precoding bit rate and The preset bit rate threshold is used to adjust the resolution corresponding to each definition, and then the media file is transcoded according to the adjusted resolution, so that the media file can be played smoothly and clearly.

S101‧‧‧步驟 S101‧‧‧Steps

S102‧‧‧步驟 S102‧‧‧Steps

S103‧‧‧步驟 S103‧‧‧Steps

S104‧‧‧步驟 S104‧‧‧Steps

S105‧‧‧步驟 S105‧‧‧Steps

S106‧‧‧步驟 S106‧‧‧Steps

201‧‧‧媒體文件獲取模組 201‧‧‧Media File Acquisition Module

202‧‧‧清晰度檔位確定模組 202‧‧‧Shape gear determination module

203‧‧‧解析度確定模組 203‧‧‧resolution determination module

204‧‧‧預編碼位元率確定模組 204‧‧‧Pre-coded bit rate determination module

205‧‧‧解析度調整模組 205‧‧‧resolution adjustment module

206‧‧‧轉碼模組 206‧‧‧ Transcoding module

為了更清楚地說明本發明實施例或現有技術中的技術方案,下面將對實施例或現有技術描述中所需要使用的附圖作簡單地介紹,顯而易見地,下面描述中的附圖僅僅是本發明中記載的一些實施例,對於本領域普通技術人員來講,在不付出進步性勞動性的前提下,還可以根據這些附圖獲得其他的附圖。 In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are only Some of the embodiments described in the invention can be obtained by those skilled in the art from the drawings without further progressive labor.

圖1是本發明轉碼方法一個實施例的流程圖;圖2是本發明轉碼裝置的一個實施例的模組圖。 1 is a flow chart of an embodiment of a transcoding method of the present invention; and FIG. 2 is a block diagram of an embodiment of a transcoding device of the present invention.

本發明實施例提供一種轉碼方法及裝置。 Embodiments of the present invention provide a transcoding method and apparatus.

為了使本技術領域的人員更好地理解本發明中的技術方案,下面將結合本發明實施例中的附圖,對本發明實施例中的技術方案進行清楚、完整地描述,顯然,所描述的實施例僅僅是本發明一部分實施例,而不是全部的實施例。基於本發明中的實施例,本領域普通技術人員在沒有 作出創造性勞動前提下所獲得的所有其他實施例,都應當屬於本發明保護的範圍。 In order to make those skilled in the art better understand the technical solutions in the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. The embodiments are only a part of the embodiments of the invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of the present invention.

圖1是本發明轉碼方法一個實施例的流程圖。如圖1所示,所述轉碼方法可以包括: BRIEF DESCRIPTION OF THE DRAWINGS Figure 1 is a flow chart of one embodiment of a transcoding method of the present invention. As shown in FIG. 1, the transcoding method may include:

S101:獲取媒體文件的屬性資訊,所述屬性資訊包括初始解析度。 S101: Acquire attribute information of the media file, where the attribute information includes an initial resolution.

可以獲取媒體文件的屬性資訊。所述媒體文件可以是視頻文件。 You can get the attribute information of the media file. The media file can be a video file.

所述屬性資訊可以包括:初始解析度。所述屬性資訊還可以包括:所述媒體文件的初始位元率。 The attribute information may include: initial resolution. The attribute information may further include: an initial bit rate of the media file.

S102:根據所述媒體文件的初始解析度、預設的多個清晰度檔位及各清晰度檔位對應的解析度範圍,確定所述媒體文件對應的第一清晰度檔位,將所述預設的多個清晰度檔位中的最低清晰度檔位作為所述媒體文件對應的第二清晰度檔位。 S102: Determine, according to an initial resolution of the media file, a preset plurality of resolution gear positions, and a resolution range corresponding to each resolution gear position, determining a first definition gear position corresponding to the media file, The lowest definition gear position among the plurality of preset sharpness gear positions is used as the second sharpness gear position corresponding to the media file.

所述預設的多個清晰度檔位可以包括:4個清晰度檔位。所述4個清晰度檔位從最高清晰度到最低清晰度依次可以是:超清、高清、標清、流暢。上述各清晰度檔位對應的解析度範圍及解析度排位可以如表1所示。表1中每個清晰度檔位對應的解析度範圍中,可以包括至少3個解析度,其可以按解析度從大到小的順序依次進行排列。 The preset plurality of definition gear positions may include: 4 definition gear positions. The four sharpness positions from the highest definition to the lowest definition may be: ultra clear, high definition, standard definition, smooth. The resolution range and resolution ranking corresponding to the above resolution positions can be as shown in Table 1. In the resolution range corresponding to each resolution gear in Table 1, at least three resolutions may be included, which may be sequentially arranged in descending order of resolution.

根據表1所述的各清晰度檔位和其對應的解析度範圍及解析度排位可以確定所述媒體文件對應的第一清晰度檔位。所述第一清晰度檔位可以用於表示所述媒體文件可以達到的最高清晰度。 The first definition gear position corresponding to the media file may be determined according to each resolution gear position and its corresponding resolution range and resolution ranking according to Table 1. The first definition gear position can be used to indicate the highest resolution achievable by the media file.

所述媒體文件對應的第二清晰度檔位可以是所述預設的多個清晰度檔位中最低清晰度檔位。例如,若所述預設的多個清晰度檔位從最高清晰度到最低清晰度依次可以是:超清、高清、標清、流暢,那麼,所述第二清晰度檔位可以是“流暢”檔位。 The second definition gear position corresponding to the media file may be the lowest definition gear position among the preset plurality of definition gear positions. For example, if the preset plurality of sharpness positions from the highest definition to the lowest definition may be: ultra clear, high definition, standard definition, smooth, then the second definition position may be “smooth” "The gear.

所述第一清晰度檔位可以根據所述預設的各清晰度檔位對應的解析度範圍和所述媒體文件的初始解析度來確定,所述初始解析度所在的解析度範圍所對應的清晰度檔 位可以為第一清晰度檔位。例如,若所述媒體文件的初始解析度為1920×1080,那麼所述第一清晰度檔位可以為“超清”檔位;若所述媒體文件的初始解析度為848×480,那麼所述第一清晰度檔位可以為“標清”檔位。 The first resolution gear position may be determined according to a resolution range corresponding to each preset resolution gear position and an initial resolution of the media file, where the resolution range corresponding to the initial resolution is The sharpness gear can be the first sharpness gear. For example, if the initial resolution of the media file is 1920×1080, the first definition gear position may be “super clear” gear position; if the initial resolution of the media file is 848×480, then The first definition gear position may be a "standard definition" gear position.

S103:以所述媒體文件的初始解析度作為第一解析度,根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位,來確定在第二清晰度檔位對應的解析度範圍中具有相同排位的第二解析度。 S103: using the initial resolution of the media file as the first resolution, determining, according to the ranking of the first resolution in the resolution range corresponding to the first definition gear, in the second definition gear A second resolution having the same rank in the corresponding resolution range.

可以以所述媒體文件的初始解析度作為第一解析度。 The initial resolution of the media file may be taken as the first resolution.

所述第二清晰度檔位對應的第二解析度可以根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位來確定。具體地,所述第二解析度在第二清晰度檔位對應的解析度範圍中的排位與第一解析度在第一清晰度檔位對應的解析度範圍中的排位相同。例如,所述第一清晰度檔位為“高清”檔位,第二清晰度檔位為“流暢”檔位;第一解析度為1392×784,其處於“高清”檔位對應的解析度範圍的第一位,那麼,所述第二清晰度檔位對應的第二解析度可以為624×352,其位於“流暢”檔位對應的解析度範圍的第一位。 The second resolution corresponding to the second definition gear position may be determined according to the ranking of the first resolution in the resolution range corresponding to the first definition gear position. Specifically, the ranking of the second resolution in the resolution range corresponding to the second definition gear is the same as the ranking of the first resolution in the resolution range corresponding to the first definition gear. For example, the first definition gear position is a “high definition” gear position, and the second definition gear position is a “fluent” gear position; the first resolution is 1392×784, which is in a resolution corresponding to the “high definition” gear position. The first position of the range, then the second resolution corresponding to the second resolution gear may be 624×352, which is located at the first position of the resolution range corresponding to the “smooth” gear position.

S104:根據所述第一解析度和第二解析度,利用第一預設規則對所述媒體文件進行預編碼,得到第一清晰度檔位對應的第一預編碼位元率和第二清晰度檔位對應的第二預編碼位元率。 S104: Precoding the media file by using a first preset rule according to the first resolution and the second resolution, to obtain a first precoding bit rate and a second clearness corresponding to the first definition gear position. The second pre-coded bit rate corresponding to the degree gear.

根據所述第一解析度和第二解析度,利用第一預設規則可以對所述媒體文件進行預編碼,可以得到第一清晰度檔位對應的第一預編碼位元率和第二清晰度檔位對應的第二預編碼位元率。 According to the first resolution and the second resolution, the media file may be pre-coded by using a first preset rule, and the first pre-coding bit rate and the second clearness corresponding to the first definition gear position may be obtained. The second pre-coded bit rate corresponding to the degree gear.

所述第一預設規則可以包括:根據CRF(constant ratefactor,固定位元率係數)值或者固定QP(量化參數)值進行預編碼。例如,可以根據CRF=26或QP=29來對視頻進行編碼。通常情況下,CRF的值為18表示媒體文件品質基本為無損,CRF的值為19-21.5表示媒體文件品質為高品質,CRF的值為22-26表示媒體文件品質為中等品質。QP的取值範圍一般為0~51,值越大,表示媒體文件的品質越差,對於一般網際網路視頻文件,若QP>35,媒體文件的品質就很差了。因此,在較佳的實施方式中,所述CRF的取值範圍可以為19~26。在較佳的實施方式中,所述QP的取值範圍可以為0~35。 The first preset rule may include performing precoding according to a CRF (constant rate factor) value or a fixed QP (quantization parameter) value. For example, the video can be encoded according to CRF=26 or QP=29. In general, a value of CRF of 18 indicates that the quality of the media file is basically lossless. A value of CRF of 19-21.5 indicates that the quality of the media file is high quality, and a value of C-26 of 22-26 indicates that the quality of the media file is medium quality. The value range of QP is generally 0~51. The larger the value, the worse the quality of media files. For general Internet video files, if QP>35, the quality of media files is very poor. Therefore, in a preferred embodiment, the CRF may range from 19 to 26. In a preferred embodiment, the QP may range from 0 to 35.

在另一個實施方式中,所述利用第一預設規則對所述媒體文件進行預編碼還可以包括:抽取所述媒體文件的多個片段進行預編碼,對所述多個片段預編碼分別得到的位元率值求平均,將所述求得的平均值作為預編碼位元率。藉由對其中的多個片段進行預編碼,可以節約預編碼的時間,從而提高轉碼效率。 In another embodiment, the pre-coding the media file by using the first preset rule may further include: extracting a plurality of segments of the media file for precoding, and precoding the plurality of segments separately. The bit rate values are averaged, and the obtained average value is taken as a precoding bit rate. By precoding a plurality of segments, the precoding time can be saved, thereby improving the transcoding efficiency.

S105:若所述第一預編碼位元率大於第一清晰度檔位對應的預設位元率閾值,根據所述第一預編碼位元率和預設位元率閾值,調整所述第一清晰度檔位對應的第一解析 度和第二清晰度檔位對應的第二解析度。 S105: If the first precoding bit rate is greater than a preset bit rate threshold corresponding to the first definition bit position, adjusting the first according to the first precoding bit rate and the preset bit rate threshold The first resolution corresponding to the sharpness gear and the second resolution corresponding to the second sharpness.

可以判斷所述第一預編碼位元率是否大於第一清晰度檔位對應的預設位元率閾值。所述預設位元率閾值可以是所述媒體文件在第一解析度下能夠清晰播放的最大位元率值。若所述第一預編碼位元率大於所述預設位元率閾值,可以表示所述媒體文件在根據第一解析度進行轉碼時,媒體文件的內容不能流暢播放。 It may be determined whether the first precoding bit rate is greater than a preset bit rate threshold corresponding to the first definition bit position. The preset bit rate threshold may be a maximum bit rate value that the media file can clearly play at the first resolution. If the first pre-coding bit rate is greater than the preset bit rate threshold, it may be indicated that the content of the media file cannot be played smoothly when the media file is transcoded according to the first resolution.

若第一預編碼位元率大於第一清晰度檔位對應的預設位元率閾值,可以根據所述第一預編碼位元率和預設位元率閾值,調整所述第一清晰度檔位對應的第一解析度和第二清晰度檔位對應的第二解析度。具體可以包括:基於所述預設位元率閾值和預設係數,確定所述第一解析度和第二解析度的降低的幅度,根據所述降低的幅度確定調整後的第一解析度和第二解析度。 If the first precoding bit rate is greater than a preset bit rate threshold corresponding to the first definition bit position, the first definition may be adjusted according to the first precoding bit rate and the preset bit rate threshold The first resolution corresponding to the gear position and the second resolution corresponding to the second sharpness gear position. The method may include: determining, according to the preset bit rate threshold and the preset coefficient, a magnitude of the decrease of the first resolution and the second resolution, and determining the adjusted first resolution according to the reduced amplitude and Second resolution.

其中,基於所述預設位元率閾值和預設係數,確定所述第一解析度和第二解析度的降低的幅度,具體可以包括:判斷所述第一預編碼位元率是否大於或等於預設係數的2次方和所述預設位元率閾值的乘積,若是,所述第一解析度和第二解析度分別調整為在其對應的清晰度檔位中降低2個排位後的解析度值。所述預設係數的取值可以為大於1。較佳地,所述預設係數的取值可以為1.1~1.5。 The determining the magnitude of the decrease of the first resolution and the second resolution based on the preset bit rate threshold and the preset coefficient may specifically include: determining whether the first precoding bit rate is greater than or a product equal to a power of the second power of the preset coefficient and the preset bit rate threshold. If yes, the first resolution and the second resolution are respectively adjusted to be reduced by two ranks in the corresponding sharpness position. The resolution value after. The value of the preset coefficient may be greater than 1. Preferably, the preset coefficient may have a value of 1.1 to 1.5.

例如,假設第一解析度為1392×784,其處於“高清”檔位對應的解析度範圍的第一位,第二解析度為624×352,其位於“流暢”檔位對應的解析度範圍的第一 位。所述利用該第一解析度預編碼得到的第一預編碼位元率為BitRates,所述預設位元率閾值為MaxRate。經判斷,BitRates>MaxRate*scale*scale,其中scale為預設係數。那麼,可以確定所述第一解析度和第二解析度分別需要調整為在其對應的清晰度檔位中降低2個排位後的解析度值。那麼調整後的第一解析度和第二解析度分別可以是:1356×864和480×272。 For example, suppose the first resolution is 1392×784, which is in the first position of the resolution range corresponding to the “high-definition” gear position, and the second resolution is 624×352, which is located in the resolution range corresponding to the “smooth” gear position. First place. The first precoding bit rate obtained by the first resolution precoding is BitRates, and the preset bit rate threshold is MaxRate. It is judged that BitRates>MaxRate*scale*scale, where scale is the preset coefficient. Then, it can be determined that the first resolution and the second resolution respectively need to be adjusted to reduce the resolution value after the two ranks in the corresponding sharpness scale. Then, the adjusted first resolution and second resolution may be: 1356×864 and 480×272, respectively.

進一步地,若所述第一預編碼位元率小於預設係數的2次方和所述預設位元率閾值的乘積,可以進一步判斷所述第一編碼位元率是否大於或等於所述預設位元率閾值和預設係數的乘積,若是,所述第一解析度和第二解析度分別調整為在其對應的清晰度檔位中降低1個排位後的解析度值。 Further, if the first precoding bit rate is less than a product of the second power of the preset coefficient and the preset bit rate threshold, it may be further determined whether the first encoding bit rate is greater than or equal to the The product of the preset bit rate threshold and the preset coefficient, if yes, the first resolution and the second resolution are respectively adjusted to reduce the resolution value after one ranking in the corresponding sharpness position.

進一步地,若所述第一編碼位元率小於所述預設位元率閾值和預設係數的乘積,所述第一解析度和第二解析度可以不進行調整。 Further, if the first coding bit rate is less than a product of the preset bit rate threshold and the preset coefficient, the first resolution and the second resolution may not be adjusted.

在同一個清晰度檔位內調整解析度,可以保證媒體文件播放的清晰度不變。同時,藉由降低解析度,可以使得轉碼後的位元率值小於預設的位元率閾值,保證媒體文件能夠流暢播放。 Adjusting the resolution within the same sharpness position ensures that the resolution of the media file is unchanged. At the same time, by reducing the resolution, the bit rate value after transcoding can be made smaller than the preset bit rate threshold, and the media file can be played smoothly.

S106:基於所述調整後的第一解析度和調整後的第二解析度,利用第一預設規則對所述媒體文件進行轉碼。 S106: Transcode the media file by using the first preset rule based on the adjusted first resolution and the adjusted second resolution.

基於所述調整後的第一解析度和調整後的第二解析度,可以利用第一預設規則對所述媒體文件進行轉碼。根 據調整後的第一解析度和調整後的第二解析度來對媒體文件進行轉碼,可以保證所述媒體文件流暢且清晰地播放。 The media file may be transcoded by using the first preset rule based on the adjusted first resolution and the adjusted second resolution. Transcoding the media file according to the adjusted first resolution and the adjusted second resolution ensures that the media file is played smoothly and clearly.

在另一個實施方式中,若所述第一預編碼位元率小於或等於第一清晰度檔位的預設位元率閾值,可以表示根據第一解析度、第二解析度進行轉碼可以流暢且清晰地播放所述媒體文件,因此,可以基於所述第一解析度、第二解析度對所述媒體文件進行轉碼。 In another embodiment, if the first precoding bit rate is less than or equal to the preset bit rate threshold of the first sharpness position, it may be that the transcoding according to the first resolution and the second resolution may be performed. The media file is played smoothly and clearly, and therefore, the media file can be transcoded based on the first resolution and the second resolution.

在另一個實施方式中,當所述多個清晰度檔位為至少3個清晰度檔位且所述第一清晰度檔位為預設的多個清晰度檔位中清晰度最高的檔位時,所述方法還可以包括:確定所述第一清晰度檔位和第二清晰度檔位之間的至少一個中間清晰度檔位對應的中間解析度,基於第一解析度、第二解析度和所述中間解析度,利用第二預設演算法,計算與所述中間清晰度檔位對應的中間預編碼位元率。 In another embodiment, when the plurality of sharpness gears are at least 3 sharpness gears and the first sharpness gear is the highest sharpest gear among the plurality of preset sharpness gears The method may further include: determining an intermediate resolution corresponding to the at least one intermediate definition gear position between the first definition gear position and the second definition gear position, based on the first resolution, the second resolution And the intermediate resolution, using a second preset algorithm, calculating an intermediate precoding bit rate corresponding to the intermediate definition gear.

進一步地,當根據所述第一預編碼位元率和預設位元率閾值調整所述第一清晰度檔位對應的第一解析度和第二清晰度檔位對應的第二解析度時,可以調整所述中間清晰度檔位對應的中間解析度。相應地,可以基於所述調整後的第一解析度、調整後的第二解析度和調整後的中間解析度,利用第一預設規則對所述媒體文件進行轉碼。所述中間解析度的調整方法可以與第一解析度的調整方法相同,本發明在此不再贅述。 Further, when the first resolution corresponding to the first definition gear position and the second resolution corresponding to the second definition gear position are adjusted according to the first pre-coding bit rate and the preset bit rate threshold The intermediate resolution corresponding to the intermediate definition gear position can be adjusted. Correspondingly, the media file may be transcoded by using the first preset rule based on the adjusted first resolution, the adjusted second resolution, and the adjusted intermediate resolution. The method for adjusting the intermediate resolution may be the same as the method for adjusting the first resolution, and the present invention is not described herein again.

其中,確定所述第一清晰度檔位和第二清晰度檔位之間的至少一個中間清晰度檔位的中間解析度,可以採用確 定第二清晰度檔位對應的第二解析度的方法。具體地,所述中間清晰度檔位對應的中間解析度可以根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位來確定。所述中間解析度在所述中間清晰度檔位對應的解析度範圍中的排位與第一解析度在第一清晰度檔位對應的解析度範圍中的排位相同。例如,所述第一清晰度檔位為“高清”檔位,第二清晰度檔位為“流暢”檔位,那麼所述第一清晰度檔位和第二清晰度檔位之間可以有一中間清晰度檔位“標清”檔位。第一清晰度檔位對應的第一解析度為1392×784,其處於“高清”檔位對應的解析度範圍的第一位,那麼,所述中間清晰度檔位對應的中間解析度可以為944×528,其位於“標清”檔位對應的解析度範圍的第一位。 Wherein, determining an intermediate resolution of at least one intermediate definition gear position between the first definition gear position and the second definition gear position may adopt a method for determining a second resolution corresponding to the second definition gear position . Specifically, the intermediate resolution corresponding to the intermediate definition gear position may be determined according to the ranking of the first resolution in the resolution range corresponding to the first definition gear position. The ranking of the intermediate resolution in the resolution range corresponding to the intermediate definition gear is the same as the ranking of the first resolution in the resolution range corresponding to the first definition gear. For example, the first definition gear position is a “high definition” gear position, and the second definition gear position is a “fluent” gear position, then there may be a between the first definition gear position and the second definition gear position. Intermediate definition gear "standard definition" gear. The first resolution corresponding to the first sharpness position is 1392×784, which is in the first position of the resolution range corresponding to the “high definition” gear position, then the intermediate resolution corresponding to the intermediate definition gear position may be 944×528, which is the first place in the resolution range corresponding to the “standard definition” gear.

所述第二預設演算法可以包括:插值演算法。具體地,根據第一解析度、第二解析度和第一預編碼位元率、第二預編碼位元率可以計算得到解析度和預編碼位元率的線性關係,根據所述線性關係,可以計算得到與所述中間解析度對應的中間預編碼位元率。藉由插值演算法計算中間清晰度檔位的中間解析度所對應的中間預編碼位元率,計算得到的預編碼位元率與解析度能夠匹配,從而可以保證在中間清晰度檔位的解析度下,媒體文件可以流暢且清晰地播放。 The second preset algorithm may include: an interpolation algorithm. Specifically, a linear relationship between the resolution and the precoding bit rate may be calculated according to the first resolution, the second resolution, the first precoding bit rate, and the second precoding bit rate, according to the linear relationship, An intermediate precoding bit rate corresponding to the intermediate resolution can be calculated. The intermediate precoding bit rate corresponding to the intermediate resolution of the intermediate definition gear is calculated by the interpolation algorithm, and the calculated precoding bit rate can be matched with the resolution, thereby ensuring the resolution of the intermediate definition gear. Media files can be played smoothly and clearly.

上述實施例提供的轉碼方法,可以根據媒體文件的初始解析度來確定不同清晰度檔位的解析度,基於所述確定 的解析度,可以先對所述媒體文件進行預編碼,當所述預編碼位元率大於預設位元率閾值時,可能導致所述媒體文件不能流暢播放,可以根據所述預編碼位元率和預設位元率閾值來調整所述媒體文件的各清晰度對應的解析度,再根據調整後的解析度來對媒體文件進行轉碼,可以保證所述媒體文件流暢且清晰地播放。 The transcoding method provided by the foregoing embodiment may determine the resolution of the different resolution gears according to the initial resolution of the media file, and based on the determined resolution, the media file may be pre-coded first. When the precoding bit rate is greater than the preset bit rate threshold, the media file may not be played smoothly, and the resolution of the media file may be adjusted according to the precoding bit rate and the preset bit rate threshold. Corresponding resolution, and then transcoding the media file according to the adjusted resolution, can ensure that the media file is played smoothly and clearly.

下面介紹本發明轉碼裝置一個實施例。 An embodiment of the transcoding device of the present invention will now be described.

圖2是本發明轉碼裝置的一個實施例的模組圖。如圖2所示,所述轉碼裝置可以包括:媒體文件獲取模組201、清晰度檔位確定模組202、解析度確定模組203、預編碼位元率確定模組204、解析度調整模組205和轉碼模組206。其中,所述媒體文件獲取模組201,可以用於獲取媒體文件的屬性資訊。所述屬性資訊可以包括:初始解析度。所述屬性資訊還可以包括所述媒體文件的初始位元率。 2 is a block diagram of one embodiment of a transcoding device of the present invention. As shown in FIG. 2, the transcoding device may include: a media file obtaining module 201, a definition gear position determining module 202, a resolution determining module 203, a precoding bit rate determining module 204, and a resolution adjustment. Module 205 and transcoding module 206. The media file obtaining module 201 can be used to obtain attribute information of the media file. The attribute information may include: initial resolution. The attribute information may also include an initial bit rate of the media file.

所述清晰度檔位確定模組202,可以用於根據所述媒體文件的初始解析度、預設的多個清晰度檔位及各清晰度檔位對應的解析度範圍,確定所述媒體文件對應的第一清晰度檔位,將所述預設的多個清晰度檔位中的最低清晰度檔位作為所述媒體文件對應的第二清晰度檔位。 The definition gear position determining module 202 can be configured to determine the media file according to an initial resolution of the media file, a preset plurality of resolution gear positions, and a resolution range corresponding to each resolution gear position. Corresponding first definition gear position, the lowest definition gear position of the preset plurality of definition gear positions is used as the second definition gear position corresponding to the media file.

所述解析度確定模組203,可以用於以所述媒體文件的初始解析度作為第一解析度,根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位,來確定在第二清晰度檔位對應的解析度範圍中具有相同排位的第二解析 度。 The resolution determining module 203 may be configured to use the initial resolution of the media file as the first resolution, and rank in the resolution range corresponding to the first resolution gear according to the first resolution. And determining a second resolution having the same rank in the resolution range corresponding to the second definition gear.

所述預編碼位元率確定模組204,可以用於根據所述第一解析度和第二解析度,利用第一預設規則對所述媒體文件進行預編碼,得到第一清晰度檔位對應的第一預編碼位元率和第二清晰度檔位對應的第二預編碼位元率。 The pre-coding bit rate determining module 204 may be configured to pre-code the media file by using a first preset rule according to the first resolution and the second resolution to obtain a first definition gear position. Corresponding first precoding bit rate and second precoding bit rate corresponding to the second sharpness gear.

所述解析度調整模組205,可以用於當所述第一預編碼位元率大於第一清晰度檔位對應的預設位元率閾值時,根據所述第一預編碼位元率和預設位元率閾值,調整所述第一清晰度檔位對應的第一解析度和第二清晰度檔位對應的第二解析度。 The resolution adjustment module 205 may be configured to: when the first precoding bit rate is greater than a preset bit rate threshold corresponding to the first definition bit position, according to the first precoding bit rate and The preset bit rate threshold is used to adjust the first resolution corresponding to the first definition gear position and the second resolution corresponding to the second definition gear position.

所述轉碼模組206,可以用於基於所述調整後的第一解析度和調整後的第二解析度,利用第一預設規則對所述媒體文件進行轉碼。 The transcoding module 206 can be configured to transcode the media file by using a first preset rule based on the adjusted first resolution and the adjusted second resolution.

在另一個實施方式中,當所述第一預編碼位元率小於或等於第一清晰度檔位的預設位元率閾值時,所述轉碼模組206還可以用於基於所述第一解析度、第二解析度,利用第一預設規則對所述媒體文件進行轉碼。 In another embodiment, when the first precoding bit rate is less than or equal to a preset bit rate threshold of the first sharpness position, the transcoding module 206 may be further configured to be based on the first The resolution, the second resolution, transcoding the media file by using a first preset rule.

在另一個實施方式中,當所述多個清晰度檔位大於為至少3個清晰度檔位且所述第一清晰度檔位為預設的多個清晰度檔位中清晰度最高的檔位時,所述清晰度檔位確定模組202,還可以用於確定所述第一清晰度檔位和第二清晰度檔位之間的至少一個中間清晰度檔位。相應地,所述解析度確定模組203還可以用於確定所述至少一個中間清晰度檔位對應的中間解析度。所述預編碼位元率確定模組 204還可以用於基於所述第一解析度、第二解析度和所述中間解析度,利用第二預設演算法,計算與所述中間清晰度檔位對應的中間預編碼位元率。 In another embodiment, when the plurality of definition gear positions are greater than the at least 3 definition gear positions and the first definition gear position is the highest resolution among the plurality of resolution positions The bit position determination module 202 can also be configured to determine at least one intermediate definition gear position between the first definition gear position and the second definition gear position. Correspondingly, the resolution determining module 203 is further configured to determine an intermediate resolution corresponding to the at least one intermediate definition gear. The precoding bit rate determining module 204 is further configured to calculate, by using the second preset algorithm, the intermediate resolution file based on the first resolution, the second resolution, and the intermediate resolution. The intermediate precoding bit rate corresponding to the bit.

進一步地,所述解析度調整模組205還可以用於調整所述中間清晰度檔位對應的中間解析度。所述轉碼模組206,還可以用於基於調整後的第一解析度、調整後的第二解析度和調整後的中間解析度,利用第一預設規則對所述媒體文件進行轉碼。 Further, the resolution adjustment module 205 is further configured to adjust an intermediate resolution corresponding to the intermediate definition gear position. The transcoding module 206 can be further configured to transcode the media file by using a first preset rule based on the adjusted first resolution, the adjusted second resolution, and the adjusted intermediate resolution. .

上述實施例提供的轉碼裝置與本發明轉碼方法實施例相對應,可以實現本發明方法實施例,取得本發明方法實施例的技術效果。 The transcoding device provided in the foregoing embodiment corresponds to the embodiment of the transcoding method of the present invention, and the method embodiment of the present invention can be implemented to obtain the technical effects of the method embodiment of the present invention.

在20世紀90年代,對於一個技術的改進可以很明顯地區分是硬體上的改進(例如,對二極體、電晶體、開關等電路結構的改進)還是軟體上的改進(對於方法流程的改進)。然而,隨著技術的發展,當今的很多方法流程的改進已經可以視為硬體電路結構的直接改進。設計人員幾乎都藉由將改進的方法流程程式設計到硬體電路中來得到相應的硬體電路結構。因此,不能說一個方法流程的改進就不能用硬體實體模組來實現。例如,可程式設計邏輯裝置(Programmable Logic Device,PLD)(例如現場可程式設計閘陣列(Field Programmable Gate Array,FPGA))就是這樣一種積體電路,其邏輯功能由使用者對裝置程式設計來確定。由設計人員自行程式設計來把一個數位系統“整合”在一片PLD上,而不需要請晶片製造廠商來設 計和製作專用的積體電路晶片2。而且,如今,取代手工地製作積體電路晶片,這種程式設計也多半改用“邏輯編譯器(logic compiler)”軟體來實現,它與程式開發撰寫時所用的軟體編譯器相類似,而要編譯之前的原始代碼也得用特定的程式設計語言來撰寫,此稱之為硬體描述語言(Hardware Description Language,HDL),而HDL也並非僅有一種,而是有許多種,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)與Verilog2。本領域技術人員也應該清楚,只需要將方法流程用上述幾種硬體描述語言稍作邏輯程式設計並程式設計到積體電路中,就可以很容易得到實現該邏輯方法流程的硬體電路。 In the 1990s, improvements to a technology could clearly distinguish between hardware improvements (eg, improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (for method flow). Improve). However, as technology advances, many of today's method flow improvements can be seen as direct improvements in hardware circuit architecture. Designers almost always get the corresponding hardware structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented by a hardware entity module. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is an integrated circuit whose logic function is determined by the user to program the device. . Designers can program themselves to "integrate" a digital system onto a single PLD without having to ask the chip manufacturer to design and fabricate a dedicated integrated circuit die2. Moreover, today, instead of manually making integrated circuit chips, this programming is mostly implemented using a "logic compiler" software, which is similar to the software compiler used in programming development. The original code before compilation must also be written in a specific programming language. This is called Hardware Description Language (HDL), and HDL is not the only one, but there are many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog2 are currently the most commonly used. It should also be clear to those skilled in the art that the hardware flow of the logic method flow can be easily obtained by simply designing and programming the method flow into the integrated circuit with the above hardware description languages.

控制器可以按任何適當的方式實現,例如,控制器可以採取例如微處理器或處理器以及儲存可由該(微)處理器執行的電腦可讀程式碼(例如軟體或韌體)的電腦可讀媒體、邏輯閘、開關、專用積體電路(Application Specific Integrated Circuit,ASIC)、可程式設計邏輯控制器和嵌入微控制器的形式,控制器的例子包括但不限於 以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,記憶體控制器還可以被實現為記憶體的控制邏輯的一部分。 The controller can be implemented in any suitable manner, for example, the controller can be readable by, for example, a microprocessor or processor and a computer readable code (e.g., software or firmware) that can be executed by the (micro)processor. Media, logic gates, switches, Application Specific Integrated Circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, The Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, memory controllers can also be implemented as part of the memory's control logic.

本領域技術人員也知道,除了以純電腦可讀程式碼方式實現控制器以外,完全可以藉由將方法步驟進行邏輯程式設計來使得控制器以邏輯閘、開關、專用積體電路、可程式設計邏輯控制器和嵌入微控制器等的形式來實現相同功能。因此這種控制器可以被認為是一種硬體部件,而對其內包括的用於實現各種功能的裝置也可以視為硬體部件內的結構。或者甚至,可以將用於實現各種功能的裝置視為既可以是實現方法的軟體模組又可以是硬體部件內的結構。 Those skilled in the art also know that, besides implementing the controller in a purely computer readable code, the controller can be logically programmed by logic steps, switches, dedicated integrated circuits, and programmable logic. Controllers and embedded microcontrollers, etc., implement the same functionality. Thus such a controller can be considered a hardware component, and the means for implementing various functions included therein can also be considered as a structure within the hardware component. Or even a device for implementing various functions can be considered as either a software module implementing the method or a structure within the hardware component.

上述實施例闡明的系統、裝置、模組或單元,具體可以由電腦晶片或實體實現,或者由具有某種功能的產品來實現。 The system, device, module or unit illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product having a certain function.

為了描述的方便,描述以上裝置時以功能分為各種單元分別描述。當然,在實施本發明時可以把各單元的功能在同一個或多個軟體和/或硬體中實現。 For the convenience of description, the above devices are described separately by function into various units. Of course, the functions of the various units may be implemented in the same or multiple software and/or hardware in the practice of the invention.

藉由以上的實施方式的描述可知,本領域的技術人員可以清楚地瞭解到本發明可借助軟體加必需的通用硬體平臺的方式來實現。基於這樣的理解,本發明的技術方案本質上或者說對現有技術做出貢獻的部分可以以軟體產品的形式體現出來,在一個典型的配置中,計算設備包括一個或多個處理器(CPU)、輸入/輸出介面、網路介面和記憶 體。該電腦軟體產品可以包括若干指令用以使得一台電腦設備(可以是個人電腦,伺服器,或者網路設備等)執行本發明各個實施例或者實施例的某些部分所述的方法。該電腦軟體產品可以儲存在記憶體中,記憶體可能包括電腦可讀媒體中的非永久性記憶體,隨機存取記憶體(RAM)和/或非揮發性記憶體等形式,如唯讀記憶體(ROM)或快閃記憶體(flash RAM)。記憶體是電腦可讀媒體的實例。電腦可讀媒體包括永久性和非永久性、可移動和非可移動媒體可以由任何方法或技術來實現資訊儲存。資訊可以是電腦可讀指令、資料結構、程式的模組或其他資料。電腦的儲存媒體的例子包括,但不限於相變記憶體(PRAM)、靜態隨機存取記憶體(SRAM)、動態隨機存取記憶體(DRAM)、其他類型的隨機存取記憶體(RAM)、唯讀記憶體(ROM)、電可抹除可程式設計唯讀記憶體(EEPROM)、快閃記憶體或其他記憶體技術、唯讀光碟唯讀記憶體(CD-ROM)、數位多功能光碟(DVD)或其他光學儲存、磁盒式磁帶,磁帶磁磁片儲存或其他磁性存放裝置或任何其他非傳輸媒體,可用於儲存可以被計算設備存取的資訊。按照本文中的界定,電腦可讀媒體不包括暫態電腦可讀媒體(transitory media),如調變的資料訊號和載波。 As can be seen from the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of a software plus a necessary universal hardware platform. Based on this understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product. In a typical configuration, the computing device includes one or more processors (CPUs). , input / output interface, network interface and memory. The computer software product can include instructions for causing a computer device (which can be a personal computer, server, or network device, etc.) to perform the methods described in various embodiments of the present invention or portions of the embodiments. The computer software product can be stored in a memory, and the memory may include non-permanent memory, random access memory (RAM) and/or non-volatile memory in a computer readable medium, such as a read only memory. Body (ROM) or flash memory (flash RAM). Memory is an example of a computer readable medium. Computer readable media including both permanent and non-permanent, removable and non-removable media can be stored by any method or technology. Information can be computer readable instructions, data structures, modules of programs, or other materials. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), and other types of random access memory (RAM). Read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, CD-ROM only, digitally versatile A compact disc (DVD) or other optical storage, magnetic cassette, magnetic tape storage or other magnetic storage device or any other non-transportable medium can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include transitory computer readable media, such as modulated data signals and carrier waves.

本說明書中的各個實施例均採用遞進的方式描述,各個實施例之間相同相似的部分互相參見即可,每個實施例重點說明的都是與其他實施例的不同之處。尤其,對於系統實施例而言,由於其基本相似於方法實施例,所以描述 的比較簡單,相關之處參見方法實施例的部分說明即可。 The various embodiments in the specification are described in a progressive manner, and the same or similar parts between the various embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.

本發明可用於眾多通用或專用的電腦系統環境或配置中。例如:個人電腦、伺服器電腦、手持設備或可攜式設備、平板型設備、多處理器系統、基於微處理器的系統、置頂盒、可程式設計的消費電子設備、網路PC、小型電腦、大型電腦、包括以上任何系統或設備的分散式運算環境等等。 The invention is applicable to a wide variety of general purpose or special purpose computer system environments or configurations. For example: PCs, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, small computers , large computers, decentralized computing environments including any of the above systems or devices, and so on.

本發明可以在由電腦執行的電腦可執行指令的一般上下文中描述,例如程式模組。一般地,程式模組包括執行特定任務或實現特定抽象資料類型的常式、程式、物件、元件、資料結構等等。也可以在分散式運算環境中實踐本發明,在這些分散式運算環境中,由藉由通訊網路而被連接的遠端處理設備來執行任務。在分散式運算環境中,程式模組可以位於包括存放裝置在內的區域和遠端電腦儲存媒體中。 The invention may be described in the general context of computer-executable instructions executed by a computer, such as a program module. Generally, a program module includes routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types. The invention may also be practiced in a distributed computing environment in which tasks are performed by remote processing devices that are connected by means of a communication network. In a decentralized computing environment, the program modules can be located in areas including storage devices and in remote computer storage media.

雖然藉由實施例描繪了本發明,本領域普通技術人員知道,本發明有許多變形和變化而不脫離本發明的精神,希望所附的申請專利範圍包括這些變形和變化而不脫離本發明的精神。 Although the present invention has been described by way of example, it is understood by those of ordinary skill in the art spirit.

Claims (17)

一種轉碼方法,包括:獲取媒體文件的屬性資訊,所述屬性資訊包括初始解析度;根據所述媒體文件的初始解析度、預設的多個清晰度檔位和各清晰度檔位對應的解析度範圍,確定所述媒體文件對應的第一清晰度檔位,將所述預設的多個清晰度檔位中的最低清晰度檔位的作為所述媒體文件對應的第二清晰度檔位;以所述媒體文件的初始解析度作為第一解析度,根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位,來確定在第二清晰度檔位對應的解析度範圍中具有相同排位的第二解析度;根據所述第一解析度和第二解析度,利用第一預設規則對所述媒體文件進行預編碼,得到第一清晰度檔位對應的第一預編碼位元率和第二清晰度檔位對應的第二預編碼位元率;若所述第一預編碼位元率大於第一清晰度檔位對應的預設位元率閾值,根據所述第一預編碼位元率和預設位元率閾值,調整所述第一清晰度檔位對應的第一解析度和第二清晰度檔位對應的第二解析度;基於所述調整後的第一解析度和調整後的第二解析度,利用第一預設規則對所述媒體文件進行轉碼。  A transcoding method includes: acquiring attribute information of a media file, where the attribute information includes an initial resolution; according to an initial resolution of the media file, a preset plurality of resolution files, and corresponding resolution positions a resolution range, determining a first definition gear position corresponding to the media file, and using a lowest definition gear position of the preset plurality of resolution gear positions as a second definition file corresponding to the media file Bit; using the initial resolution of the media file as the first resolution, determining the second sharpness position according to the ranking of the first resolution in the resolution range corresponding to the first sharpness position a second resolution having the same rank in the corresponding resolution range; precoding the media file by using the first preset rule according to the first resolution and the second resolution, to obtain a first resolution file a first precoding bit rate corresponding to the bit and a second precoding bit rate corresponding to the second sharpness bit; if the first precoding bit rate is greater than a preset bit corresponding to the first sharpness Rate threshold Adjusting, by the first pre-coding bit rate and the preset bit rate threshold, a first resolution corresponding to the first sharpness position and a second resolution corresponding to the second sharpness position; The first resolution and the adjusted second resolution are used to transcode the media file by using a first preset rule.   如申請專利範圍第1項所述的轉碼方法,其中, 所述根據媒體文件的初始解析度、預設的多個清晰度檔位及各清晰度檔位對應的解析度範圍,確定所述媒體文件對應的第一清晰度檔位,具體包括:所述初始解析度所在的解析度範圍所對應的清晰度檔位為第一清晰度檔位。  The transcoding method according to the first aspect of the invention, wherein the determining, according to an initial resolution of the media file, a preset plurality of sharpness positions, and a resolution range corresponding to each sharpness position, The first definition gear position corresponding to the media file includes: the resolution gear position corresponding to the resolution range in which the initial resolution is located is the first definition gear position.   如申請專利範圍第1所述的轉碼方法,其中,所述利用第一預設規則對所述媒體文件進行預編碼包括:根據固定位元率係數值或者固定量化參數值進行預編碼。  The transcoding method of claim 1, wherein the precoding the media file by using the first preset rule comprises: performing precoding according to a fixed bit rate coefficient value or a fixed quantization parameter value.   如申請專利範圍第3項所述的轉碼方法,其中,所述利用第一預設規則對所述媒體文件進行預編碼包括:抽取所述媒體文件的多個片段進行預編碼,對所述多個片段預編碼分別得到的位元率值求平均,將所述求得的平均值作為預編碼位元率。  The transcoding method of claim 3, wherein the precoding the media file by using the first preset rule comprises: extracting a plurality of segments of the media file for precoding, The bit rate values obtained by the plurality of segment precodings are averaged, and the obtained average value is used as the precoding bit rate.   如申請專利範圍第1項所述的轉碼方法,其中,所述預設位元率閾值包括:所述媒體文件在第一解析度下清晰播放的最大位元率值。  The transcoding method of claim 1, wherein the preset bit rate threshold comprises: a maximum bit rate value of the media file that is clearly played at the first resolution.   如申請專利範圍第1項所述的轉碼方法,其中,所述根據第一預編碼位元率和預設位元率閾值,調整所述第一清晰度檔位對應的第一解析度和第二清晰度檔位對應的第二解析度,包括:基於所述預設位元率閾值和預設係數,確定所述第一解析度和第二解析度的降低的幅度,根據所述降低的幅度確定調整後的第一解析度和第二解析度。  The transcoding method according to claim 1, wherein the first resolution and the first resolution corresponding to the first definition gear are adjusted according to the first precoding bit rate and the preset bit rate threshold The second resolution corresponding to the second resolution gear includes: determining, according to the preset bit rate threshold and the preset coefficient, a magnitude of the decrease of the first resolution and the second resolution, according to the reducing The magnitude of the adjustment determines the adjusted first resolution and second resolution.   如申請專利範圍第6項所述的轉碼方法,其中,所述基於預設位元率閾值和預設係數,確定所述第一解析 度和第二解析度的降低的幅度,具體包括:判斷所述第一預編碼位元率是否大於或等於預設係數的2次方和所述預設位元率閾值的乘積;若是,所述第一解析度和第二解析度分別調整為在其對應的清晰度檔位中降低2個排位後的解析度值。  The transcoding method of claim 6, wherein the determining the reduction of the first resolution and the second resolution based on the preset bit rate threshold and the preset coefficient comprises: Determining whether the first precoding bit rate is greater than or equal to a product of a second power of the preset coefficient and the preset bit rate threshold; if yes, the first resolution and the second resolution are respectively adjusted to The resolution value after the two ranks is lowered in the corresponding sharpness position.   如申請專利範圍第7項所述的轉碼方法,其中,若所述第一預編碼位元率小於預設係數的2次方和所述預設位元率閾值的乘積,所述方法還包括:判斷所述第一編碼位元率是否大於或等於所述預設位元率閾值和預設係數的乘積;若是,所述第一解析度和第二解析度分別調整為在其對應的清晰度檔位中降低1個排位後的解析度值。  The transcoding method according to claim 7, wherein if the first precoding bit rate is less than a product of a second power of the preset coefficient and the preset bit rate threshold, the method further The method includes: determining whether the first encoding bit rate is greater than or equal to a product of the preset bit rate threshold and a preset coefficient; if yes, the first resolution and the second resolution are respectively adjusted to correspond to The resolution value after one rank is lowered in the sharpness scale.   如申請專利範圍第6-8項中任意一項所述的轉碼方法,其中,所述預設係數的取值範圍包括:大於1。  The transcoding method according to any one of claims 6-8, wherein the range of the preset coefficients includes: greater than 1.   如申請專利範圍第1項所述的轉碼方法,其中,所述方法還包括:若所述第一預編碼位元率小於或等於第一清晰度檔位對應的預設位元率閾值,基於所述第一解析度和第二解析度對所述媒體文件進行轉碼。  The transcoding method of claim 1, wherein the method further comprises: if the first precoding bit rate is less than or equal to a preset bit rate threshold corresponding to the first definition bit position, Transmitting the media file based on the first resolution and the second resolution.   如申請專利範圍第1項所述的轉碼方法,其中,當所述多個清晰度檔位為至少3個清晰度檔位且所述第一清晰度檔位為預設的多個清晰度檔位中清晰度最高的檔位時,所述方法還包括:確定所述第一清晰度檔位和第二清晰度檔位之間的至少一個中間清晰度檔位對應的中間解析度; 基於第一解析度、第二解析度和所述中間解析度,利用第二預設演算法,計算與所述中間清晰度檔位對應的中間預編碼位元率。  The transcoding method according to claim 1, wherein when the plurality of definition gear positions are at least 3 definition gear positions and the first definition gear position is a preset plurality of resolutions, The method further includes: determining an intermediate resolution corresponding to at least one intermediate definition gear position between the first definition gear position and the second definition gear position; The first resolution, the second resolution, and the intermediate resolution are calculated by using a second preset algorithm to calculate an intermediate precoding bit rate corresponding to the intermediate definition gear.   如申請專利範圍第11項所述的轉碼方法,其中,所述中間檔位對應的中間解析度根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位來確定,具體地,所述中間解析度在所述中間清晰度檔位對應的解析度範圍中的排位與第一解析度在第一清晰度檔位對應的解析度範圍中的排位相同。  The transcoding method according to claim 11, wherein the intermediate resolution corresponding to the intermediate gear position is based on the ranking of the first resolution in a resolution range corresponding to the first sharpness gear. Determining, in particular, the ranking of the intermediate resolution in the resolution range corresponding to the intermediate definition gear is the same as the ranking of the first resolution in the resolution range corresponding to the first definition gear.   如申請專利範圍第11或12項所述的轉碼方法,其中,所述第二預設演算法包括:插值演算法。  The transcoding method according to claim 11 or 12, wherein the second preset algorithm comprises: an interpolation algorithm.   一種轉碼裝置,包括:媒體文件獲取模組、清晰度檔位確定模組、解析度確定模組、預編碼位元率確定模組、解析度調整模組和轉碼模組;其中,所述媒體文件獲取模組,用於獲取媒體文件的屬性資訊,所述屬性資訊包括初始解析度;所述清晰度檔位確定模組,用於根據所述媒體文件的初始解析度、預設的多個清晰度檔位及各清晰度檔位對應的解析度範圍,確定所述媒體文件對應的第一清晰度檔位,將所述預設的多個清晰度檔位中的最低清晰度檔位作為所述媒體文件對應的第二清晰度檔位;所述解析度確定模組,用於以所述媒體文件的初始解析度作為第一解析度,根據所述第一解析度在第一清晰度檔位對應的解析度範圍中的排位,來確定在第二清晰度檔 位對應的解析度範圍中具有相同排位的第二解析度;所述預編碼位元率確定模組,用於根據所述第一解析度和第二解析度,利用第一預設規則對所述媒體文件進行預編碼,得到第一清晰度檔位對應的第一預編碼位元率和第二清晰度檔位對應的第二預編碼位元率;所述解析度調整模組,用於當第一預編碼位元率大於第一清晰度檔位對應的預設位元率閾值時,根據所述第一預編碼位元率和預設位元率閾值,調整所述第一清晰度檔位對應的第一解析度和第二清晰度檔位對應的第二解析度;所述轉碼模組,用於基於所述解析度調整模組調整後的第一解析度和調整後的第二解析度,利用第一預設規則對所述媒體文件進行轉碼。  A transcoding device includes: a media file acquisition module, a definition gear position determination module, a resolution determination module, a precoding bit rate determination module, a resolution adjustment module, and a transcoding module; The media file obtaining module is configured to obtain attribute information of the media file, where the attribute information includes an initial resolution; the definition gear position determining module is configured to be configured according to an initial resolution of the media file, and a preset Determining a range of resolutions corresponding to the plurality of definition gears and the resolution points corresponding to the respective resolution gears, determining a first definition gear position corresponding to the media file, and setting a minimum resolution file among the preset plurality of resolution gear positions a second resolution gear corresponding to the media file; the resolution determining module is configured to use the initial resolution of the media file as a first resolution, and the first resolution according to the first resolution Determining a rank in the resolution range corresponding to the sharpness scale to determine a second resolution having the same rank in the resolution range corresponding to the second sharpness scale; the precoding bit rate determining module, Used according to the The first resolution and the second resolution are used to pre-code the media file by using a first preset rule to obtain a first pre-coding bit rate corresponding to the first sharpness level and a second-definition position corresponding to the second resolution a second pre-coding bit rate; the resolution adjusting module, configured to: when the first pre-encoding bit rate is greater than a preset bit rate threshold corresponding to the first sharpness level, according to the first pre-coding a bit rate and a preset bit rate threshold, adjusting a first resolution corresponding to the first definition gear and a second resolution corresponding to the second definition gear; the transcoding module is configured to The adjusted first adjustment degree and the adjusted second resolution of the resolution adjustment module, and the media file is transcoded by using the first preset rule.   如申請專利範圍第14項所述的轉碼裝置,其中,當所述第一預編碼位元率小於或等於第一清晰度檔位的預設位元率閾值時,所述轉碼模組還用於基於所述第一解析度、第二解析度,利用第一預設規則對所述媒體文件進行轉碼。  The transcoding device of claim 14, wherein the transcoding module is when the first precoding bit rate is less than or equal to a preset bit rate threshold of the first definition bit position The method further uses the first preset rule to transcode the media file based on the first resolution and the second resolution.   如申請專利範圍第14項所述的轉碼裝置,其中,當所述多個清晰度檔位大於為至少3個清晰度檔位且所述第一清晰度檔位為預設的多個清晰度檔位中清晰度最高的檔位時,所述清晰度檔位確定模組,還用於確定所述第一清晰度檔位和第二清晰度檔位之間的至少一個中間清晰度檔位; 所述解析度確定模組,還用於確定所述至少一個中間清晰度檔位對應的中間解析度;所述預編碼位元率確定模組,還用於基於所述第一解析度、第二解析度和所述中間解析度,利用第二預設演算法,計算與所述中間清晰度檔位對應的中間預編碼位元率。  The transcoding device of claim 14, wherein the plurality of sharpness positions are greater than at least three sharpness positions and the first sharpness position is a preset plurality of clear The sharpness gear determining module is further configured to determine at least one intermediate sharpness between the first sharpness gear and the second sharpness gear when the highest resolution gear is in the gear position The resolution determining module is further configured to determine an intermediate resolution corresponding to the at least one intermediate definition gear position; the precoding bit rate determining module is further configured to be based on the first resolution And a second resolution and the intermediate resolution, using a second preset algorithm to calculate an intermediate precoding bit rate corresponding to the intermediate definition gear.   如申請專利範圍第16項所述的轉碼裝置,其中,所述解析度調整模組還用於調整所述中間清晰度檔位對應的中間解析度;相應地,所述轉碼模組,還用於基於調整後的第一解析度、調整後的第二解析度和調整後的中間解析度,利用第一預設規則對所述媒體文件進行轉碼。  The transcoding device of claim 16, wherein the resolution adjustment module is further configured to adjust an intermediate resolution corresponding to the intermediate definition gear; correspondingly, the transcoding module, The method further uses the first preset rule to transcode the media file based on the adjusted first resolution, the adjusted second resolution, and the adjusted intermediate resolution.  
TW106102479A 2017-01-23 2017-01-23 Transcoding method and device capable of guaranteeing that the media document can be played smoothly and clearly TW201828696A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW106102479A TW201828696A (en) 2017-01-23 2017-01-23 Transcoding method and device capable of guaranteeing that the media document can be played smoothly and clearly

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW106102479A TW201828696A (en) 2017-01-23 2017-01-23 Transcoding method and device capable of guaranteeing that the media document can be played smoothly and clearly

Publications (1)

Publication Number Publication Date
TW201828696A true TW201828696A (en) 2018-08-01

Family

ID=63960110

Family Applications (1)

Application Number Title Priority Date Filing Date
TW106102479A TW201828696A (en) 2017-01-23 2017-01-23 Transcoding method and device capable of guaranteeing that the media document can be played smoothly and clearly

Country Status (1)

Country Link
TW (1) TW201828696A (en)

Similar Documents

Publication Publication Date Title
WO2017097126A1 (en) Method and apparatus for transcoding
JP7038021B2 (en) Adaptive transfer function for video coding and decoding
US20210021878A1 (en) System and Method for Automatically Selecting Encoding/Decoding for Streaming Media
TWI648980B (en) Content-based adaptive video transcoding method and device
US9699464B2 (en) Adaptive bitrate streaming for wireless video
WO2017097151A1 (en) Method and device for transcoding
KR20170118463A (en) Encoding apparatus, decoding apparatus and method thereof
KR20210043740A (en) Selection of resolutions for seamless resolution switching of multimedia content
CN111031389B (en) Video processing method, electronic device and storage medium
TW201541987A (en) Method and system for bandwidth-dependent file transfer
EP3583774B1 (en) Image processing method, apparatus machine-readable media
JP7374137B2 (en) Adaptive resolution video coding
WO2020119515A1 (en) Video transcoding method and device
US20180295368A1 (en) Video Compression Using Down-Sampling Patterns in Two Phases
TW201828696A (en) Transcoding method and device capable of guaranteeing that the media document can be played smoothly and clearly
TWI721089B (en) Transcoding method and device
JP2021527362A (en) Methods and equipment for intra-prediction
JP6005292B2 (en) Histogram partitioning-based local adaptive filter for video encoding and decoding
JP6379408B2 (en) Histogram partitioning-based local adaptive filter for video encoding and decoding
TW202337209A (en) Encoding and decoding method, apparatus,device, storage medium and computer program product
JP2017028714A (en) Histogram segmentation based local adaptive filter for video encoding and decoding
CN118714306A (en) Video filtering method, device, equipment and medium