Android Local Video Player Development-ndk compilation FFMPEG

Source: Internet
Author: User

In the search local video section of Android local video player development, we can search for a local video and display the image, title, and duration of each video, of course, if you need to add other methods such as the video length and width, you can use the method in the video class. Since we have obtained the video, the next step is to decode the video. I use FFMPEG to decode the video, so this is the FFMPEG library that can be used to compile mobile phones using ndk.

First go to the official website:

NDK=/opt/android-ndk-r8dPLATFORM=$NDK/platforms/android-8/arch-arm/PREBUILT=$NDK/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86LOCAL_ARM_NEON=trueCPU=armv7-aOPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -mcpu=cortex-a8"PREFIX=./android/$CPU./configure --target-os=linux \    --prefix=$PREFIX \    --enable-cross-compile \    --arch=arm \    --enable-nonfree \    --enable-asm \    --cpu=cortex-a8 \    --enable-neon \    --cc=$PREBUILT/bin/arm-linux-androideabi-gcc \    --cross-prefix=$PREBUILT/bin/arm-linux-androideabi- \    --nm=$PREBUILT/bin/arm-linux-androideabi-nm \    --sysroot=$PLATFORM \    --extra-cflags=" -O3 -fpic -DANDROID -DHAVE_SYS_UIO_H=1 $OPTIMIZE_CFLAGS " \    --disable-shared \    --enable-static \    --extra-ldflags="-Wl,-rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -nostdlib -lc -lm -ldl -llog" \    --disable-ffmpeg \    --disable-ffplay \    --disable-ffprobe \    --disable-ffserver \    --disable-swscale \    --disable-swresample \    --enable-avformat \    --enable-avcodec \    --disable-optimizations \    --disable-debug \    --disable-doc \    --disable-stripping \    --enable-pthreads \    --disable-yasm \    --enable-zlib \    --enable-pic \    --enable-smallmake cleanmake  -j4 install$PREBUILT/bin/arm-linux-androideabi-ar d libavcodec/libavcodec.a inverse.o$PREBUILT/bin/arm-linux-androideabi-ld -rpath-link=$PLATFORM/usr/lib -L$PLATFORM/usr/lib  -soname libffmpeg-neon.so -shared -nostdlib  -z noexecstack -Bsymbolic --whole-archive --no-undefined -o $PREFIX/libffmpeg-neon.so libavcodec/libavcodec.a libavformat/libavformat.a libavutil/libavutil.a -lc -lm -lz -ldl -llog  --warn-once  --dynamic-linker=/system/bin/linker $PREBUILT/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a

Note that the ndk above should be replaced with your local path. This script is enabled with neon, so it can only run on a mobile phone with neon. If you want to run it on a non-neon mobile phone, you need to remove the neon feature.
Then execute this script to generate a libffmpeg-neon.so

The next video file will be decoded using FFMPEG.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.