Dear all, Thank you for reply. I have used x264 library. And I have the following code ....<br><br><br>AVCodecContext* m_pContext;<br>void Encoding()<br>{<br>        IplImage *image;<br>        av_register_all() ;<br>   avcodec_init();<br>

<br><br>    codec = avcodec_find_encoder(CODEC_ID_H264);<br>    m_pContext = avcodec_alloc_context();<br>    picture = avcodec_alloc_frame();<br>    avcodec_get_context_defaults(m_pContext);<br>    m_pContext->flags    |= CODEC_FLAG_4MV;<br>

    m_pContext->flags     |= CODEC_FLAG_PART;<br>    m_pContext->flags     |=CODEC_FLAG_TRUNCATED;<br>    m_pContext->flags2  |=  CODEC_FLAG2_CHUNKS;<br>    m_pContext->pix_fmt   =   PIX_FMT_YUV420P  /*It can be RGB also*/;<br>

    m_pContext->skip_frame = AVDISCARD_DEFAULT;<br>    m_pContext->error_concealment = 3;<br>    m_pContext->error_recognition = 1;<br>    m_pContext->skip_loop_filter = AVDISCARD_DEFAULT;<br>    m_pContext->workaround_bugs = 1;<br>

    m_pContext->codec_type = AVMEDIA_TYPE_VIDEO;<br>    m_pContext->codec_id = CODEC_ID_H264;<br><br><br>       x264_param_t param;<br>        x264_t *encoder;<br><br>        x264_param_default(&param);<br>        if(x264_param_default_preset(&param, "veryfast", "zerolatency") < 0)<br>

        {<br>            cout<<"Error on preset";<br>        }<br>        param.i_threads = 1;<br>        param.i_width = col;<br>        param.i_height = row;<br>        param.i_fps_num = fps;<br>        param.i_fps_den = 1;<br>

<br>        // Intra refres:<br>        param.i_keyint_max = fps;<br>        param.b_intra_refresh = 1;<br>        //Rate control:<br>        param.rc.i_rc_method = X264_RC_CRF;        //X264_RC_CRF    X264_ANALYSE_BSUB16x16        X264_ANALYSE_BSUB16x16<br>

        param.i_csp = X264_CSP_I420;            //X264_CSP_I420        X264_CSP_YV16<br>        param.rc.f_rf_constant = 25;//25<br>        param.rc.f_rf_constant_max = 25;//35<br>        //For streaming:<br>        param.b_repeat_headers =1;<br>

        param.b_annexb = 1;                //1<br><br>        x264_param_apply_profile(&param, "baseline");<br><br>        encoder = x264_encoder_open(&param);<br>        x264_encoder_parameters(encoder, &param );<br>

        int row = 480, col = 640;<br>        CvCapture *capt = cvCaptureFromCAM(0);<br>        <br>        while(true)<br>        {<br>               image = cvQueryFrame(capt);<br>               convertCtx =  sws_getContext (col, row , PIX_FMT_RGB24, col, row , PIX_FMT_YUV420P, SWS_FAST_BILINEAR, NULL, NULL, NULL);<br>

<br>              sws_scale ( convertCtx , (uint8_t**)&image->imageData, & srcstride, 0, col, pic_in.img.plane, pic_in.img.i_stride);<br>              i_frame_size = x264_encoder_encode( encoder, &headers, &i_nal, &pic_in, &pic_out );<br>

              decoding(heders[0].p_payload, i_frame_size);<br>      }<br>}<br><br>void decoding(uint8_t *data, int size)<br>{<br>    AVPacket *pkt;<br>    pkt = new AVPacket();<br>    int gotpicture;<br>   <br>    av_init_packet(pkt);<br>

    avcodec_get_frame_defaults(picture);<br><br>    pkt->data = data;<br>    pkt->size = size;<br>    int outSize = avcodec_decode_video2(m_pContext, picture, &gotpicture, pkt);<br>}<br><br>This is my brief code sniff.Please guide me how could I able to decode directly without using file.<br>

<br>Thanks and regards<br>Srikanta Mondal<br><br><br><div class="gmail_quote">On Mon, Apr 9, 2012 at 3:27 PM, NITIN GOYAL <span dir="ltr"><<a href="mailto:nitinkumgoyal@gmail.com">nitinkumgoyal@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Read the dranger docs on how to decode the NALs or see the example program from libav source to start with.<div><br></div>

<div>And if you have already done that, please share the issue you are finding.<div><div class="h5"><br><br><div class="gmail_quote">
On Mon, Apr 9, 2012 at 3:21 PM, Kalileo <span dir="ltr"><<a href="mailto:kalileo@universalx.net" target="_blank">kalileo@universalx.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><br>
On Apr 9, 2012, at 16:13 , srikanta mondal wrote:<br>
<br>
> Hi all,<br>
> I am Srikanta Mondal from India. I am working on video compression and sending each compressed frame to network.  I have done H.264 compression by using libx264 and the function x264_encoder_encode() and I have got the x264_nal_t for each frame. Now I have sent each compressed x264_nal_t  in the network and in the receiver side that that x264_nal_t  are dumping in a file. And another program just play the video using Opencv lib. But I want to just decode the x264_nal_t  structure in the receiver side without using the file. I have found there are some guidance with using ffmpeg library but unfortunately I have failed to use the decoder. Anybody please help me.<br>



<br>
</div>Sorry, I don't understand what you are trying to do.<br>
<br>
Please explain, and show also what you have done so far, and where exactly you have a problem.<br>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
</blockquote></div><br></div></div></div>
<br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br>