简体   繁体   English

iOS HTTP实时黑屏

[英]ios http live black screen

In my ios app I am trying to play videos using http live streaming. 在我的ios应用中,我尝试使用http live流播放视频。 The playing goes well until I decide to use the scrubber and skip to some point that hasn't buffered yet. 在我决定使用洗涤器并跳到尚未缓冲的某个位置之前,播放进行得很顺利。 From that moment the audio goes on but the videos goes black. 从那一刻起,音频继续播放,但视频变为黑色。

I've converted my .MP4 videos with the following command: 我已经使用以下命令转换了.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

I did this with multiple bitrates (64, 150, 240, 440 and 640) and created one .m3u8 that contains the different streams. 我使用多种比特率( .m3u8和640)进行了此操作,并创建了一个包含不同流的.m3u8 After converting I used the mediafilesegmenter to split the video in segments of each 10 seconds. 转换后,我使用mediafilesegmenter将视频每10秒分段一次。

After scrubbing the following appears in the output window: 擦洗后,以下内容会出现在输出窗口中:

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

The code for my videoplayer: 我的视频播放器的代码:

self.streamPlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL];
[self.view addSubview:self.streamPlayer.view];
[self.streamPlayer setFullscreen:YES animated:YES];

This problem does not occur when skipping to a point that has already been buffered. 跳到已被缓冲的点时,不会发生此问题。

The problem was in the conversion of my videos. 问题出在我的视频转换中。 I was using an outdated version of avconv / ffmpeg . 我正在使用avconv / ffmpeg的过时版本。 I updated ffmpeg to the latest version (1.1) and that solved the problem. 我将ffmpeg更新为最新版本(1.1),从而解决了该问题。

After converting the video I used apple's mediafilesegmenter to split the video in 10 second segments. 转换视频后,我使用了苹果的mediafilesegmenter将视频分为10秒。 Before updating ffmpeg it generated an error: segment does not contain sync frame for each segment. 在更新ffmpeg之前,它生成了一个错误: segment does not contain sync frame每个段的segment does not contain sync frame After updating ffmpeg this error disappeared and so did the streaming problems. 更新ffmpeg之后,此错误消失了,流媒体问题也消失了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM