[Libav-user] Fw: Fw: Getting "No frame: error

krishnaks at iwavesystems.com krishnaks at iwavesystems.com
Mon Apr 23 12:16:32 CEST 2012


Hi Alex.

I thought I may need to add NAL units That why I added 0x00000001.

Please see the  code: Let me know If I am missing..

av_register_all();
codec = avcodec_find_decoder(CODEC_ID_H264);
		codecCtx = avcodec_alloc_context3(codec);

		codecCtx->width = width;
		codecCtx->height = height;

		codecCtx->extradata = (uint8_t*)av_malloc([frameData length]);
		codecCtx->extradata_size = [frameData length];
		[privateData getBytes:codecCtx->extradata length:codecCtx->extradata_size];
		codecCtx->pix_fmt = PIX_FMT_YUV420P;

		srcFrame = avcodec_alloc_frame();
		dstFrame = avcodec_alloc_frame();

        if(codec->capabilities&CODEC_CAP_TRUNCATED)
            codecCtx->flags|= CODEC_FLAG_TRUNCATED;

		int res = avcodec_open2(codecCtx, codec,NULL);
		if (res < 0)
		{
			NSLog(@"Failed to initialize decoder");
		}

      packet.data = (uint8_t*)[frameData bytes];
	packet.size = [frameData length];

	 int frameFinished = 0;

    int res = avcodec_decode_video2(codecCtx, srcFrame, &frameFinished,
&packet);


Regards,
KP
> ----- Original Message -----
> From: "Alex Cohn" <alexcohn at netvision.net.il>
> To: "This list is about using libavcodec, libavformat,
> libavutil,libavdevice
> and libavfilter." <libav-user at ffmpeg.org>
> Sent: Monday, April 23, 2012 3:03 AM
> Subject: Re: [Libav-user] Fw: Getting "No frame: error
>
>
>> On Mon, Apr 23, 2012 at 09:23,  <krishnaks at iwavesystems.com> wrote:
>>> Hi,
>>>
>>> I have prefixed each frame with 0x00000001 &
>>
>> Why?
>>
>>> I am getting Following error
>>>
>>> [h264 @ 0x906e400] non-existing PPS 0 referenced
>>>
>>>>>> VLC player able to play the input video. I will check with ffmpeg
>>>>>> util
>>
>> are you decoding a stream or a file? What is the file/stream format
>> (mpeg4, mkv, mp4)?
>>
>>>>>>> I have linked ffmpeg & live555 library to my IOS application.
>>>>>>> I am receiving the h264 encoded frame and sending the frame to
>>>>>>> dcoder.
>>>>>>> But Decoder throws the error:
>>>>>>>
>>>>>>> [h264 @ 0x8a4ac00] no frame!
>>
>> how do you initialize your decoder?
>>
>> BR,
>> Alex
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>
>



More information about the Libav-user mailing list