ijkplayer版本:k.0.8.8 编译环境:Ubuntu 18.04.6 LTS 使用平台:android
支持rtsp播放
默认的ijkplayer并不支持rtsp流的播放,因为在编译ffmpeg的时候并没有开启rtsp的demuxer,所以在编译ffmpeg的时候需要开启rtsp的demuxer
cd ijkplayer-android/config
vim module-lite.sh
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-protocol=rtp"
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-demuxer=rtsp"
- 修复rtsp卡住的BUG
修改ijkmedia/ijkplayer/ff_ffplay.c源码,如图(注释掉packet_queue_get_or_buffering函数中的两段代码,参考来源): - 重新编译工程
cd ijkplayer-android/android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
cd ijkplayer-android/android
./compile-ijk.sh clean
./compile-ijk.sh all
ijkplayer-example支持jpeg播放
修改方式与开启rtsp功能类似,先开启ffmpeg库的mjpeg解码功能,然后再重新编译ffmpeg和ijkplayer
- 开启mjpeg解码功能
修改module-little.sh
cd ijkplayer-android/config
vim module-lite.sh
export COMMON_FF_CFG_FLAGS="$COMMON_FF_CFG_FLAGS --enable-decoder=mjpeg"
cd ijkplayer-android/android/contrib
./compile-ffmpeg.sh clean
./compile-ffmpeg.sh all
cd ijkplayer-android/android
./compile-ijk.sh clean
./compile-ijk.sh all
vim ijkplayer/ijkplayer-example/src/main/java/tv/danmaku/ijk/media/example/widget/media/IjkVideoView.java
String pixelFormat = mSettings.getPixelFormat();
if (TextUtils.isEmpty(pixelFormat)) {
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", IjkMediaPlayer.SDL_FCC_RV32);
} else {
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", pixelFormat);
}
String pixelFormat = mSettings.getPixelFormat();
if (TextUtils.isEmpty(pixelFormat)) {
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", IjkMediaPlayer.SDL_FCC_RV16);
} else {
ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", pixelFormat);
}
- 运行ijkplayer内部的example,即可正常播放jpeg图片
|