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.