[x264-devel] Problem on using x264_encoder_encode
Jason Garrett-Glaser
darkshikari at gmail.com
Tue Aug 25 21:04:44 CEST 2009
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
More information about the x264-devel
mailing list