4款知名播放器比较:ijkPlayer、VLC、SmartPlayer、ExoPlayer

2021-03-18 14:21:08 浏览数 (2)

ijkPlayer

ijkPlayer是BiliBili公司维护的一个开源工程,基于ffmpeg开发的一个播放器软件,支持Android和iOS平台,整个ijkplayer就是以ffplay为基础,如果只是使用它进行播放,集成也较为简单,使用也和MediaPlayer差不多,但是要定制化需求,就有一定的门槛高度。支持软硬编解码,支持倍速播放,可以定制化集成需要的功能,集成占用体积也很小,更详细的解释参看下面官方介绍:

Features

  • Common
  • remove rarely used ffmpeg components to reduce binary size config/module-lite.sh
  • workaround for some buggy online video.
  • Android
  • platform: API 9~23
  • cpu: ARMv7a, ARM64v8a, x86 (ARMv5 is not tested on real devices)
  • api: MediaPlayer-like
  • video-output: NativeWindow, OpenGL ES 2.0
  • audio-output: AudioTrack, OpenSL ES
  • hw-decoder: MediaCodec (API 16 , Android 4.1 )
  • alternative-backend: android.media.MediaPlayer, ExoPlayer
  • iOS
  • platform: iOS 7.0~10.2.x
  • cpu: armv7, arm64, i386, x86_64, (armv7s is obselete)
  • api: MediaPlayer.framework-like
  • video-output: OpenGL ES 2.0
  • audio-output: AudioQueue, AudioUnit
  • hw-decoder: VideoToolbox (iOS 8 )
  • alternative-backend: AVFoundation.Framework.AVPlayer, MediaPlayer.Framework.MPMoviePlayerControlelr (obselete since iOS 8)

VLC Media Player

VLC 是一款自由、开源的跨平台多媒体播放器及框架,可播放大多数多媒体文件,以及 DVD、音频 CD、VCD 及各类流媒体协议。

Plays all formats

MPEG-1/2, DivX® (1/2/3/4/5/6), MPEG-4 ASP, XviD, 3ivX D4, H.261, H.263 / H.263i, H.264 / MPEG-4 AVC, Cinepak, Theora, Dirac / VC-2, MJPEG (A/B), WMV 1/2, WMV 3 / WMV-9 / VC-1, Sorenson 1/3, DV, On2 VP3/VP5/VP6, Indeo Video v3 (IV32), Real Video (1/2/3/4).

MPEG Layer 1/2, MP3 - MPEG Layer 3, AAC - MPEG-4 part3, Vorbis, AC3 - A/52, E-AC-3, MLP / TrueHD>3, DTS, WMA 1/2, WMA 3, FLAC, ALAC, Speex, Musepack / MPC, ATRAC 3, Wavpack, Mod, TrueAudio, APE, Real Audio, Alaw/µlaw, AMR (3GPP), MIDI, LPCM, ADPCM, QCELP, DV Audio, QDM2/QDMC, MACE.

DVD, Text files (MicroDVD, SubRIP, SubViewer, SSA1-5, SAMI, VPlayer), Closed captions, Vobsub, Universal Subtitle Format (USF), SVCD / CVD, DVB, OGM, CMML, Kate.

ID3 tags, APEv2, Vorbis comment.

Advanced formats

Input Media

UDP/RTP Unicast, UDP/RTP Multicast, HTTP / FTP, MMS, TCP/RTP Unicast, DCCP/RTP Unicast, File, DVD Video, Video CD / VCD, SVCD, Audio CD (no DTS-CD), DVB (Satellite, Digital TV, Cable TV), MPEG encoder, Video acquisition.

Input Formats

MPEG (ES,PS,TS,PVA,MP3), AVI, ASF / WMV / WMA, MP4 / MOV / 3GP, OGG / OGM / Annodex, Matroska (MKV), Real, WAV (including DTS), Raw Audio: DTS, AAC, AC3/A52, Raw DV, FLAC, FLV (Flash), MXF, Nut, Standard MIDI / SMF, Creative™ Voice.

Miscellaneous

SAP/SDP announces, Bonjour protocol, Mozilla/Firefox plugin, ActiveX plugin, SVCD Menus, Localization, CD-Text, CDDB CD info, IGMPv3, IPv6, MLDv2, CPU acceleration.

SmartPlayer

