[x264-devel] Problem on using x264_encoder_encode

Jason Garrett-Glaser darkshikari at gmail.com
Tue Aug 25 20:19:29 CEST 2009


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


More information about the x264-devel mailing list