ffmpeg 時間戳

AVpacket裏的時間戳pts和dts.單位好像是us. 問 : 時間戳pts和dts,這裏兩個時間戳各有什麼意義? 答 : 顯示時間,解碼時間. DTS:decoding time stamp PTS:presentation time stamp Generally the PTS and DTS will only differ when the stream we are playing has B frames in it. 問 : 在 VLC 中調用 avcodec_decode_video() 函數進行解碼時,AVFrame->pts 時間戳不對,導致我的圖像不能夠顯示? 請問有誰知道它的解碼原理,這個 PTS 怎麼得出的嗎?還是外部傳入的? 答 : AVFrame 上的時間戳是用戶事件戳 是用戶打上去的,就是你的程序。 PTS 是在包AVPacket上 顯示時間戳是在 影片被encode的時候打上的。。編碼器 會做這部分工作。 在play back 的時候會根據這個時間 調整播放進度。 我貼下 VLC 的代碼,(vlc-0.9.8a/modules/codec/avcodec/video.c 文件中) i_used = avcodec_decode_video( p_sys->p_context, p_sys->p_ff_pic, &b_gotpicture, p_sys->i_buffer <= 0 && p_sys->b_flush ? NULL : (uint8_t*)p_sys->p_buffer, p_sys- >i_buffer ); 中間省略 取得 PTS , if( p_sys->p_ff_pic->pts ) { printf(" p_sys->p_ff_pic->pts = %Lx/n", p_sys->p_ff_pic->pts); p_sys->i_pts = p_sys->p_ff_pic->pts; } 從 AVFrame 結構中取得 這個 PTS ,但是這個 AVFrame 結構中取得 這個 PTS 從哪裏取得的呢? 你的問題解決沒有,我現在也是這個問題,AVFrame->pts 時間戳不對,只有第一幀能顯示,其他的都不能顯示
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章