[Libav-user] Encode raw frame to vp8 in C++

Sartre Salam gmxubuntu at yahoo.de
Tue Sep 18 02:09:03 CEST 2012


Hi , I'm trying to encode raw frames to vp8. I use the example
which encode raw frames into a h264 file, I have use this example to encode a short
movie into an h264(without sound of course). Then I can see this h264 file with ffplay.
I think it should be posible to make the same but encode the file to vp8, and then see
this vp8 file with ffplay. Is it posible? Because I encode the file to vp8 but ffplay cant
encode it. Here is some of the code that I use to encode the raw frame:

AVCodec *output =  avcodec_find_encoder((AVCodecID)AV_CODEC_ID_VP8);

AVCodecContext *contextOutput = avcodec_alloc_context3(output);

contextOutput->bit_rate = 500* 1000;
contextOutput->rc_min_rate = coutput->rc_max_rate = coutput->bit_rate;

av_opt_set_double(coutput->priv_data, "max-intra-rate", 90, 0);
av_opt_set(coutput->priv_data, "quality", "realtime", 0);

contextOutput->thread_count = 4;
contextOutput->rc_buffer_aggressivity = 0.95;
contextOutput->rc_buffer_size = 500*1000*6;
contextOutput->profile = 3;
contextOutput->qmax = 54;
contextOutput->qmin = 4;

AVRational myrational = {1,25};
contextOutput->time_base= myrational;
contextOutput->gop_size = 99999;
contextOutput->pix_fmt = PIX_FMT_YUV420P; 

contextOutput->width = 800;
contextOutput->height = 600;

if(avcodec_open2(contextOutput,output,NULL)<0)
{
printf("no putput codec open\n");
return -1;
}

then
 with this AVCodecContext I try to encode the raw frame with the methode
 avcodec_encode_video2. It works for h264 but not for vp8, any idea about this topic would be very helpfull.

thnx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120918/f9258efe/attachment.html>


More information about the Libav-user mailing list