I'm using the C++ API to implement a simple video player in Qt. I'd like to be able to load a video and determine how many seconds long it is. I thought I would be able to calculate this time by looking at AVFormatContext->duration in the header and that
double timeMillisec = (double)AVFormatContext->duration / AV_TIME_BASE * 1000 in the example file I'm using, I'm getting a value of AVFormatContext->duration = 81223333, so about 81 seconds. However, if I scan through all my packets to the end, my final packet has a presentation time of 3580928 and my codec context has a timebase of 1 / 50. I'm calculating the time of the packet as double packetTimeMillisec = packet.pts * pCodecCtx->time_base.num / pCodecCtx->time_base.den Am I doing this right? How do I figure out how to synchronize these packets with my clock and determine the total length of the animation from the header? --- http://www.kitfox.com _______________________________________________ ffmpeg-user mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-user To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
