[FFmpeg-devel] [PATCH] ffprobe: add show_video_keyframes option
Steven Liu
lingjiujianke at gmail.com
Thu Mar 9 10:03:04 EET 2017
2017-03-09 15:51 GMT+08:00 wm4 <nfxjfg at googlemail.com>:
> On Thu, 9 Mar 2017 15:43:21 +0800
> Steven Liu <lq at chinaffmpeg.org> wrote:
>
> > add a option for show video keyframes info only when use show_packets
> > or show_frames
> >
> > Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> > ---
> > ffprobe.c | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/ffprobe.c b/ffprobe.c
> > index c85c3a1..3beceb2 100644
> > --- a/ffprobe.c
> > +++ b/ffprobe.c
> > @@ -81,6 +81,7 @@ static int do_show_programs = 0;
> > static int do_show_streams = 0;
> > static int do_show_stream_disposition = 0;
> > static int do_show_data = 0;
> > +static int do_show_video_keyframes = 0;
> > static int do_show_program_version = 0;
> > static int do_show_library_versions = 0;
> > static int do_show_pixel_formats = 0;
> > @@ -1820,6 +1821,12 @@ static void show_packet(WriterContext *w,
> InputFile *ifile, AVPacket *pkt, int p
> > AVBPrint pbuf;
> > const char *s;
> >
> > + if (do_show_video_keyframes) {
> > + if ((st->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) ||
> !(pkt->flags & AV_PKT_FLAG_KEY)) {
> > + return;
> > + }
> > + }
> > +
> > av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
> >
> > writer_print_section_header(w, SECTION_ID_PACKET);
> > @@ -1899,6 +1906,12 @@ static void show_frame(WriterContext *w, AVFrame
> *frame, AVStream *stream,
> > const char *s;
> > int i;
> >
> > + if (do_show_video_keyframes) {
> > + if ((stream->codecpar->codec_type != AVMEDIA_TYPE_VIDEO) ||
> !(frame->key_frame)) {
> > + return;
> > + }
> > + }
> > +
> > av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
> >
> > writer_print_section_header(w, SECTION_ID_FRAME);
> > @@ -3225,6 +3238,7 @@ static const OptionDef real_options[] = {
> > { "select_streams", OPT_STRING | HAS_ARG,
> {(void*)&stream_specifier}, "select the specified streams",
> "stream_specifier" },
> > { "sections", OPT_EXIT, {.func_arg = opt_sections}, "print sections
> structure and section information, and exit" },
> > { "show_data", OPT_BOOL, {(void*)&do_show_data}, "show packets
> data" },
> > + { "show_video_keyframes", OPT_BOOL, {(void*)&do_show_video_keyframes},
> "show video keyframes info only" },
> > { "show_data_hash", OPT_STRING | HAS_ARG, {(void*)&show_data_hash},
> "show packets data hash" },
> > { "show_error", 0, {(void*)&opt_show_error}, "show probing
> error" },
> > { "show_format", 0, {(void*)&opt_show_format}, "show
> format/container info" },
>
> Possibly redundant with -skip_frame nokey (not sure how codec dependent
> that option is).
>
I saw there have no AVCodecContext help message in ffprobe --help
What about add AVCodecContext help message into ffprobe?
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
More information about the ffmpeg-devel
mailing list