SmartPlayer是大牛直播SDK(Github)开发的全自研跨平台(windows/android/iOS)流媒体内核,支持RTSP、RTMP,功能齐全、高稳定、超低延迟,超低资源占用,适用于安防、教育、单兵指挥等行业。如不单独说明,系Windows、Android、iOS全平台支持。

  • [支持播放协议]RTSP、RTMP;
  • [多实例播放]支持多实例播放;
  • [事件回调]支持网络状态、buffer状态等回调;
  • [视频格式]支持H.265、H.264,此外,还支持RTSP MJPEG播放;
  • [音频格式]支持AAC/PCMA/PCMU;
  • [H.264/H.265软解码]支持H.264/H.265软解;
  • [H.264硬解码]Windows/Android/iOS支持特定机型H.264硬解;
  • [H.265硬解]Windows/Android/iOS支持特定机型H.265硬解;
  • [H.264/H.265硬解码]Android支持设置Surface模式硬解和普通模式硬解码;
  • [RTSP模式设置]支持RTSP TCP/UDP模式设置;
  • [RTSP TCP/UDP自动切换]支持RTSP TCP、UDP模式自动切换;
  • [RTSP超时设置]支持RTSP超时时间设置,单位:秒;
  • [RTSP 401认证处理]支持上报RTSP 401事件,如URL携带鉴权信息,会自动处理;
  • [缓冲时间设置]支持buffer time设置;
  • [首屏秒开]支持首屏秒开模式;
  • [复杂网络处理]支持断网重连等各种网络环境自动适配;
  • [快速切换URL]支持播放过程中,快速切换其他URL,内容切换更快;
  • [音视频多种render机制]Android平台,视频:surfaceview/OpenGL ES,音频:AudioTrack/OpenSL ES;
  • [实时静音]支持播放过程中,实时静音/取消静音;
  • [实时音量调节]支持播放过程中实时调节音量;
  • [实时快照]支持播放过程中截取当前播放画面;
  • [只播关键帧]Windows平台支持实时设置是否只播放关键帧;
  • [渲染角度]支持0°,90°,180°和270°四个视频画面渲染角度设置;
  • [渲染镜像]支持水平反转、垂直反转模式设置;
  • [等比例缩放]支持图像等比例缩放绘制(Android设置surface模式硬解模式不支持);
  • [实时下载速度更新]支持当前下载速度实时回调(支持设置回调时间间隔);
  • [解码前视频数据回调]支持H.264/H.265数据回调;
  • [解码后视频数据回调]支持解码后YUV/RGB数据回调;
  • [解码前音频数据回调]支持AAC/PCMA/PCMU数据回调;
  • [音视频自适应]支持播放过程中,音视频信息改变后自适应;
  • [扩展录像功能]支持和录像SDK组合使用。

ExoPlayer

ExoPlayer 是google推出的开源播放器,主要是集成了Android 提供的一套解码系统来解析视频和音频,将MediaCodec封装地非常完善,形成了一个性能优越,播放稳定性较好的一个开发播放器。

ExoPlayer is an application level media player for Android. It provides an alternative to Android’s MediaPlayer API for playing audio and video both locally and over the Internet. ExoPlayer supports features not currently supported by Android’s MediaPlayer API, including DASH and SmoothStreaming adaptive playbacks. Unlike the MediaPlayer API, ExoPlayer is easy to customize and extend, and can be updated through Play Store application updates.

Documentation

  • The developer guide provides a wealth of information to help you get started.
  • The class reference documents the ExoPlayer library classes.
  • The release notes document the major changes in each release.

Using ExoPlayer

Via jCenter

The easiest way to get started using ExoPlayer is by including the following in your project's build.gradle file:

代码语言:javascript复制
compile 'com.google.android.exoplayer:exoplayer:rX.X.X'

where rX.X.X is the your preferred version. For the latest version, see the project's Releases. For more details, see the project on Bintray.

As source

ExoPlayer can also be built from source using Gradle. You can include it as a dependent project like so:

代码语言:javascript复制
// settings.gradle
include ':app', ':..:ExoPlayer:library'

// app/build.gradle
dependencies {
    compile project(':..:ExoPlayer:library')
}

As a jar

If you want to use ExoPlayer as a jar, run:

代码语言:javascript复制
./gradlew jarRelease

and copy library.jar to the libs folder of your new project.

总结

ijkplayer结构比较相对比较清晰,可扩展性较差,基本上没有提供modules供开发者二次开发,官方更新比较慢,值得欣慰的是,好多开发者基于ijkplayer做了扩展,填了非常多的坑,往上资料非常多;

VLC对点播的支持比较好,但是工程庞大,接入或二次开发难度比较大;

SmartPlayer对RTSP和RTMP直播播放支持非常优秀,毫秒级延迟,稳定性比较好;

ExoPlayer不太适合直播,视频解码无法接入软解,可扩展性一般,而且只支持Android平台。

0 人点赞