Set AVC/H.264 profile when encoding video in Android using MediaCodec API -
android provides way query supported encoding profiles. when setting encoder cannot find way specify desired profile used.
finding supported profile/level pairs
using mediacodec
api in android can call getcodecinfo()
once have chosen encoder component. returns mediacodecinfo
object provides details codec component being used. getcapabilitiesfortype()
returns codeccapabilities
object, detailing codec capable of. contains array of codecprofilelevels detail supported profiles , levels supported.
trying set profile
i can't see field set profile mediecodec
or mediaformat
.
there key_aac_profile
mediaformat
, in reference explicitly states aac audio only.
in mediacodec
there way pass bundle
of parameters codec using setparameters()
. looks has no generic documentation, , parameters accepted different between codecs (different devices).
background
profiles specify set of encoding features use. simple profiles less computationally intense, sacrifice quality given bit rate result. levels specify maximum resolution / bit-rate supported given profile. expected levels associated decoding capability, since describing hardware encoder has run in real time, having maximum setting makes sense me.
meta: (i had lot more links each class + function mentioned, had remove them because don't yet have rep post more 2 links.)
there no explicit profile selection in mediacodec api. codec select profile on own. select level based on input width/height , frame-rate numbers, may select level higher minimum required configuration.
you can query encoder codec supported levels see profiles may generate, not able select preferred one. codec select highest profile can handle given level, there no guarantee that.
Comments
Post a Comment