Hi,

I am trying to encode  buffered raw image into an .mpeg video. searching
through the forums I found out to
make my own url protocol an register it with ffmpeg.Since I am new to
FFMPEG, I tried it out and its not working.

Could someone please suggest me where I am wrong, the code snippet is:

/*=====================================================================================*/
AVProbeData *pd;
int n;
register_protocol(&hpany_protocol);

     fill_yuv_image(tmp_picture, 0, 640, 480); //I am trying to encode the
tmp_picture->data, taking it as a raw buffer for testing, taken from
output_example.c

     pd = (AVProbeData *)malloc(sizeof(AVProbeData));
     pd->buf_size = 3200;
     pd->buf = (unsigned char *)malloc(pd->buf_size);
     pd->filename = "__url_prot";

    if((n = hpany_write(pd,(unsigned char
*)tmp_picture->data,sizeof(tmp_picture->data))) <
sizeof(tmp_picture->data)){
    printf("\nOPEN_VID: Error in Hpany_write");
    return TRANS_FAILURE;
    }


    n = init_put_byte(&s, pd->buf, pd->buf_size, 1, NULL, NULL, NULL, NULL);

    if (n != 0){
    printf("\nOPEN_VID: Error in init_put_byte");
    return TRANS_FAILURE;
    }

    if((m_pInputFormat = av_probe_input_format(pd, 1))==NULL){
    printf("\nOPEN_VID: Error in av_probe_input_format");
    return TRANS_FAILURE;
    }

    s.is_streamed = 1;

    if((av_open_input_stream(&oc, &s, "", m_pInputFormat, NULL))== NULL){
    printf("\nError in opening Input stream");
        return  TRANS_FAILURE;
    }
/*===========================================================
Where the hpany_write is:
=============================================================*/
{
 printf("\nsize of raw data = %d, size of buf= %d\n",size,h->buf_size);

 printf("\nRaw Data = %s",raw_data);

 memcpy(h->buf, raw_data, size);

 printf("\nBuf Data = %s",h->buf);

 return size;
 }


/*=================================================================
The op I get is something like:
==================================================================*/

Output #0, avi, to 'op.mpg':
Stream #0.0: Video: mpeg2video, yuv420p, 288x288, q=2-31, 2000 kb/s, 25.00 t
b(c)

In Hpany Write
size of raw data = 16, size of buf= 3200

Raw Data = P
Buf Data = P
OPEN_VID: Error in av_probe_input_formatAPP:Error in Open Video


Thanks
Anand
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to