[x264-devel] Problem on using x264_encoder_encode

Alessandro Ferrari alessandroferrari87 at gmail.com
Tue Aug 25 21:45:28 CEST 2009


2009/8/25 Jason Garrett-Glaser <darkshikari at gmail.com>

> On Tue, Aug 25, 2009 at 11:44 AM, Alessandro
> Ferrari<alessandroferrari87 at gmail.com> wrote:
> >
> >
> > 2009/8/25 Jason Garrett-Glaser <darkshikari at gmail.com>
> >>
> >> On Tue, Aug 25, 2009 at 11:12 AM, Alessandro
> >> Ferrari<alessandroferrari87 at gmail.com> wrote:
> >> > 2009/8/25 Jason Garrett-Glaser <darkshikari at gmail.com>
> >> >>
> >> >> On Tue, Aug 25, 2009 at 10:51 AM, Alessandro
> >> >> Ferrari<alessandroferrari87 at gmail.com> wrote:
> >> >> > 2009/8/25 Jason Garrett-Glaser <darkshikari at gmail.com>
> >> >> >>
> >> >> >> On Tue, Aug 25, 2009 at 2:57 AM, Alessandro
> >> >> >> Ferrari<alessandroferrari87 at gmail.com> wrote:
> >> >> >> > Hi dear community,
> >> >> >> >                              I have a problem with the encoding
> >> >> >> > using
> >> >> >> > x264.
> >> >> >> > After I call x264_encoder_encode( h, &nal, &i_nal, pic,
> &pic_out)
> >> >> >> > function
> >> >> >> > I have nal= NULL, i_nal=0 and the function return 0. I'm sure
> that
> >> >> >> > pic
> >> >> >> > contain the correct image. The x264_t h is open using the
> default
> >> >> >> > parameters, i only change width and length of the video. The
> >> >> >> > function
> >> >> >> > don't
> >> >> >> > give me any error, it seems that it not encode any data. I
> include
> >> >> >> > the
> >> >> >> > code
> >> >> >> > of encoding function that I implement watching x264.c.
> >> >> >>
> >> >> >> x264 has an encoding delay depending on your parameters; it will
> not
> >> >> >> return frames until a number of frames have been inputted.  This
> >> >> >> delay
> >> >> >> is used for lookahead purposes.  Keep inputting frames and you
> will
> >> >> >> eventually get frames out.
> >> >> >>
> >> >> >> Dark Shikari
> >> >> >
> >> >> > I have a strange error when i try to access  at the fields of
> x264_t.
> >> >> > I
> >> >> > have
> >> >> > this compilation error:
> >> >> > transcoder.c:173: error: dereferencing pointer to incomplete type
> >> >> > The automatic code completion of my ide don't find any fields for
> the
> >> >> > pointer at x264_t h, but the compiler correct recognize the
> presence
> >> >> > of
> >> >> > the
> >> >> > type x264_t. I include on the x264.h header. Can this the cause of
> >> >> > problem?
> >> >> > Many thanks.
> >> >>
> >> >> x264_t is an opaque handler for the encoder; you are not supposed to
> >> >> be able to access its internal variables.
> >> >>
> >> >> Dark Shikari
> >> >
> >> > Ok, now I understand. I have any possibilities to change this frame
> >> > delay?
> >> >
> >>
> >> The encoder-side frame delay is as follows (measured in frames):
> >>
> >> With b-adapt = 0 or 1:
> >> MAX( param.rc.i_lookahead, param.i_bframes ) + threads - 1
> >>
> >> With b-adapt = 2:
> >> MAX( param.rc.i_lookahead, MAX(param.i_bframes,3)*4 ) + threads - 1
> >>
> >> Note that both VBV lookahead (for increased VBV quality and
> >> compliance) and Macroblock Tree ratecontrol (for better quality
> >> distribution among frames) require a significant lookahead; both of
> >> these features will be disabled if you turn off the lookahead.
> >> Obviously, for low-latency applications like videoconferencing, you
> >> have no choice.
> >>
> >> Dark Shikari
> >
> >
> > I have to implement a transcoder that receive a frame by network and
> > downsize it for mobile device with low latency. B-adapt is set to 1, and
> i
> > have only one threads, i cannot access to param.rc.lookahead, and I don't
> > know if by default lookahead is disabled or not. If lookahead is disabled
> i
> > think that frame-delay is 1, in this case i think that the problem is not
> > caused by frame delay. Any suggest? Thanks.
> > Best regards
>
> Of course you can access param.rc.i_lookahead; it's part of your
> x264_param_t.  If you don't know how to access parameters in a struct,
> well, I can't help teach you to program in C.
>
> Lookahead is on by default and equal to 40 frames.
>
> Dark Shikari
>

Sorry, i not explain clear, i have this definition of the struct rc:
/*This is the rc struct definition contained in the definition of
x264_param_t in h264.h*/
/* Rate control parameters */
    struct
    {
        int         i_rc_method;    /* X264_RC_* */

        int         i_qp_constant;  /* 0-51 */
        int         i_qp_min;       /* min allowed QP value */
        int         i_qp_max;       /* max allowed QP value */
        int         i_qp_step;      /* max QP step between frames */

        int         i_bitrate;
        float       f_rf_constant;  /* 1pass VBR, nominal QP */
        float       f_rate_tolerance;
        int         i_vbv_max_bitrate;
        int         i_vbv_buffer_size;
        float       f_vbv_buffer_init; /* <=1: fraction of buffer_size. >1:
kbit */
        float       f_ip_factor;
        float       f_pb_factor;

        int         i_aq_mode;      /* psy adaptive QP. (X264_AQ_*) */
        float       f_aq_strength;

        /* 2pass */
        int         b_stat_write;   /* Enable stat writing in psz_stat_out
*/
        char        *psz_stat_out;
        int         b_stat_read;    /* Read stat from psz_stat_in and use it
*/
        char        *psz_stat_in;

        /* 2pass params (same as ffmpeg ones) */
        float       f_qcompress;    /* 0.0 => cbr, 1.0 => constant qp */
        float       f_qblur;        /* temporally blur quants */
        float       f_complexity_blur; /* temporally blur complexity */
        x264_zone_t *zones;         /* ratecontrol overrides */
        int         i_zones;        /* number of zone_t's */
        char        *psz_zones;     /* alternate method of specifying zones
*/
    } rc;

The field i_lookahead don't exists in this declaration, and in my program i
cannot reference it, I don't know if is for reason of different version. It
is possible? thanks and sorry for my difficulties on work with x264 but I'm
new on the use of this library.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20090825/8a8044af/attachment.htm>


More information about the x264-devel mailing list