【发布时间】:2016-08-16 03:55:15
【问题描述】:
我正在使用 FFMpeg 进行解码。我正在解码的视频是使用 C 代码的 H.264 或 MPEG4 视频。我正在使用 32 位库。我已经成功解码并提取了第一帧的元数据。我现在想解码最后一帧。我有一个定义的视频持续时间,并且觉得说isLastFrame = duration 是一个安全的假设。这是我的,有什么建议吗?
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);
}
非常感谢任何帮助! :)
【问题讨论】:
标签: c video ffmpeg metadata decode