[libav-api] H.264 decoder using libavcodec

Prashanth Bhat prashanth.bhat at yahoo.com
Sun Aug 10 12:08:48 CEST 2014

>>Hi Luca, >>>>I used release 10.3 of libav on the Haswell CPU. I see the high load average of 20+ for just 4 decode channels of 1080p. >>Any idea why the load average is so high, and how to bring it down? 

Thanks for your response.
>Some questions:
>- which operating system are you using?
Xubuntu 14.04
>- how do you test it? If you are using avconv the command line to test
>it would be nice, even better if you can give me access to a sample.
Our application uses the API calls like avcodec_decode_video2() and avparser_parse2(). We run the application, and look at the overall CPU usage and load average in the output of top.
Here's a code sample:
ctx = avcodec_alloc_context3(NULL);

codec = avcodec_find_decoder(AV_CODEC_ID_H264);
parser = av_parser_init(AV_CODEC_ID_H264);

avcodec_open2(ctx, codec, NULL);

av_frame = avcodec_alloc_frame();

len = av_parser_parse2(parser, ctx, &data_buf, &data_size, buf, buf_size, 0, 0, AV_NOPTS_VALUE);
if(data_size > 0) {

AVPacket pkt; av_init_packet(&pkt); pkt.data = data_buf; pkt.size = data_size; ret = avcodec_decode_video2(ctx, av_frame, &got_picture, &pkt);


>- are you using the vaapi hwaccel? It is the only backend supporting
>Hanswell in release 10 (and 11).
We compiled the libva with the vaapi hwaccel flag enabled. However, our code isn't explicitly using an vaapi calls. 

Thanks again,

More information about the libav-api mailing list