【android】android 编码文件概述

文章目录

1 概述

需要小心的是修改item后要注意CTS测项testGetWithId(android.media.cts.CamcorderProfileTest),也就是high profile一定要和分辨率的profile适配,比如spec为1920 x 1080的spec(平台所supprot的)
那么high的分辨率和1080p的分辨率一定要一样

     <EncoderProfile quality="1080p" fileFormat="3gp" duration="30">
            <Video codec="h264"
                   bitRate="17000000"
                   width="1920"
                   height="1080"
                   frameRate="30" />
            <Audio codec="aac"
                   bitRate="128000"
                   sampleRate="48000"
                   channels="2" />
        </EncoderProfile>
        <EncoderProfile quality="high" fileFormat="3gp" duration="30">
            <Video codec="h264"
                   bitRate="17000000"
                   width="1920"
                   height="1080"
                   frameRate="30" />
            <Audio codec="aac"
                   bitRate="128000"
                   sampleRate="48000"
                   channels="2" />
        </EncoderProfile>

2 标准尺寸

详细参考谷歌官网说明:

https://developer.android.com/reference/android/media/CamcorderProfile.html#QUALITY_1080P

public static final int QUALITY_1080P 
public static final int QUALITY_2160P
public static final int QUALITY_2K
public static final int QUALITY_480P
public static final int QUALITY_4KDCI
public static final int QUALITY_720P
public static final int QUALITY_8KUHD
public static final int QUALITY_CIF
public static final int QUALITY_HIGH
public static final int QUALITY_HIGH_SPEED_1080P
标准尺寸常量值
QUALITY_1080P1920x10806 (0x00000006)
QUALITY_2160P3840x21608 (0x00000008)
QUALITY_2K2048x108012 (0x0000000c)
QUALITY_480P720 x 4804 (0x00000004)
QUALITY_4KDCI4096 x 216010 (0x0000000a)
QUALITY_720P1280 x 7205 (0x00000005)
QUALITY_8KUHD7680 x 432013 (0x0000000d)
QUALITY_CIF352 x 2883 (0x00000003)
QUALITY_HIGHQuality level corresponding to the highest available resolution.1 (0x00000001)
QUALITY_HIGH_SPEED_1080PHigh speed ( >= 100fps) quality level corresponding to the 1080p (1920 x 1080 or 1920x1088) resolution.2004 (0x000007d4)
QUALITY_HIGH_SPEED_2160PHigh speed ( >= 100fps) quality level corresponding to the 2160p (3840 x 2160) resolution.2005 (0x000007d5)

可以通过如下代码获取到所支持的编码尺寸

public static EncoderProfiles getAll (String cameraId, 
                int quality)
这个文件实际对应camera video 调用关系.

系统启动后,通过CamcorderProfile.java:static{ } 块,初始化并解析好。以供上层获取。

进入录像模式后:VideoMode.java:initRecorder——>configRecoderSpec——>getProfile,去获取摄像头或录像的默认配置。

native层主要是在 /frameworks/av/media/libmedia/MediaProfiles.cpp 文件里加载和检查参数。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

高启强不卖鱼

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值