[Libva] linux vaapi h.264 encoding haswell hd graphics 4600

Nik Orlov nikitos1550 at yandex.ru
Thu Mar 27 09:43:19 PDT 2014


Hello! Thanks for you answer!

Do you mean 3840x1080 (yuv420p) size of frame? Real time for me, is all that takes less than 1/25s for encoding one frame (with sending data to gpu and sending it back).
In my test I have started two 3840x1080 encodings at on time:
/h264encode -w 3840 -h 1080 -framecount 2500 -f 25
/h264encode -w 3840 -h 1080 -framecount 2500 -f 25

Ubuntu 13.04 has desktop env, and graphics during encoding was slow, but cpu was less 10%.
And I still have about 10ms for 1 frame for each encoding.

But, as you see when I encodes 1 frame (or 60 frames, less than 1000 or more) time for 1 frame is very big. Why is it so?
And I think it will be a problem with real time encoding :-(

Another problem is that it is much diffulty to use encoding via libva (at the moment I have expirience only with liavcodec (ffmpeg lib).
Could you advice me some tutorials or c/c++ program examples about h.264 libva encoding?


27.03.2014, 20:11, "Matt Pekar" <mpekar at raineyelectronics.com>:
> For that size of frame, 20ms is a pretty darn good time IMO.  We see 10ms (ish) on things in the 1280x720 range.
>
> Since your input stream is only 25fps, the encoder will be able to provide near real-time output, with just a 20ms delay before writing each frame.
>
> If you were trying to do 60fps then you wouldn't be able to do "real time" at all since you'd be falling behind 5ms every frame.
>
> On Thu, Mar 27, 2014 at 5:57 AM, Nik Orlov <nikitos1550 at yandex.ru> wrote:
>> Hello!
>>
>> I have ubuntu-desktop 13.10 amd64 on core i7 4770 (Haswell, HD graphics 4600).
>> I have installed vaapi (libva from sources 1.3.0).
>>
>> There is h264encode test. I have started it:
>>
>> user at video-ubuntu:~/VAAPI/libva-1.3.0/test/encode$ ./h264encode -w 3840 -h 1080 -framecount 1 -f 25
>> Source frame is 3840x1080 and will code clip to 3840x1088 with crop
>>
>> INPUT:Try to encode H264...
>> INPUT: RateControl  : VBR
>> INPUT: Resolution   : 3840x1080, 1 frames
>> INPUT: FrameRate    : 25
>> INPUT: Bitrate      : 24883200
>> INPUT: Slieces      : 1
>> INPUT: IntraPeriod  : 30
>> INPUT: IDRPeriod    : 60
>> INPUT: IpPeriod     : 1
>> INPUT: Initial QP   : 26
>> INPUT: Min QP       : 0
>> INPUT: Source YUV   : AUTO generated
>> INPUT: Coded Clip   : /tmp/test.264
>> INPUT: Rec   Clip   : Not save reconstructed frame
>>
>> libva info: VA-API version 0.35.0
>> libva info: va_getDriverName() returns 0
>> libva info: Trying to open /usr/local/lib/dri/i965_drv_video.so
>> libva info: Found init function __vaDriverInit_0_35
>> libva info: va_openDriver() returns 0
>> Use profile VAProfileH264High
>> Support rate control mode (0x12):CBR CQP
>> Support VAConfigAttribEncPackedHeaders
>> Support packed sequence headers
>> Support packed picture headers
>> Support packed misc headers
>> Support 1 RefPicList0 and 1 RefPicList1
>> Loading data into surface 15.....Complete surface loading
>>       |00000000(485835 bytes coded)
>>
>> PERFORMANCE:   Frame Rate           : 0.06 fps (1 frames, 16500 ms (16500.00 ms per frame))
>> PERFORMANCE:   Compression ratio    : 12:1
>> PERFORMANCE:     UploadPicture      : 16444 ms (16444.00, 99.66% percent)
>> PERFORMANCE:     vaBeginPicture     : 0 ms (0.00, 0.00% percent)
>> PERFORMANCE:     vaRenderHeader     : 0 ms (0.00, 0.00% percent)
>> PERFORMANCE:     vaEndPicture       : 3 ms (3.00, 0.02% percent)
>> PERFORMANCE:     vaSyncSurface      : 32 ms (32.00, 0.19% percent)
>> PERFORMANCE:     SavePicture        : 0 ms (0.00, 0.00% percent)
>> PERFORMANCE:     Others             : 21 ms (21.00, 0.13% percent)
>> (Multithread enabled, the timing is only for reference)
>>
>> And other way
>>
>> user at video-ubuntu:~/VAAPI/libva-1.3.0/test/encode$ ./h264encode -w 3840 -h 1080 -framecount 2500 -f 25
>> Source frame is 3840x1080 and will code clip to 3840x1088 with crop
>>
>> INPUT:Try to encode H264...
>> INPUT: RateControl  : VBR
>> INPUT: Resolution   : 3840x1080, 2500 frames
>> INPUT: FrameRate    : 25
>> INPUT: Bitrate      : 24883200
>> INPUT: Slieces      : 1
>> INPUT: IntraPeriod  : 30
>> INPUT: IDRPeriod    : 60
>> INPUT: IpPeriod     : 1
>> INPUT: Initial QP   : 26
>> INPUT: Min QP       : 0
>> INPUT: Source YUV   : AUTO generated
>> INPUT: Coded Clip   : /tmp/test.264
>> INPUT: Rec   Clip   : Not save reconstructed frame
>>
>> libva info: VA-API version 0.35.0
>> libva info: va_getDriverName() returns 0
>> libva info: Trying to open /usr/local/lib/dri/i965_drv_video.so
>> libva info: Found init function __vaDriverInit_0_35
>> libva info: va_openDriver() returns 0
>> Use profile VAProfileH264High
>> Support rate control mode (0x12):CBR CQP
>> Support VAConfigAttribEncPackedHeaders
>> Support packed sequence headers
>> Support packed picture headers
>> Support packed misc headers
>> Support 1 RefPicList0 and 1 RefPicList1
>> Loading data into surface 15.....Complete surface loading
>>       \00002499(719089 bytes coded)
>>
>> PERFORMANCE:   Frame Rate           : 53.70 fps (2500 frames, 46555 ms (18.62 ms per frame))
>> PERFORMANCE:   Compression ratio    : 11:1
>> PERFORMANCE:     UploadPicture      : 16364 ms (6.55, 35.15% percent)
>> PERFORMANCE:     vaBeginPicture     : 2 ms (0.00, 0.00% percent)
>> PERFORMANCE:     vaRenderHeader     : 18 ms (0.01, 0.04% percent)
>> PERFORMANCE:     vaEndPicture       : 1098 ms (0.44, 2.36% percent)
>> PERFORMANCE:     vaSyncSurface      : 21385 ms (8.55, 45.93% percent)
>> PERFORMANCE:     SavePicture        : 8759 ms (3.50, 18.81% percent)
>> PERFORMANCE:     Others             : -1071 ms (1717986.49, 9225574.54% percent)
>> (Multithread enabled, the timing is only for reference)
>>
>> So, when test encodes more frames time for encoding 1 frame is about 20ms.
>> Why it is so?
>>
>> My primary question, if I want to encode video in real time (It means camera sends me frame each 40ms), what time for encoding 1 frame I will get?
>> As I understand programm sends some data to GPU, GPU encodes video and then send me encoded data back.
>> How much time takes sending data to GPU and back?
>>
>> Maybe it will possible to encode each frame in real time, or maybe it isn`t possible, but It is possible to keep some buffer (for example for 25 frames - 1 sec of video) and than encode ot very fast.
>>
>> --
>> Ник Орлов mailto:nikitos1550 at yandex.ru
>> _______________________________________________
>> Libva mailing list
>> Libva at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/libva

-- 
Ник Орлов mailto:nikitos1550 at yandex.ru


More information about the Libva mailing list