<br><br><div class="gmail_quote">2009/8/25 Jason Garrett-Glaser <span dir="ltr"><<a href="mailto:darkshikari@gmail.com">darkshikari@gmail.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Aug 25, 2009 at 11:44 AM, Alessandro<br>
<div><div></div><div class="h5">Ferrari<<a href="mailto:alessandroferrari87@gmail.com">alessandroferrari87@gmail.com</a>> wrote:<br>
><br>
><br>
> 2009/8/25 Jason Garrett-Glaser <<a href="mailto:darkshikari@gmail.com">darkshikari@gmail.com</a>><br>
>><br>
>> On Tue, Aug 25, 2009 at 11:12 AM, Alessandro<br>
>> Ferrari<<a href="mailto:alessandroferrari87@gmail.com">alessandroferrari87@gmail.com</a>> wrote:<br>
>> > 2009/8/25 Jason Garrett-Glaser <<a href="mailto:darkshikari@gmail.com">darkshikari@gmail.com</a>><br>
>> >><br>
>> >> On Tue, Aug 25, 2009 at 10:51 AM, Alessandro<br>
>> >> Ferrari<<a href="mailto:alessandroferrari87@gmail.com">alessandroferrari87@gmail.com</a>> wrote:<br>
>> >> > 2009/8/25 Jason Garrett-Glaser <<a href="mailto:darkshikari@gmail.com">darkshikari@gmail.com</a>><br>
>> >> >><br>
>> >> >> On Tue, Aug 25, 2009 at 2:57 AM, Alessandro<br>
>> >> >> Ferrari<<a href="mailto:alessandroferrari87@gmail.com">alessandroferrari87@gmail.com</a>> wrote:<br>
>> >> >> > Hi dear community,<br>
>> >> >> > I have a problem with the encoding<br>
>> >> >> > using<br>
>> >> >> > x264.<br>
>> >> >> > After I call x264_encoder_encode( h, &nal, &i_nal, pic, &pic_out)<br>
>> >> >> > function<br>
>> >> >> > I have nal= NULL, i_nal=0 and the function return 0. I'm sure that<br>
>> >> >> > pic<br>
>> >> >> > contain the correct image. The x264_t h is open using the default<br>
>> >> >> > parameters, i only change width and length of the video. The<br>
>> >> >> > function<br>
>> >> >> > don't<br>
>> >> >> > give me any error, it seems that it not encode any data. I include<br>
>> >> >> > the<br>
>> >> >> > code<br>
>> >> >> > of encoding function that I implement watching x264.c.<br>
>> >> >><br>
>> >> >> x264 has an encoding delay depending on your parameters; it will not<br>
>> >> >> return frames until a number of frames have been inputted. This<br>
>> >> >> delay<br>
>> >> >> is used for lookahead purposes. Keep inputting frames and you will<br>
>> >> >> eventually get frames out.<br>
>> >> >><br>
>> >> >> Dark Shikari<br>
>> >> ><br>
>> >> > I have a strange error when i try to access at the fields of x264_t.<br>
>> >> > I<br>
>> >> > have<br>
>> >> > this compilation error:<br>
>> >> > transcoder.c:173: error: dereferencing pointer to incomplete type<br>
>> >> > The automatic code completion of my ide don't find any fields for the<br>
>> >> > pointer at x264_t h, but the compiler correct recognize the presence<br>
>> >> > of<br>
>> >> > the<br>
>> >> > type x264_t. I include on the x264.h header. Can this the cause of<br>
>> >> > problem?<br>
>> >> > Many thanks.<br>
>> >><br>
>> >> x264_t is an opaque handler for the encoder; you are not supposed to<br>
>> >> be able to access its internal variables.<br>
>> >><br>
>> >> Dark Shikari<br>
>> ><br>
>> > Ok, now I understand. I have any possibilities to change this frame<br>
>> > delay?<br>
>> ><br>
>><br>
>> The encoder-side frame delay is as follows (measured in frames):<br>
>><br>
>> With b-adapt = 0 or 1:<br>
>> MAX( param.rc.i_lookahead, param.i_bframes ) + threads - 1<br>
>><br>
>> With b-adapt = 2:<br>
>> MAX( param.rc.i_lookahead, MAX(param.i_bframes,3)*4 ) + threads - 1<br>
>><br>
>> Note that both VBV lookahead (for increased VBV quality and<br>
>> compliance) and Macroblock Tree ratecontrol (for better quality<br>
>> distribution among frames) require a significant lookahead; both of<br>
>> these features will be disabled if you turn off the lookahead.<br>
>> Obviously, for low-latency applications like videoconferencing, you<br>
>> have no choice.<br>
>><br>
>> Dark Shikari<br>
><br>
><br>
> I have to implement a transcoder that receive a frame by network and<br>
> downsize it for mobile device with low latency. B-adapt is set to 1, and i<br>
> have only one threads, i cannot access to param.rc.lookahead, and I don't<br>
> know if by default lookahead is disabled or not. If lookahead is disabled i<br>
> think that frame-delay is 1, in this case i think that the problem is not<br>
> caused by frame delay. Any suggest? Thanks.<br>
> Best regards<br>
<br>
</div></div>Of course you can access param.rc.i_lookahead; it's part of your<br>
x264_param_t. If you don't know how to access parameters in a struct,<br>
well, I can't help teach you to program in C.<br>
<br>
Lookahead is on by default and equal to 40 frames.<br>
<div><div></div><div class="h5"><br>
Dark Shikari<br></div></div></blockquote><div><br>Sorry, i not explain clear, i have this definition of the struct rc:<br>/*This is the rc struct definition contained in the definition of x264_param_t in h264.h*/<br>/* Rate control parameters */<br>
struct<br> {<br> int i_rc_method; /* X264_RC_* */<br><br> int i_qp_constant; /* 0-51 */<br> int i_qp_min; /* min allowed QP value */<br> int i_qp_max; /* max allowed QP value */<br>
int i_qp_step; /* max QP step between frames */<br><br> int i_bitrate;<br> float f_rf_constant; /* 1pass VBR, nominal QP */<br> float f_rate_tolerance;<br> int i_vbv_max_bitrate;<br>
int i_vbv_buffer_size;<br> float f_vbv_buffer_init; /* <=1: fraction of buffer_size. >1: kbit */<br> float f_ip_factor;<br> float f_pb_factor;<br><br> int i_aq_mode; /* psy adaptive QP. (X264_AQ_*) */<br>
float f_aq_strength;<br><br> /* 2pass */<br> int b_stat_write; /* Enable stat writing in psz_stat_out */<br> char *psz_stat_out;<br> int b_stat_read; /* Read stat from psz_stat_in and use it */<br>
char *psz_stat_in;<br><br> /* 2pass params (same as ffmpeg ones) */<br> float f_qcompress; /* 0.0 => cbr, 1.0 => constant qp */<br> float f_qblur; /* temporally blur quants */<br>
float f_complexity_blur; /* temporally blur complexity */<br> x264_zone_t *zones; /* ratecontrol overrides */<br> int i_zones; /* number of zone_t's */<br> char *psz_zones; /* alternate method of specifying zones */<br>
} rc;<br><br>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.<br>
</div></div>