So I got the decoder to work with the parser! It was a bug on my end - However it still seems that the parser waits for the entire frame to complete and then sets an outsize? Is this intentional? Is it possible to decode a single NALU?
On Mon, Jun 10, 2013 at 2:57 PM, Faraz Khan <[email protected]> wrote: > So the keyframe cannot be fed to the decoder one nal at a time? Is that > what you are suggesting? > > > > > On Mon, Jun 10, 2013 at 2:40 PM, Andy Shaules <[email protected]> wrote: > >> I always had to decode from the latest key frame up to the desired >> stream time nal, >> >> >> On 6/10/2013 2:36 PM, Faraz Khan wrote: >> >> Hi all, >> I'm trying to use ffmpeg as a decoder for a real-time x264 stream that >> I'm generating. It works fine if I try to decode entire frames, but if I >> try to decode a single NALU the decoder errors out saying 'no frame'. I've >> tried using the parser (av_parser_parse2) but the h264 decoder doesnt seem >> to like that output either. I'm using x264 with annex-b and repeat-headers >> on. >> >> The encoder config is as follows: >> >> x264params.b_sliced_threads = 1; >> x264params.i_slice_max_size = 1350; >> x264params.i_width = yuvSize.width; >> x264params.i_height = yuvSize.height; >> x264params.i_fps_num = 10; >> x264params.i_fps_den = 1; >> x264params.b_vfr_input = 0; >> x264params.rc.i_bitrate = 1500; >> >> // Intra refres: >> x264params.i_keyint_max = 50000000; >> x264params.b_intra_refresh = 1; >> >> //Rate control: >> >> x264params.rc.i_rc_method = X264_RC_ABR; >> x264params.rc.i_vbv_buffer_size = 300; >> x264params.rc.i_vbv_max_bitrate = 1500; >> >> //For streaming: >> x264params.b_repeat_headers = 1; >> x264params.b_annexb = 1; >> >> x264_param_apply_profile(&x264params, "baseline"); >> >> >> >> I do the encode with: >> >> int frame_size = x264_encoder_encode(x264Encoder, &nals, &i_nals, & >> pic_in, &pic_out); >> >> >> Now, since the max slice size is 1350, each packet output is a udp >> packet of size < MTU (this is true) and sent across the network. >> >> I iterate over the nals[i].p_payload and send them over to the ffmpeg >> side for decoding. I receive the correct packet on the remote side. >> >> If I assemble ALL the NALUs that were output in this frame and feed it >> directly to the decoder (even without the parser), it works fine! If I feed >> one NALU at a time, it fails (event with the parse). I'm sending it to the >> parser like: >> >> >> int plen = av_parser_parse2(codecParser, decoderContext, &outbuf, >> &outside, indata,inlength,0,0,0); >> >> >> plen always reports that it consumed the entire NALU that I gave it - >> after consuming a few NALUs, the outsize and outbuf are set to some value. >> Feeding it into the decoder using: >> >> >> int len = avcodec_decode_video2(decoderContext,decoderOutframe, >> &gotpic,&avpkt); >> >> >> Results in it saying 'No frame'. Again, if avpkt.data contains the >> entire frame (all NALUs concatenated) it will work! >> >> >> I'm obviously doing some obviously wrong - but I really cant figure out >> why it wont decode a single NALU. Or is this a limitation in ffmpeg? >> >> >> Thanks Guys! >> >> >> >> >> -- >> Faraz Khan >> Simple Collaboration Screensharing >> www.screenhero.com >> >> >> _______________________________________________ >> Libav-user mailing >> [email protected]http://ffmpeg.org/mailman/listinfo/libav-user >> >> >> >> _______________________________________________ >> Libav-user mailing list >> [email protected] >> http://ffmpeg.org/mailman/listinfo/libav-user >> >> > > > -- > > -- > Faraz Khan > Simple Collaboration Screensharing > www.screenhero.com > -- -- Faraz Khan Simple Collaboration Screensharing www.screenhero.com
_______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
