1. Enhance the Android multimedia framework providing additional Plugins for
user interaction
2. FFmpeg provides demuxers and av codecs;
-3. NamExtractor is a extractor plugin, it would be loaded by Stagefright when
- Stagefright started. NamExtractor will load FFmpegExtractor.FFmpegExtractor
- is the reference to "ffmpeg/ffplay" to achieve.
+3. FFmpegExtractor is a extractor plugin.
4. libstagefright_soft_ffmpegvdec plugin is video decoder
5. libstagefright_soft_ffmpegadec plugin is audio decoder
Requirements
================================================================================
-CyanogenMod 9.x (Ice Cream Sandwich)
-http://wiki.cyanogenmod.com/wiki/Galaxy_Nexus_(GSM):_Compile_CyanogenMod_(Linux)
+1. android_frameworks_native:
+https://github.com/omxcodec/android_frameworks_native.git
+branch: cm_maguro-10.1
-FFMPEG-1.0 release
-http://ffmpeg.org
-ref: git://android.git.linaro.org/platform/external/ffmpeg.git
+2. android_frameworks_av:
+https://github.com/omxcodec/android_frameworks_av.git
+branch: cm_maguro-10.1
+
+3. android_external_ffmpeg
+git@github.com:omxcodec/android_external_ffmpeg
+branch: cm_maguro-10.1
================================================================================
How to build
================================================================================
1. Get the Source
- clone cm-9.1.0 source from CyanogenMod git:
- repo init -u git://github.com/CyanogenMod/android.git -b cm-9.1.0
- plz ref: http://wiki.cyanogenmod.com/wiki/Galaxy_Nexus_(GSM):_Compile_CyanogenMod_(Linux)
-
- clone my sources from the omxcodec{github} git!
in your "android/external" folder, run:
- stagefright-plugins:
+ stagefright-plugins(branch: master):
git clone git@github.com:omxcodec/stagefright-plugins.git stagefright-plugins
- ffmpeg:
- git clone git@github.com:omxcodec/android_external_ffmpeg.git ffmpeg -b omxcodec-1.0
-
- in your "android/external" folder, run:
- cp stagefright-plugins/repo/local_manifest.xml ../.repo
- cd .. // go to android folder
- repo sync // sync "frameworks_base" code again!
-
- "repo sync" sync "frameworks_base" code again! of course, you can merge my
- android_external_ffmpeg code instread of "repo sync" frameworks_base. once you do,
- so you should pay attention to the "USES_NAM" flag, it is only in the
- "android/frameworks/base" directory
+ ffmpeg(branch: cm_maguro-10.1):
+ git clone git@github.com:omxcodec/android_external_ffmpeg.git ffmpeg -b cm_maguro-10.1
+
+ android_frameworks_native and android_frameworks_av:
+ you should merge my android_frameworks_native(branch: cm_maguro-10.1) and
+ android_frameworks_av(branch: cm_maguro-10.1) code. once you do, you should pay attention to
+ the "USES_NAM" flag, it is only in the "android/frameworks/native" and "android/frameworks/av"
+ directories.
2. Compile
- add USES_NAM flag to COMMON_GLOBAL_CFLAGS in android build system
- vi vendor/samsung/maguro/BoardConfigVendor.mk and add these lines to it
- USES_NAM := true
- ifdef USES_NAM
- COMMON_GLOBAL_CFLAGS += -DUSES_NAM
- endif
-
- ffmpeg:
- cd android/external/ffmpeg
- mm ffmpeg // NOT "mm", plz FIXME!
-
- cd android/external/stagefright-plugins
- mm
+ compile your android source tree again!
3. Install
adb root
get test media files:
wget http://movies.apple.com/media/us/ipad/2012/tv-spots/apple-ipad-this_good-us-20120307_848x480.mov
wget http://movies.apple.com/media/us/ipad/2012/80ba527a-1a34-4f70-aae8-14f87ab76eea/tours/apple-ipad-feature-us-20120307_848x480.mp4
+ wget http://ftp.kw.bbc.co.uk/hevc/hm-10.0-anchors/bitstreams/i_main/BQMall_832x480_60_qp22.bin
let us suppose your media files locate at "/sdcard/Movies/" folder.
one console window, you should run:
+ adb logcat -c //clears (flushes) the entire log and exits.
adb logcat
and other cosole window, you should run:
- test NamExtractor and FFmpegExtractor plugins:
+ test FFmpegExtractor plugins:
adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/apple-ipad-this_good-us-20120307_848x480.mov -t video/*
adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/apple-ipad-feature-us-20120307_848x480.mp4 -t video/*
test SoftFFmpegVideo decoder plugin:
adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/apple-ipad-this_good-us-20120307_848x480.mov -t video/*
adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/apple-ipad-feature-us-20120307_848x480.mp4 -t video/*
+ test HEVC(H.265) decoder:
+ cd android/external/stagefright-plugins/tools folder, run:
+ adb root
+ ./install // install my scripts
+ adb root && adb shell set-vdec-drop // disable drop video frames
+ adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/BQMall_832x480_60_qp22.bin -t video/*
+
run it and enjoy!
================================================================================
Matroska (MKV)
Real(RM,RMVB)
WAV
- FLV(H.264+AAC)
+ FLV
+ SWF
+ APE
+ DTS
+ FLAC
+ WAV
+ OGG
+ Raw HEVC(H.265) bitstreams
-Video formats:
+Video decoders:
MPEG-1/2
MPEG-4
H.263
H.264 / MPEG-4 AVC
WMV 1/2
WMV 3 / WMV-9 / VC-1
- Real Video
-
-Audio formats:
- MPEG Layer 1/2
- MP3 - MPEG Layer 3
- AAC - MPEG-4 part3
- AC3 - A/52 (Dolby Digital)
+ RV (Real Video)
+ VP8
+ FLV1
+ DIVX
+ HEVC(H.265)
+
+Audio decoder:
+ MP2 (MPEG Layer 2)
+ MP3 (MPEG Layer 3)
+ AAC (MPEG-4 part3)
+ AC3
WMA 1/2
WMA 3
- Real Audio
- AMR (3GPP)
+ RA (Real Audio)
APE
DTS
FLAC
+ VORBIS
================================================================================
Known issues
1. 基于Android多媒体框架提供额外的插件给用户集成
2. FFmpeg提供demux和音视频解码器
-3. NamExtractor属于Stagefright的一个demux(extractor)插件,它将随着Stagefright的
- 启动而加载。NamExtractor后续会加载FFmpegExtractor插件做真正的demux操作,它将
- Stagefright的智能指针DataSource传给FFmpeg,FFmpeg基于此指针封装URLProtocol,
- 便于兼容FFmpeg本身的框架,同时,Stagefright的所有Source都可以这样导入FFmpeg
- 便于扩展。FFmpegExtractor是参考ffmpeg官方代码ffplay.c文件实现
+3. FFmpegExtractor属于Stagefright的一个demux(extractor)插件
4. libstagefright_soft_ffmpegvdec是一个视频解码器插件
5. libstagefright_soft_ffmpegadec是一个音频解码器插件
6. 任何FFmpegExtractor demux后的视频都优先选用视频硬件解码,充分发挥硬件特性
需要条件
================================================================================
-CyanogenMod 9.x (Ice Cream Sandwich)
-http://wiki.cyanogenmod.com/wiki/Galaxy_Nexus_(GSM):_Compile_CyanogenMod_(Linux)
+1. android_frameworks_native:
+https://github.com/omxcodec/android_frameworks_native.git
+branch: cm_maguro-10.1
-FFMPEG-1.0 release
-http://ffmpeg.org
-ref: git://android.git.linaro.org/platform/external/ffmpeg.git
+2. android_frameworks_av:
+https://github.com/omxcodec/android_frameworks_av.git
+branch: cm_maguro-10.1
+
+3. android_external_ffmpeg
+git@github.com:omxcodec/android_external_ffmpeg
+branch: cm_maguro-10.1
================================================================================
如何编译
================================================================================
1. 获取源码
- 从CyanogenMod git仓库中克隆cm-9.1.0代码
- repo init -u git://github.com/CyanogenMod/android.git -b cm-9.1.0
- 请参考: http://wiki.cyanogenmod.com/wiki/Galaxy_Nexus_(GSM):_Compile_CyanogenMod_(Linux)
-
- 从我的 omxcodec{github} 仓库中克隆代码!
进入你的Android源码目录 "android/external", 运行如下命令:
- stagefright-plugins:
+ stagefright-plugins(branch: master):
git clone git@github.com:omxcodec/stagefright-plugins.git stagefright-plugins
- ffmpeg:
- git clone git@github.com:omxcodec/android_external_ffmpeg.git ffmpeg -b omxcodec-1.0
-
- 进入"android/external" 目录, 运行如下命令:
- cp stagefright-plugins/repo/local_manifest.xml ../.repo
- cd .. // 进入Android源码根目录
- repo sync // 同步我的 "frameworks_base" 代码!
-
- 这里的"repo sync"命令负责同步我的 "frameworks_base"仓库! 当然,你也可以对比我的代码,
- 通过对比,你也很容易合并入我修改部分的代码,因为,修改部分很少,而且非常有规律,需要
- 使用"USES_NAM"这个宏定义区分原有代码。修改的代码仅仅在"android/frameworks/base"目录
+ ffmpeg(branch: cm_maguro-10.1):
+ git clone git@github.com:omxcodec/android_external_ffmpeg.git ffmpeg -b cm_maguro-10.1
+
+ android_frameworks_native and android_frameworks_av:
+ 显然,你应该合并我的android_frameworks_native(branch: cm_maguro-10.1)和
+ android_frameworks_av(branch: cm_maguro-10.1)的源代码。合并修改部分的代码比较少,
+ 而且非常有规律,我修改过的代码使用了"USES_NAM"这个宏,而且我修改过的代码仅仅在
+ "android/frameworks/native"和"android/frameworks/av"两个目录。
2. 编译
- Android系统:
- 增加"USES_NAM"标识到Android编译系统中的编译参数"COMMON_GLOBAL_CFLAGS"
- 编辑 vendor/samsung/maguro/BoardConfigVendor.mk 增加如下几行
- USES_NAM := true
- ifdef USES_NAM
- COMMON_GLOBAL_CFLAGS += -DUSES_NAM
- endif
-
- ffmpeg:
- 进入android/external/ffmpeg
- mm ffmpeg // 不是命令"mm", FIXME
-
- stagefright-plugins:
- 进入android/external/stagefright-plugins
- mm
+ 请重新编译你的整个Android系统。
3. 安装
adb root
获取测试文件:
wget http://movies.apple.com/media/us/ipad/2012/tv-spots/apple-ipad-this_good-us-20120307_848x480.mov
wget http://movies.apple.com/media/us/ipad/2012/80ba527a-1a34-4f70-aae8-14f87ab76eea/tours/apple-ipad-feature-us-20120307_848x480.mp4
+ wget http://ftp.kw.bbc.co.uk/hevc/hm-10.0-anchors/bitstreams/i_main/BQMall_832x480_60_qp22.bin
假设你视频测试文件放在目录 "/sdcard/Movies/".
开启一个linux终端,运行:
adb logcat -c //清空先前所有的log
adb logcat
开启另外一个linux终端, 分情况运行:
- 测试 NamExtractor 和 FFmpegExtractor 插件:
+ 测试 FFmpegExtractor 插件:
adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/apple-ipad-this_good-us-20120307_848x480.mov -t video/*
adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/apple-ipad-feature-us-20120307_848x480.mp4 -t video/*
测试 SoftFFmpegVideo 视频解码器插件:
adb root && adb shell set-vdec-sw1 // 让Stagefright优先选用视频软件解码器
adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/apple-ipad-this_good-us-20120307_848x480.mov -t video/*
adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/apple-ipad-feature-us-20120307_848x480.mp4 -t video/*
+ 测试 HEVC(H.265) 视频解码器:
+ 进入目录android/external/stagefright-plugins/tools, 运行:
+ adb root
+ ./install // 安装测试脚本
+ adb root && adb shell set-vdec-drop0 // 禁止视频解码速度过慢时Stagefright做丢帧处理
+ adb shell am start -a android.intent.action.VIEW -d file:///mnt/sdcard/Movies/BQMall_832x480_60_qp22.bin -t video/*
希望你一切顺利
Matroska (MKV)
Real(RM,RMVB)
WAV
- FLV(H.264+AAC)
+ FLV
+ SWF
+ APE
+ DTS
+ FLAC
+ WAV
+ OGG
+ Raw HEVC(H.265) bitstreams
-视频格式:
+视频解码器:
MPEG-1/2
MPEG-4
H.263
H.264 / MPEG-4 AVC
WMV 1/2
WMV 3 / WMV-9 / VC-1
- Real Video
-
-音频格式:
- MPEG Layer 1/2
- MP3 - MPEG Layer 3
- AAC - MPEG-4 part3
- AC3 - A/52 (Dolby Digital)
+ RV (Real Video)
+ VP8
+ FLV1
+ DIVX
+ HEVC(H.265)
+
+音频解码器:
+ MP2 (MPEG Layer 2)
+ MP3 (MPEG Layer 3)
+ AAC (MPEG-4 part3)
+ AC3
WMA 1/2
WMA 3
- Real Audio
- AMR (3GPP)
+ RA (Real Audio)
APE
DTS
FLAC
+ VORBIS
================================================================================
存在问题
{"ac3", MEDIA_MIMETYPE_AUDIO_AC3 },
{"wav", MEDIA_MIMETYPE_CONTAINER_WAV },
{"ogg", MEDIA_MIMETYPE_CONTAINER_OGG },
- {"hevc", MEDIA_MIMETYPE_CONTAINER_HEVC },
+ {"hevc", MEDIA_MIMETYPE_CONTAINER_HEVC },
};
static void adjustMPEG4Confidence(AVFormatContext *ic, float *confidence)