[Ffmpeg-devel] Re: movenc.c ipod h264 suggested change

Jason Millard jsm174
Thu Mar 30 19:37:03 CEST 2006


The way I see it, there is no one answer that will make everyone happy.

If we were able to get libx264 modified I think the following changes
would be in order. (I'm not attaching files this time.)

-------------------

libx264 -> common.c -> x264_param_default() ->


param->i_level_idc = 0;   // changed from param->i_level_idc = 51;
param->i_profile_idc = 0;

-------------------

libx264 -> set.c -> x264_sps_init() ->

void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )

if ( param->i_profile_idc > 0 )
{
   sps->i_profile_idc = param->i_profile_idc;
}
else
{
   .
   .
   else
      sps->i_profile_idc = PROFILE_BASELINE;
}

if ( param->i_level_idc > 0 )
{
   sps->i_level_idc = param->i_level_idc;
}
else
{
   sps->i_level_idc = 51;
}

-------------------

ffmpeg -> libavcodec/x264.c -> X264_init()

    if(avctx->level > 0) x4->params.i_level_idc = avctx->level;

    to

    if(avctx->profile != FF_PROFILE_UNKNOWN)
       x4->params.i_profile_idc = avctx->profile;
    else
       x4->params.i_profile_idc = 77;

    if(avctx->level != FF_LEVEL_UNKNOWN)
       x4->params.i_level_idc = avctx->level;
    else
       x4->params.i_level_idc = 51;

--------------------

ffmpeg -> libavformat/movenc.c -> mov_write_avcc_tag()

    if (track->enc->profile != FF_PROFILE_UNKNOWN)
       put_byte(pb, track->enc->profile);
    else
       put_byte(pb, 77);

    put_byte(pb, 64); /* profile compat */

    if (track->enc->level != FF_LEVEL_UNKNOWN)
       put_byte(pb, track->enc->level);
    else
       put_byte(pb, 51);


This way, if you were encoding directly with x264, they still work the
same way and if you encode with ffmpeg without specifying params,
you'll force baseline at 5.1

-- Jason

On 3/30/06, Jason Millard <jsm174 at gmail.com> wrote:
> We could and should set up x264 to fetch the profile as well, but it
> still won't do anything until libx264 is updated.
>
> On 3/30/06, Baptiste COUDURIER <baptiste.coudurier at smartjog.com> wrote:
> > Hi,
> >
> > Jason Millard wrote:
> > > [...]
> > >
> > > When I modified movenc.c to fetch track->enc->profile and
> > > track->enc->level and then passed them in on the command line, the
> > > mp4creator remuxing worked fine, because just like BOND's email
> > > stated, x264 uses those values if provided.
> > >
> >
> > That is the right thing to do. If avctx level and profile are
> > "correctly" set, use them.
> >
> > IMHO, correct profile and level parameters should be inferred by the
> > encoder, in x264.c
> >
> > A quick look shows that level is already taken into account, but not
> > profile.
> >
> > --
> > Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
> > SMARTJOG S.A.                                    http://www.smartjog.com
> > Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
> > Phone: +33 1 49966312
> >
> > _______________________________________________
> > ffmpeg-devel mailing list
> > ffmpeg-devel at mplayerhq.hu
> > http://mplayerhq.hu/mailman/listinfo/ffmpeg-devel
> >
>





More information about the ffmpeg-devel mailing list