[FFmpeg-devel] ffprobe: Add CABAC indicator

Stefano Sabatini stefasab at gmail.com
Wed Jan 22 13:19:20 CET 2014


On date Wednesday 2014-01-22 18:13:38 +0600, Andaleeb Roomy encoded:
> Hello,
> 
> For one of our projects, we need to know if any H264 file was encoded with
> CABAC or not. We thought that the quicket way to do this is to make a small
> change to ffprobe.c for this. The attached patch contains the changes.
> 
> We are interested to know if it is OK to commit the patch?
> 
> Thanks,
> 
> Andaleeb

> From b1413386b93a65fb722105928f0f461f06c25e45 Mon Sep 17 00:00:00 2001
> From: Syed Andaleeb Roomy <andaleebcse at gmail.com>
> Date: Wed, 22 Jan 2014 17:39:07 +0600
> Subject: [PATCH] ffprobe: Add CABAC indicator If the codec is H264, the cabac
>  flag in pps is output for -show_streams. This is useful for
>  those who need to inspect the entropy coding mode of H264
>  media, in addition to profile.
> 
> ---
>  ffprobe.c |    7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/ffprobe.c b/ffprobe.c
> index ef3bcc6..9a78832 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -45,6 +45,7 @@
>  #include "libswresample/swresample.h"
>  #include "libpostproc/postprocess.h"
>  #include "cmdutils.h"

> +#include "libavcodec/h264.h"

Exposing the internal libavcodec interface in application code is not
OK.

>  
>  const char program_name[] = "ffprobe";
>  const int program_birth_year = 2007;
> @@ -1992,6 +1993,12 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id
>                  if (dec->long_name) print_str    ("codec_long_name", dec->long_name);
>                  else                print_str_opt("codec_long_name", "unknown");
>              }

> +            if (dec->id == AV_CODEC_ID_H264) {
> +                H264Context *h = dec_ctx->priv_data;
> +                if (h) {
> +                    print_int("cabac", h->pps.cabac);
> +                }
> +            }

Probably you could add an option to make the decoder export this as
metadata?
-- 
FFmpeg = Fascinating & Frenzy Monstrous Political Everlasting Guide


More information about the ffmpeg-devel mailing list