-
Notifications
You must be signed in to change notification settings - Fork 350
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
frame index of video frame #33
Comments
Unfortunately, I don't think that sort of information is available from FFmpeg/Libav, as it may not be a common thing for codecs to encode into individual frames/packets. |
ok, that makes sense. I just thought it might be possible because of a few members in the AVframe struct: int coded_picture_number
#picture number in bitstream order
int display_picture_number
#picture number in display order |
They look promising, but (IIRC) they are set in essentially the same manner as PyAV's On Jul 12, 2014, at 1:17 AM, mkassner notifications@github.com wrote:
|
Alright. Thanks for the clarification! |
Seems like the documentation should be improved, at the least. |
If the video is constant frame rate, the frame number should be pts_seconds / frame_rate. That might be good enough for most codecs, assuming the file is encoded correctly, doesn't drop or repeat frames. The only way to do it 100% accurately as far as I understand is to decode every frame and count and then make a pts seek table. |
I was hoping for frame indices of variable frame rate videos, otherwise frame index is always just pts/framerate like you said. I was hoping seek tables to already be present in the container. Building one ourselves is not hard so I will go with that! |
I'm going to leave this open as a documentation issue. |
In my own code, after much painful and tedious research :) I have the following:
I'm not certain how portable this is, as we only use MP4 video streams. |
I'm going to close this issue, as the following time-related attributes are properly documented nowadays:
|
See PyAV-Org/PyAV#33 It seems like the index property is unreliable. I've encountered cases where a packet will have two frames with the same "index" property.
Since frame.pts is often only by coincidence equal to frame index in video stream (and will ultimately fail with non constant frame rates), I was hoping for frame.index to represent the frame index in the steam.
However, it appears that frame index == encoded frame count on frame creation. This mean that after a seek the index become -at least the way I understand it- false.
Any ideas on how to fix that?
The text was updated successfully, but these errors were encountered: