[FFmpeg-devel] [PATCH] h264 ticks and time base

Michael Niedermayer michaelni
Thu Jun 18 01:51:42 CEST 2009


On Sun, Jun 14, 2009 at 10:42:11PM -0700, Baptiste Coudurier wrote:
> Hi,
> 
> 1) Set avctx time_base in h264 parser.
> 2) Set avctx ticks_per_frame in h264 decoder.
> 
> I don't get this code in decode_init in h264.c
> 
>     reset_sei(h);
>     if(avctx->codec_id == CODEC_ID_H264){
>         if(avctx->ticks_per_frame == 1){
>             s->avctx->time_base.den *=2;
>         }
>         avctx->ticks_per_frame = 2;
>     }
>     return 0;
> 
> avctx->ticks_per_frame is not set before calling the decoder
> in any case. Should that be removed ?

what do you mean by "that" ?


> 
> -- 
> Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
> FFmpeg maintainer                                  http://www.ffmpeg.org

>  h264.c        |    1 +
>  h264_parser.c |    8 ++++++++
>  2 files changed, 9 insertions(+)
> 47f6ec06081f0ca768599318d4d78fd35c1dc547  h264_ticks.patch
> Index: libavcodec/h264.c
> ===================================================================
> --- libavcodec/h264.c	(revision 19196)
> +++ libavcodec/h264.c	(working copy)
> @@ -3840,6 +3840,7 @@
>                  s->avctx->time_base.den *= 2;
>              av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
>                        s->avctx->time_base.num, s->avctx->time_base.den, 1<<30);
> +            s->avctx->ticks_per_frame = 2;
>          }
>      }

ticks_per_frame has already been set during init


>  
> Index: libavcodec/h264_parser.c
> ===================================================================
> --- libavcodec/h264_parser.c	(revision 19196)
> +++ libavcodec/h264_parser.c	(working copy)
> @@ -153,6 +153,14 @@
>              break;
>          case NAL_PPS:
>              ff_h264_decode_picture_parameter_set(h, h->s.gb.size_in_bits);
> +            if(h->sps.timing_info_present_flag){
> +                avctx->time_base= (AVRational){h->sps.num_units_in_tick, h->sps.time_scale};
> +                if(h->x264_build > 0 && h->x264_build < 44)
> +                    avctx->time_base.den *= 2;
> +                av_reduce(&avctx->time_base.num, &avctx->time_base.den,
> +                          avctx->time_base.num, avctx->time_base.den, 1<<30);
> +                avctx->ticks_per_frame = 2;
> +            }
>              break;

this hunk might be ok

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Old school: Use the lowest level language in which you can solve the problem
            conveniently.
New school: Use the highest level language in which the latest supercomputer
            can solve the problem without the user falling asleep waiting.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090618/2c076478/attachment.pgp>



More information about the ffmpeg-devel mailing list