I am using ffmpeg to decode a video file in C. I am struggling to get either the score of the current frame that I am decoding or the timestamp of the frame. I read a lot of posts that showed how to calculate the estimated frame without any reason for the time and frame time, however, I can not get any of them.
What I need: fps video file, timestamp of the current frame or no frame (not calculated)
What I have: I can get the time of the video using
pFormatCtx->duration/AV_TIME_BASE
I am calculating frames at the moment when I process them, and I get the current number of frames, but this will not work for a long time. I can get the total number of frames for a file using
pFormatCtx->streams[currentStream->videoStream]->nb_frames
I read that this may not work for all threads, although it worked for every thread that I tried.
I tried using the values of time_base.num and time_base.den and packet.pts, but I can’t understand what values I get from them, so I may just need to better understand what these values are.
Does anyone know resources that show examples of how to get these values?
source share