最近項(xiàng)目需要錄制攝像機(jī)拍攝的視頻,使用h264編碼。測(cè)試發(fā)現(xiàn)h264編碼2k(1980×1080)視頻還算流暢,但編碼4k(3840×4120)視頻出現(xiàn)明顯卡頓丟幀現(xiàn)象。因此考慮使用h264 nvenc硬件編碼。 將原本代碼
AVCodec *codec = avcodec_find_encoder(AV_CODEC_ID_H264);改為
AVCodec * codec = avcodec_find_encoder_by_name("nvenc_h264");即可實(shí)現(xiàn)h264 nvenc硬件編碼。 較CPU編碼,h264 nvenc硬件編碼的4k視頻明顯流暢許多,丟幀現(xiàn)象大幅減少。
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注