打开media_profiles.xml,media_profiles.xml最前面可以看到系统支持的文件格式,codec 格式等等,比如
<!ELEMENT EncoderOutputFileFormat EMPTY>
<!ATTLIST EncoderOutputFileFormat name (mp4|3gp) #REQUIRED>就表示支持mp4/3gp这两种文件格式
<EncoderProfile quality="low" fileFormat="3gp" duration="30">==>
而如果fileformat想换成mp4,将fileFormat="3gp"改成fileFormat="mp4"即可
<Video codec="h263"//如果codec格式想换成h264,将 codec="h263"改成 codec="h264"即可,目前只支持h263、h264、MPEG4
bitRate="192000"
width="176"
height="144"
frameRate="20" />//如果要修改framerate为30,将frameRate="20"改为frameRate="30"即可,极限取决于IC能力
<Audio codec="aac"==>//如果要改为amr,将codec="aac"改为 codec="amr"即可,目前只支持amr和AAC
bitRate="128000"
sampleRate="48000"
channels="2" />
</EncoderProfile>
................................
<ImageEncoding quality="95" />==>用于设置默认image encode的quality,无需关注
<ImageEncoding quality="80" />
<ImageEncoding quality="70" />
<ImageDecoding memCap="20000000" />==>跟image decode相关,无需关注
</CamcorderProfiles>
<EncoderOutputFileFormat name="3gp" />
<EncoderOutputFileFormat name="mp4" />
<!--
If a codec is not enabled, it is invisible to the applications
In other words, the applications won't be able to use the codec
or query the capabilities of the codec at all if it is disabled
-->
<VideoEncoderCap name="h264" enabled="true"
minBitRate="64000" maxBitRate="40000000"
minFrameWidth="176" maxFrameWidth="1920"
minFrameHeight="144" maxFrameHeight="1080"==>如果要设置比当前maxFrameHeight还大的分辨率,这里需要同步修改,其他选项类似
minFrameRate="15" maxFrameRate="30" />
<VideoEncoderCap name="h263" enabled="true"
minBitRate="64000" maxBitRate="2000000"
minFrameWidth="176" maxFrameWidth="800"==>如果CTS testRecorderRandomAction fail,则请将maxFrameWidth="640"//"800"再试试
minFrameHeight="144" maxFrameHeight="480"
minFrameRate="15" maxFrameRate="30" />
<VideoEncoderCap name="m4v" enabled="true"
minBitRate="64000" maxBitRate="4000000"
minFrameWidth="176" maxFrameWidth="720"
minFrameHeight="144" maxFrameHeight="480"
minFrameRate="15" maxFrameRate="30" />
<AudioEncoderCap name="aac" enabled="true"
minBitRate="758" maxBitRate="288000"
minSampleRate="8000" maxSampleRate="48000"
minChannels="1" maxChannels="1" />
<AudioEncoderCap name="heaac" enabled="true"
minBitRate="8000" maxBitRate="64000"
minSampleRate="16000" maxSampleRate="48000"
minChannels="1" maxChannels="1" />
<AudioEncoderCap name="aaceld" enabled="true"
minBitRate="16000" maxBitRate="192000"
minSampleRate="16000" maxSampleRate="48000"
minChannels="1" maxChannels="1" />
<AudioEncoderCap name="amrwb" enabled="true"
minBitRate="6600" maxBitRate="23050"
minSampleRate="16000" maxSampleRate="16000"
minChannels="1" maxChannels="1" />
<AudioEncoderCap name="amrnb" enabled="true"
minBitRate="5525" maxBitRate="12200"
minSampleRate="8000" maxSampleRate="8000"
minChannels="1" maxChannels="1" />==>这部分我们基本上是基于Google默认的设置,少部分会修改,但如果要修改,基本上都可以参照谷歌的文档和IC的能力将对应的值改成最大值
<!--
FIXME:
We do not check decoder capabilities at present
At present, we only check whether windows media is visible
for TEST applications. For other applications, we do
not perform any checks at all.
-->
<VideoDecoderCap name="wmv" enabled="true"/>==>没有什么用,只是去check Windows的test APP,具体如上面的FIXME
<AudioDecoderCap name="wma" enabled="true"/>
</MediaSettings>
需要小心的是修改item后要注意CTS测项testGetWithId(android.media.cts.CamcorderProfileTest),也就是high profile一定要和分辨率的profile适配,比如spec为1920 x 1080的spec
那么high的分辨率和1080p的分辨率一定要一样
1 2 3 4 5 6 7 8 9 10 11 |
<<span class="n">EncoderProfile</span> <strong>quality=</strong><span class="s">"1080p"</span> <strong>fileFormat=</strong><span class="s">"3gp"</span> <strong>duration=</strong><span class="s">"30"</span>> <<span class="n">Video</span> <strong>codec=</strong><span class="s">"h264"</span> <strong>bitRate=</strong><span class="s">"17000000"</span> <strong>width=</strong><span class="s">"1920"</span> <strong>height=</strong><span class="s">"1080"</span> <strong>frameRate=</strong><span class="s">"30"</span> /> <<span class="n">Audio</span> <strong>codec=</strong><span class="s">"aac"</span> <strong>bitRate=</strong><span class="s">"128000"</span> <strong>sampleRate=</strong><span class="s">"48000"</span> <strong>channels=</strong><span class="s">"2"</span> /> </<span class="n">EncoderProfile</span>> |
1 2 3 4 5 6 7 8 9 10 11 |
<<span class="n">EncoderProfile</span> <strong>quality=</strong><span class="s">"high"</span> <strong>fileFormat=</strong><span class="s">"3gp"</span> <strong>duration=</strong><span class="s">"30"</span>> <<span class="n">Video</span> <strong>codec=</strong><span class="s">"h264"</span> <strong>bitRate=</strong><span class="s">"17000000"</span> <strong>width=</strong><span class="s">"1920"</span> <strong>height=</strong><span class="s">"1080"</span> <strong>frameRate=</strong><span class="s">"30"</span> /> <<span class="n">Audio</span> <strong>codec=</strong><span class="s">"aac"</span> <strong>bitRate=</strong><span class="s">"128000"</span> <strong>sampleRate=</strong><span class="s">"48000"</span> <strong>channels=</strong><span class="s">"2"</span> /> </<span class="n">EncoderProfile</span>> |