當前位置:首頁 » 網路資訊 » 待編碼數據怎樣生成比特模式

待編碼數據怎樣生成比特模式

發布時間: 2024-06-15 08:10:39

㈠ 姣旂壒鐜囨槸浠涔堟傚康錛屽湪瑙嗛戝拰闊抽戣漿鎹㈣繃紼嬩腑錛屽備綍璁懼畾鍛

姣旂壒鐜囪繖涓璇嶆湁澶氱嶇炕璇戱紝姣斿傜爜鐜囩瓑錛岃〃紺虹粡榪囩紪鐮(鍘嬬緝)鍚庣殑闊抽戞暟鎹姣忕掗挓闇瑕佺敤澶氬皯涓姣旂壒鏉ヨ〃紺猴紝鑰屾瘮鐗瑰氨鏄浜岃繘鍒墮噷闈㈡渶灝戠殑鍗曚綅錛岃佷箞鏄0錛岃佷箞鏄1銆傛瘮鐗圭巼涓庨煶棰戝帇緙╃殑鍏崇郴綆鍗曠殑璇村氨鏄姣旂壒鐜囪秺楂橀煶璐ㄥ氨瓚婂ソ錛屼絾緙栫爜鍚庣殑鏂囦歡灝辮秺澶;濡傛灉姣旂壒鐜囪秺灝戝垯鎯呭喌鍒氬ソ緲昏漿銆
VBR(Variable
Bitrate)鍔ㄦ佹瘮鐗圭巼
涔熷氨鏄娌℃湁鍥哄畾鐨勬瘮鐗圭巼錛屽帇緙╄蔣浠跺湪鍘嬬緝鏃舵牴鎹闊抽戞暟鎹鍗蟲椂紜瀹氫嬌鐢ㄤ粈涔堟瘮鐗圭巼錛岃繖鏄浠ヨ川閲忎負鍓嶆彁鍏奸【鏂囦歡澶у皬鐨勬柟寮忥紝鎺ㄨ崘緙栫爜妯″紡;
ABR(Average
Bitrate)騫沖潎姣旂壒鐜
鏄疺BR鐨勪竴縐嶆彃鍊煎弬鏁般侺AME閽堝笴BR涓嶄匠鐨勬枃浠朵綋縐姣斿拰VBR鐢熸垚鏂囦歡澶у皬涓嶅畾鐨勭壒鐐圭嫭鍒涗簡榪欑嶇紪鐮佹ā寮忋侫BR鍦ㄦ寚瀹氱殑鏂囦歡澶у皬鍐咃紝浠ユ瘡50甯(30甯х害1縐)涓轟竴孌碉紝浣庨戝拰涓嶆晱鎰熼戠巼浣跨敤鐩稿逛綆鐨勬祦閲忥紝楂橀戝拰澶у姩鎬佽〃鐜版椂浣跨敤楂樻祦閲忥紝鍙浠ュ仛涓篤BR鍜孋BR鐨勪竴縐嶆姌琛烽夋嫨銆
CBR(Constant
Bitrate)錛屽父鏁版瘮鐗圭巼
鎸囨枃浠朵粠澶村埌灝鵑兘鏄涓縐嶄綅閫熺巼銆傜浉瀵逛簬VBR鍜孉BR鏉ヨ詫紝瀹冨帇緙╁嚭鏉ョ殑鏂囦歡浣撶Н寰堝ぇ錛岃屼笖闊寵川鐩稿逛簬VBR鍜孉BR涓嶄細鏈夋槑鏄劇殑鎻愰珮

㈡ NVENC緙栫爜

灝哊VENC lib涓鐨勬帴鍙e煎嚭錛屼緵鍚庣畫緙栫爜嫻佺▼浣跨敤銆

緙栫爜浼氳瘽闇瑕佷紶鍏D3D璁懼囷紝鍦ㄦや箣鍓嶉渶瑕佸壋寤哄ソD3D璁懼囥傛帴鍙h緭鍑虹殑 void* m_encoder; 灝嗕細鐢ㄤ簬鍚庣畫緙栫爜鎺ュ彛鐨勭涓涓鍙傛暟涓銆

鍙浠ヤ嬌鐢 nvEncInitializeEncoder 浼犲叆 NV_ENC_INITIALIZE_PARAMS 綾誨瀷鐨勫疄渚嬶紝瀵圭紪鐮佸櫒榪涜屽垵濮嬪寲銆傚叾涓 encodeGUID 銆 encodeWidth 銆 encodeHeight 涓夐」鏄蹇呭~閫夐」錛 encodeGUID 琛ㄧず浣跨敤H264緙栫爜( NV_ENC_CODEC_H264_GUID )榪樻槸H265( NV_ENC_CODEC_HEVC_GUID )緙栫爜銆傚彟澶栵紝榪樺彲浠ュ湪姝よ劇疆浣跨敤鍚屾ョ紪鐮佽繕鏄寮傛ョ紪鐮佹ā寮忋
nvEncGetEncodePresetConfig 鍙浠ヨ幏鍙栭勭疆鍙傛暟 NV_ENC_PRESET_CONFIG 銆傚彲浠ヨ劇疆鐮佺巼鎺у埗妯″紡銆佸鉤鍧囩爜鐜囩瓑鏁版嵁銆

灝嗚緭鍏ョ殑綰圭悊鎸囬拡娉ㄥ唽鎴愯緭鍏ヨ祫婧愶紝鍗 m_registerResource.resourceToRegister = m_inputTexture;

灝嗘敞鍐岀殑杈撳叆璧勬簮鏄犲皠鍒扮紪鐮佸櫒銆 m_inputMapResource.registeredResource = m_registerResource.registeredResource;

鍒涘緩鎺ユ敹緙栫爜鍑虹殑姣旂壒嫻佺紦鍐層

鍦ㄧ紪鐮佸墠闇瑕佹洿鏂拌緭鍏ョ汗鐞嗘暟鎹錛屽嵆鍓嶉潰宸茬粡娉ㄥ唽鐨勭汗鐞嗘寚閽 m_inputTexture 錛屾洿鏂板悗錛屽~鍏 NV_ENC_PIC_PARAMS 緇撴瀯錛屽皢 NV_ENC_PIC_PARAMS.inputBuffer 璧嬪間負鍓嶉潰鏄犲皠鐨勮祫婧愶紝鍗 m_inputMapResource.mappedResource 錛屽啀灝 NV_ENC_PIC_PARAMS.outputBitstream 璧嬪間負鍓嶉潰鍒涘緩鐨勮緭鍑烘瘮鐗規祦緙撳啿錛屽嵆 m_outputBuffer.bitstreamBuffer 錛岀劧鍚庤皟鐢 nvEncEncodePicture 瀵規暟鎹榪涜岀紪鐮併

浣跨敤 nvEncLockBitstream 灝嗘暟鎹浠庣紪鐮佸櫒涓鍙栧嚭錛屽嵆GPU鍒癈PU銆