[x265] no SPS/PPS yet, * will be dropped
Deepthi Nandakumar
deepthipnandakumar at gmail.com
Fri Aug 12 03:44:34 CEST 2016
You're handling pNals wrongly. framesize may be 1, but number of NALs in
the stream may be greater than 1 (=iNal). So you need to copy all of those,
not just pNals[0].
On 12-Aug-2016 2:53 am, "Dolevo Jay" <cmst at live.com> wrote:
> Hi all,
>
>
> In my encoder application, I initialize the encoder as follows:
>
>
> param = x265_param_alloc();
>
> x265_param_default(param);
>
> x265_param_default_preset(param, "ultrafast", "zerolatency");
>
> param->fpsNum = 25;
>
> param->fpsDenom = 1;
>
> param->bRepeatHeaders = true;
>
> param->internalCsp = X265_CSP_I420;
>
> param->sourceWidth = aWidth;
>
> param->sourceHeight = aHeight;
>
>
> y_size = param->sourceWidth * param->sourceHeight;
>
>
> param->logLevel = X265_LOG_FULL;
>
>
> encoder = x265_encoder_open(param);
>
> if (NULL == encoder) {
>
> printLog("[X265] x265_encoder_open err");
>
> return;
>
> }
>
> param->internalCsp = X265_CSP_I420;
>
>
> pic_in = x265_picture_alloc();
>
> x265_picture_init(param, pic_in);
>
> pic_in->planes[0] = new char[32000000];
>
> pic_in->planes[1] = new char[32000000];
>
> pic_in->planes[2] = new char[32000000];
>
> pic_in->stride[0] = aWidth;
>
> pic_in->stride[1] = aWidth;
>
> pic_in->stride[2] = aWidth;
>
>
> pic_out = x265_picture_alloc();
>
> x265_picture_init(param, pic_out);
>
>
>
> Then, I apply the following function for each incoming frame:
>
>
> int frame_size = 0;
>
>
> x265_picture pic_out1;
>
> frame_size = x265_encoder_encode(encoder, &pNals, &iNal, pic_in, NULL);
>
> if (frame_size < 0) {
>
> printLog("[ERROR] H265: x265_encoder_encode failed.");
>
> return;
>
> }
>
> if (frame_size > 0) {
>
> memcpy(aFramebuffer, pNals[0].payload, pNals[0].sizeBytes);
>
> *aFrameBufferSize = pNals[0].sizeBytes;
>
> }
>
>
> dumpfileEncodedData.write((const char *)aFramebuffer, *aFrameBufferSize);
>
>
>
> Just to debug the encoded bitstream, I dump the data into a file
>
>
>
> _______________________________________________
> x265-devel mailing list
> x265-devel at videolan.org
> https://mailman.videolan.org/listinfo/x265-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/x265-devel/attachments/20160812/5c962988/attachment.html>
More information about the x265-devel
mailing list