您的位置:首页 > 其它

When does VideoToolbox' VTCompressionSession benefit from hardware acceleration?

2015-11-19 00:46 1331 查看
来源:http://stackoverflow.com/questions/19256897/when-does-videotoolbox-vtcompressionsession-benefit-from-hardware-acceleration

When does VideoToolbox' VTCompressionSession benefit from hardware acceleration?






up vote 1 down vote favorite
1

I've been working on the gstreamer applemedia encoder plugins and improved the VideoToolbox based video encoding. Running a gstreamer pipeline like:

$ gst-launch-1.0 filesrc location=source.avi ! decodebin  ! vtenc_h264 ! h264parse ! qtmux name=mux ! filesink location=sink.mp4

I was expecting to see a very low CPU usage when encoding h264 video using
VTCompressionSession
on Mac OS systems. However, on the systems I've tested: Mid 2009 Macbook Pro with GeForce 9600M and Mid 2011 Mac mini with Radeon HD 6630M the encoding still consumes between 80% and 130% CPU - which indicates it's not hardware accelerated.

On which hardware configurations, or given which compression parameters (for example for which
kVTCompressionPropertyKey_ProfileLevel
) does
VTCompressionSession
use hardware accelerated encoding?

osx gstreamer video-encoding hardware-acceleration core-video
shareimprove this question
asked Oct 8 '13 at 19:44



drott

393211

add a comment


2 Answers

active
oldest
votes

up vote
3
down vote

accepted

According to http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/applemedia/vtenc.c
you are passing in NULL to VTCompressionSessionCreate() for the
encoderSpecification parameter. Create an encoder specification
dictionary with
kVTVideoEncoderSpecification_EnableHardwareAcceleratedVideoEncoder set
to kCFBooleanTrue.

shareimprove this answer

answered Feb 1 '14 at 2:17



user3196356

762

Yes, that's a good answer. In
the meantime, I also found this Handbrake branch where they have more
details on these undocumented (?) parameters for the API. github.com/galad87/HandBrake-QuickSync-Mac/commit/… - Any additional to pointers to documentation or more details would be helpful.
drott
Feb 3 '14 at 12:44

add a comment

up vote
1
down vote

The above pipeline will not help you much on determining whether it's
actually the encoding process that's responsible for the high CPU
usage. There is no sync with the clock in the stream, which means the
whole process of decode/encode will go as fast as it can.

Since decodebin is probably using a software decoder, the high CPU
usage you are experiencing is most likely due to the decoding process.

I would recommend to compare the output with:

gst-launch-1.0 videotestsrc is-live=true ! vtenc_h264 ! qtmux ! filesink location=test.mp4

Note specially the property "is-live=true" which is instructing videotestsrc to act as a live source and therefore pushing buffers at a constant rate and not as fast as downstream can consume them.

shareimprove this answer
answered Oct 17 '13 at 0:51



ylatuya

1662

add a comment

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: