[libav-api] libav-api Digest, Vol 42, Issue 3

Prashanth Bhat prashanth_b_bhat at yahoo.com
Fri Aug 8 13:57:16 CEST 2014

Hi wm4, Thanks for your response and the suggestion. 

As mentioned, I'm using Ubuntu 14.04 on a Haswell CPU. The FFMPEG version is 2.1

The very same code worked better when used with Ubuntu 11.10 on a Sandybridge CPU and FFMPEG 0.9

I didn't explicitly use VAAPI or VDPAU. However, the load average was reasonably low. It was after the upgrade that the load average is much higher. 

Even without hardware acceleration, I would have liked to get better performance with the new hardware, new OS, and new FFMPEG. It's strange that this isn't seen. Perhaps the default options that worked with FFMPEG 0.8 no longer work with 2.1, and I need to make some explicit API calls?


On Friday, August 8, 2014 3:30 PM, "libav-api-request at libav.org" <libav-api-request at libav.org> wrote:

Send libav-api mailing list submissions to
    libav-api at libav.org

To subscribe or unsubscribe via the World Wide Web, visit
or, via email, send a message with subject or body 'help' to
    libav-api-request at libav.org

You can reach the person managing the list at
    libav-api-owner at libav.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of libav-api digest..."

Today's Topics:

   1. Re: H.264 decoder using libavcodec (wm4)


Message: 1
Date: Fri, 8 Aug 2014 01:18:11 +0200
From: wm4 <nfxjfg at googlemail.com>
To: libav-api at libav.org
Subject: Re: [libav-api] H.264 decoder using libavcodec
Message-ID: <20140808011811.5ccc38b6 at debian>
Content-Type: text/plain; charset=UTF-8

On Tue, 5 Aug 2014 03:10:36 -0700
Prashanth Bhat <prashanth_b_bhat at yahoo.com> wrote:

> Hi,
> I'm using libavcodec to perform decoding of H.264 frames.?
> I'm on a Linux environment (14.04 Xubuntu), and Intel Haswell CPU.
> My program decodes the frames, without rendering them on the screen. With 4 simultaneous decodes of 1080p resolution and 15 fps, the CPU utilization is around 90% (not bad), but the load average shown by 'top' is 20+
> This looks excessive. I don't think I'm using the hardware decoding ability of the Haswell CPU. Could someone please advise how to find out if I'm effectively using the decoder?

Hardware decoding is a completely different beast from CPU decoding.
libavcodec only provides a part of what is involved with hardware
decoding. You need to use VA-API (Intel's library for hw decoding) and
need to set it up to work with libavcodec. This is non-trivial, and
unfortunately there isn't even a sample. There are examples for DXVA,
VDA, and VDPAU, but none for VAAPI yet.

Since VDPAU is conceptually still relatively similar to VAAPI, you
might have some success understanding how it works and what you have to
do by looking at the VDPAU example:


> The API calls I'm making are pretty standard -?
> avcodec_register_all();
> avcodec_alloc_context3(NULL);
> avcodec_find_decoder(AV_CODEC_ID_H264);
> av_parser_init(AV_CODEC_ID_H264);
> avcodec_open2();
> The above calls are made during initialization. The below calls are made on each frame -
> av_parser_parse2
> avcodec_decode_video2
> The following points are probably relevant -?
> a) The default context allocated by avcodec_alloc_context3() does not have any hw_accel associated with it. I allocated a h264_vaapi accelerator, but this doesn't lead to any improvement.
> b) The codec capabilities does not have the HW_ACCEL bit set.
> Any help would be appreciated.?
> Thanks,
> Prashanth
> _______________________________________________
> libav-api mailing list
> libav-api at libav.org
> https://lists.libav.org/mailman/listinfo/libav-api


Subject: Digest Footer

libav-api mailing list
libav-api at libav.org


End of libav-api Digest, Vol 42, Issue 3

More information about the libav-api mailing list