Skip to content
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

added coded_picture_number property to VideoFrame #582

Closed
wants to merge 1 commit into from

Conversation

mastak
Copy link
Contributor

@mastak mastak commented Dec 12, 2019

Added information about picture number in bitstream order. Some times frames can be in broken order, for example 1, 2, 3...12, 14, 13, 15, 16.... And coded_picture_number possible way to detect it.

@mikeboers
Copy link
Member

Thanks for this.

Looking at the FFmpeg code though, I can't find where this is actually set except in h.264. Do you know how reliable this is globally?

@mikeboers
Copy link
Member

Looking at these:

$ grep -IR --include '*.c' coded_picture_number vendor/ffmpeg-4.2
vendor/ffmpeg-4.2/libavutil/frame.c:    dst->coded_picture_number   = src->coded_picture_number;
vendor/ffmpeg-4.2/fftools/ffprobe.c:        print_int("coded_picture_number",   frame->coded_picture_number);
vendor/ffmpeg-4.2/libavcodec/ratecontrol.c:             s->current_picture_ptr->f->coded_picture_number,
vendor/ffmpeg-4.2/libavcodec/mpegvideo.c:    s->coded_picture_number = s1->coded_picture_number;
vendor/ffmpeg-4.2/libavcodec/mpegvideo.c:    s->coded_picture_number  = 0;
vendor/ffmpeg-4.2/libavcodec/mpegvideo.c:    pic->f->coded_picture_number = s->coded_picture_number++;
vendor/ffmpeg-4.2/libavcodec/h264_slice.c:    h->coded_picture_number = h1->coded_picture_number;
vendor/ffmpeg-4.2/libavcodec/h264_slice.c:    pic->f->coded_picture_number = h->coded_picture_number++;
vendor/ffmpeg-4.2/libavcodec/snowenc.c:    s->current_picture->coded_picture_number = avctx->frame_number;
vendor/ffmpeg-4.2/libavcodec/snowenc.c:    s->m.current_picture.f->coded_picture_number   = avctx->frame_number;
vendor/ffmpeg-4.2/libavcodec/mpegvideo_enc.c:            s->reordered_input_picture[0]->f->coded_picture_number =
vendor/ffmpeg-4.2/libavcodec/mpegvideo_enc.c:                s->coded_picture_number++;
vendor/ffmpeg-4.2/libavcodec/mpegvideo_enc.c:            s->reordered_input_picture[0]->f->coded_picture_number =
vendor/ffmpeg-4.2/libavcodec/mpegvideo_enc.c:                s->coded_picture_number++;
vendor/ffmpeg-4.2/libavcodec/mpegvideo_enc.c:                s->reordered_input_picture[i + 1]->f->coded_picture_number =
vendor/ffmpeg-4.2/libavcodec/mpegvideo_enc.c:                    s->coded_picture_number++;
vendor/ffmpeg-4.2/libavcodec/mpegvideo_enc.c:            if (!s->current_picture.f->coded_picture_number)
vendor/ffmpeg-4.2/libavcodec/mpeg12enc.c:        time_code = s->current_picture_ptr->f->coded_picture_number +
vendor/ffmpeg-4.2/libavcodec/mpeg12enc.c:        s->gop_picture_number = s->current_picture_ptr->f->coded_picture_number;
vendor/ffmpeg-4.2/doc/examples/demuxing_decoding.c:                   video_frame_count++, frame->coded_picture_number);

It only looks like h.264 and mpeg set it while decoding.

@mastak
Copy link
Contributor Author

mastak commented Dec 16, 2019

In the case with dvd (.vob) format it also has information.

As for webm - it always contains 0 (zeros).

@mikeboers
Copy link
Member

Those are container formats, and it is the codec that sets that attribute. DVDs are MPEG2 IIRC, so that makes sense.

@mastak
Copy link
Contributor Author

mastak commented Dec 16, 2019

I don't have much knowledge in this domain area. If you would describe specific cases for verification, I can check, and if necessary, add tests.

@mastak
Copy link
Contributor Author

mastak commented Jan 8, 2020

@mikeboers
How about those updates? Is there a chance for this PR?

@jlaine
Copy link
Collaborator

jlaine commented Mar 27, 2022

This needs unit tests.

@WyattBlue WyattBlue added tests requested Please add tests to your PR and removed changes requested labels Nov 12, 2023
@WyattBlue WyattBlue changed the base branch from develop to main November 12, 2023 02:54
@WyattBlue
Copy link
Member

This PR is so basic, and nothing has happened for so long. I don't think it's worth keeping it open anymore.

@WyattBlue WyattBlue closed this Feb 2, 2024
@ValeZAA
Copy link

ValeZAA commented Feb 2, 2024

@WyattBlue please note that code is wrong anyway as the underlying stuff got deprecated. FFmpeg/FFmpeg@2296078

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests requested Please add tests to your PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants