在我的 ios 应用程序中,我正在尝试使用 http 实时流播放视频。播放进行得很顺利,直到我决定使用洗涤器并跳到尚未缓冲的某个点。从那一刻起,音频继续播放,但视频变黑。
我已经使用以下命令转换了我的 .MP4 视频:
avconv -y -i video.mp4 -f mpegts -acodec libmp3lame -ar 48000 -ab 64k -s 640x480 -vcodec libx264 -b 64k -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -subq 7 -trellis 0 -refs 0 -coder 0 -me_range 16 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 200k -maxrate 64k -bufsize 64k -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 30 -qmax 51 -qdiff 4 -level 30 -aspect 640:480 -g 30 -async 2 sample_64.ts
我使用多种比特率(64、150、240、440 和 640)进行了此操作,并创建了一个.m3u8
包含不同流的。转换后,我使用 将mediafilesegmenter
视频分割成每 10 秒的片段。
擦洗后,输出窗口中会出现以下内容:
2013-03-08 17:30:21.827 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: Disabling autoplay for pause
2013-03-08 17:30:21.827 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: Disabling autoplay
2013-03-08 17:30:21.977 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: _streamUnlikelyToKeepUp: 1 -> 0
2013-03-08 17:30:21.978 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
2013-03-08 17:30:21.978 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: _streamRanDry: 0 -> 1
2013-03-08 17:30:21.980 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: Took background task assertion (32) for playback stall
2013-03-08 17:30:21.981 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
2013-03-08 17:30:22.634 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: _streamUnlikelyToKeepUp: 0 -> 0
2013-03-08 17:30:22.634 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: _streamRanDry: 0 -> 1
2013-03-08 17:30:22.667 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 1, on player: 0)
2013-03-08 17:30:22.769 Geschiedenis Trainer[88129:19a03] [MPAVController] Autoplay: Ending background task assertion (32) for playback stall
我的视频播放器的代码:
self.streamPlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[self.view addSubview:self.streamPlayer.view];
[self.streamPlayer setFullscreen:YES animated:YES];
跳到已缓冲的点时不会发生此问题。