VIMediaCache
VIMediaCache copied to clipboard
一些视频需下载到一定程度才可以播放
您好,我在使用的时候出现了一种情况,有些视频播放需要下载到一半或者更高的情况才可以播放,请问这种是什么情况呢?测试视频地址如下: http://video.micous.com/541086841758392327.mp4
@zzxxzz123 我觉得是视频格式的问题,有些短视频的关键帧和参考帧太少,所以才会出现这个问题。如果是1分钟以上的视频,有多个关键帧,就很明显的感觉到是边下边播,你可以跑一下 JPVideoPlayer 的 demo 就知道了。
你这个视频的信息可以用 videotoolbox 查看,29秒才1个参考帧,肯定是有问题的。
General : Complete name : /Users/crespo.xiao/Downloads/541086841758392327.mp4 Format : MPEG-4 Format profile : Base Media / Version 2 Codec ID : mp42 (mp41/mp42/isom) File size : 9.12 MiB Duration : 29 s 988 ms Overall bit rate : 2 552 kb/s Encoded date : UTC 2017-05-20 01:15:29 Tagged date : UTC 2017-05-20 01:15:30
Video : ID : 2 Format : AVC Format/Info : Advanced Video Codec Format profile : [email protected] Format settings, CABAC : No Format settings, ReFrames : 1 frame Format settings, GOP : M=1, N=30 Codec ID : avc1 Codec ID/Info : Advanced Video Coding Duration : 29 s 988 ms Bit rate : 2 500 kb/s Width : 720 pixels Height : 1 280 pixels Display aspect ratio : 0.562 Frame rate mode : Variable Frame rate : 29.970 (29970/1000) FPS Minimum frame rate : 28.571 FPS Maximum frame rate : 30.000 FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Scan type : Progressive Bits/(Pixel*Frame) : 0.091 Stream size : 8.94 MiB (98%) Title : Core Media Video Encoded date : UTC 2017-05-20 01:15:29 Tagged date : UTC 2017-05-20 01:15:30 Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.601
这是我用mp4explorer获取的视频信息,30秒的视频长度可以看到有多个关键帧的,没有出现很少的情况呀,那为什么会出现这种情况呢
播放会延迟的问题,可能是 iOS 10 上 AVPlayer
的 automaticallyWaitsToMinimizeStalling
默认为 YES
导致
具体原理看这里的说明: https://github.com/vitoziv/VIMediaCache/issues/19#issuecomment-306219585
楼主这个视频地址是真的挺屌的~就算不使用代理拦截,直接给AVPlayer自己处理,都会被拆分成无数个60多k的请求。。。而且视频自身实际只有9MB多;在使用其他几十MB的资源测试的时候,都没有被拆分成这么多的请求。。。