Capture and Transfer Video Frames

Encoding

I420 (YUV), RGB24:?http://blog.csdn.net/leixiaohua1020/article/details/12234821

1. I420????????A frame in I420 (YUV 4:2:0) is size = width * height * 1.5Byte

? ? ????????????????I420 is YYYY…UUUUVVVV

????????????????????NV21 is YYYY…UVUVUVUV (Maybe used in the deprecated Camera API)

????????????????????YV12 IS YYYY…VVVVUUUU?(Maybe used in the deprecated Camera API)

2. RGB24????A frame in RGB24 is size = width * height * 3Byte

Camera2 API

Usage

1. Official guide:?https://developer.android.com/guide/topics/media/camera

2. Official samples

? ? ? ? a.?https://github.com/googlesamples/android-Camera2Basic/

? ? ? ? b.?https://github.com/googlesamples/android-Camera2Raw/

? ? ? ? c.?https://github.com/googlesamples/android-Camera2Video/

Format

1. Image class:?https://www.polarxiong.com/archives/Android-Image%E7%B1%BB%E6%B5%85%E6%9E%90-%E7%BB%93%E5%90%88YUV_420_888.html

2.?YUV_420_888 to I420:?https://www.polarxiong.com/archives/Android-YUV_420_888%E7%BC%96%E7%A0%81Image%E8%BD%AC%E6%8D%A2%E4%B8%BAI420%E5%92%8CNV21%E6%A0%BC%E5%BC%8Fbyte%E6%95%B0%E7%BB%84.html

Open Source Libs

1. libyuv

? ? ? ? It is used to rotate, crop and scale the captured video frames before transfer. The frames must be head-up no matter the phone orientation. The best order of image processing for downscaling the captured image is: scale -> crop -> rotate.

? ??????Use Neon to optimize the libyuv when compiling, so that we can do parallel processing.

2. libtheora

? ? ? ? Use the unofficial libtheora 1.2 with?neon optimization. Need to change the instruction “BLX” in lib/arm/armenquant.s to “BL” to avoid crush issue.

????????1).????Get the tools:

????????????????a.????sudo apt-get install autoconf

????????????????b.????sudo apt-get install libtool

????????????????c.????sudo apt-get install libogg-dev

????????2).????set up the ndk build evn:

????????????????a.????NDK=/build/toolchain/lin64/android-ndk-r12b

????????????????b.????SYSROOT=$NDK/platforms/android-19/arch-arm (Use API Level 19 because the libogg and libtheora are too old to be compiled on newer platform)

????????????????c.????PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64

????????3).????Build the libogg:

????????????????a.????./autogen.sh --prefix=$HOME/tmp/libogg --host=arm-linux --enable-shared CC="$PREBUILT/bin/arm-linux-androideabi-gcc --sysroot=$SYSROOT" LDFLAGS="-Wl,-O2,--as-needed" CFLAGS="-march=armv7-a -mfpu=neon"

????????????????b.????make install

????????4).????Build the libtheora

????????????????ARM compile options?https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html

????????????????Into Assambly:?http://www.cnblogs.com/goodhacker/p/3206405.htmlhttp://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0204ic/Cihfddaf.html

????????????????a.????./autogen.sh --prefix=$HOME/tmp/libtheora --host=arm-linux --disable-examples CC="$PREBUILT/bin/arm-linux-androideabi-gcc --sysroot=$SYSROOT" LDFLAGS="-Wl,-O2,-g,-L$HOME/tmp/libogg/lib" CPPFLAGS="-I$HOME/tmp/libogg/include" CFLAGS="-march=armv7-a -mfpu=neon -mthumb "

????????????????b.????make install

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • mean to add the formatted="false" attribute?.[ 46% 47325/...
    ProZoom閱讀 3,207評(píng)論 0 3
  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi閱讀 7,858評(píng)論 0 10
  • “讀你”音頻朗讀 我喜歡讀書,時(shí)常以文人自居,有時(shí)覺(jué)得書就象我的一位至親密友:它永不會(huì)拋棄我,不管我是老了還是丑了...
    焰歸來(lái)閱讀 486評(píng)論 3 6
  • 人生不相見,動(dòng)如參與商。種紅豆的,會(huì)結(jié)果。種相思的,無(wú)盡期..... 鐵馬金戈,相思成蠱......
    icechenzi閱讀 265評(píng)論 0 1
  • 【學(xué)齡后】口號(hào):溫柔地堅(jiān)持 孩子第一個(gè)30天目標(biāo):在洗手間刷牙,刷完牙馬上洗臉 媽媽第一個(gè)30天目標(biāo):恢復(fù)與大寶的...
    zengl閱讀 143評(píng)論 0 0

友情鏈接更多精彩內(nèi)容