我解碼使用FFMpeg。我正在解碼的視頻是使用C代碼的H.264或MPEG4視頻。我正在使用32位庫。我已經成功解碼並提取了第一幀的元數據。我現在想解碼最後一幀。我有一個確定的視頻持續時間,並認爲這是一個安全的假設,說isLastFrame = duration
。這是我的,有什麼建議嗎?如何FFmpeg解碼並從最後一幀提取元數據?
AVFormatContext* pFormatCtx = avformat_alloc_context();
avformat_open_input(&pFormatCtx, filename, NULL, NULL);
int64_t duration = pFormatCtx->duration;
i=0;
while(av_read_frame(pFormatCtx, &packet)>=0) {
/* Is this a packet from the video stream? */
if(packet.stream_index==videoStream) {
/* Decode video frame*/
avcodec_decode_video2(pCodecCtx, pFrame, &duration, &packet);
}
任何幫助非常感謝! :)