ijkplayer支持播放h264本地文件

默认前期已能正确编译ijkplayer及使用官方例子demo,这个方法目前只测试了安卓端可以正常播放h264格式的本地文件,流播放没有测试,不一定可行。
do-compile-ffmpeg.sh添加以下内容

# Standard options:
FF_CFG_FLAGS="$FF_CFG_FLAGS --prefix=$FF_PREFIX"
#lbg
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-demuxer=h264"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-protocol=udp"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-decoder=h264"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-parser=h264"

FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-hwaccel=h264_vaapi"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-hwaccel=h264_vaapi"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-hwaccel=h264_dxva2"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-demuxer=mjpeg"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-demuxer=rtsp"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-demuxer=rtp"
FF_CFG_FLAGS="$FF_CFG_FLAGS --enable-encoder=h264"

重新编译

cd config
rm module.sh
ln -s module-default.sh module.sh
cd android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
cd ..
./compile-ijk.sh arm64

在ijkplayer-example代码里搜索 mAdapter.addItem增加本地路径文件或者网络路径测试是否能正常打开。

		String video = Environment.getExternalStorageDirectory().getPath()+"/bigbuckbunny_480x272.h264";
        mAdapter.addItem(video, "h264");
        String mkv = Environment.getExternalStorageDirectory().getPath()+"/Titanic.mkv";
        mAdapter.addItem(mkv, "Titanic.mkv");
        String mp4 = Environment.getExternalStorageDirectory().getPath()+"/timer.mp4";
        mAdapter.addItem(mp4, "timer.mp4");
        mAdapter.addItem("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov", "rstp rabbit");        mAdapter.addItem("http://devimages.apple.com.edgekey.net/streaming/examples/bipbop_4x3/bipbop_4x3_variant.m3u8", "bipbop basic master playlist");

参考:https://blog.csdn.net/jacke121/article/details/53869258

你可能感兴趣的:(ijkplayer)