debugly / ijkplayer

iOS/macOS/tvOS video player based on ijkplayer, using FFmpeg 6, support Metal、hw accel、HDR、ass subtitle effect...
GNU General Public License v2.0
115 stars 20 forks source link

播放m3u8断流 #38

Open m3u8playlist opened 3 months ago

m3u8playlist commented 3 months ago

m3u8地址 https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4.m3u8

现象 播放一两分种后就断流

LOG [IJKMEDIA]Skip ('#EXT-X-VERSION:3') [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46656216.ts?m=1598670020' for reading [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4.m3u8' for reading [IJKMEDIA]Skip ('#EXT-X-VERSION:3') [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46656217.ts?m=1598670020' for reading [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4.m3u8' for reading [IJKMEDIA]Skip ('#EXT-X-VERSION:3') [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46656218.ts?m=1598670020' for reading [IJKMEDIA]ffp_toggle_buffering: completed: OK [IJKMEDIA]Playback rate: 0.000000 [IJKMEDIA]ffp_toggle_buffering: eof

debugly commented 3 months ago

正常不会走进 ffp_toggle_buffering: completed: OK 请提供完整的debug日志。

m3u8playlist commented 3 months ago

[IJKMEDIA]===== versions ===== [IJKMEDIA]ijkplayer : 0e0fd94 [IJKMEDIA]FFmpeg : n6.1.1-19-g9124a9b [IJKMEDIA]libavutil : 58.29.100 [IJKMEDIA]libavcodec : 60.31.102 [IJKMEDIA]libavformat : 60.16.100 [IJKMEDIA]libswscale : 7.5.100 [IJKMEDIA]libswresample: 4.12.100 [IJKMEDIA]===== options ===== [IJKMEDIA]player-opts : video-pictq-size = 3 [IJKMEDIA]player-opts : overlay-format = fcc-_es2 [IJKMEDIA]player-opts : max-fps = 30 [IJKMEDIA]player-opts : framedrop = 1 [IJKMEDIA]player-opts : videotoolbox_hwaccel = 1 [IJKMEDIA]player-opts : start-on-prepared = 0 [IJKMEDIA]format-opts : ijkapplication = 0x6000002eee80 [IJKMEDIA]format-opts : ijkiomanager = 4386552464 [IJKMEDIA]format-opts : protocol_whitelist = ijkio,ijkhttphook,concat,http,tcp,https,tls,file,bluray,dvd,rtmp,rtsp,rtp,srtp,udp [IJKMEDIA]format-opts : probesize = 10000000 [IJKMEDIA]format-opts : max_reload = 1 [IJKMEDIA]format-opts : auto_convert = 0 [IJKMEDIA]format-opts : timeout = 30000000 [IJKMEDIA]format-opts : headers = Referer:abc User-Agent:def [IJKMEDIA]format-opts : reconnect = 1 [IJKMEDIA]format-opts : seek_flag_keyframe = 1 [IJKMEDIA]format-opts : user_agent = ijkplayer [IJKMEDIA]format-opts : safe = 0 [IJKMEDIA]=================== [IJKMEDIA]No trailing CRLF found in HTTP header. Adding it. [IJKMEDIA]dns getaddrinfo uri = d2e1asnsl7br7b.cloudfront.net [IJKMEDIA]tcp did open uri = tcp://d2e1asnsl7br7b.cloudfront.net:443, ip = 198.18.1.29 [IJKMEDIA]mime type is not rfc8216 compliant [IJKMEDIA]Skip ('#EXT-X-VERSION:3') [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46719005.ts?m=1598670020' for reading [IJKMEDIA]dns getaddrinfo uri = d2e1asnsl7br7b.cloudfront.net [IJKMEDIA]tcp did open uri = tcp://d2e1asnsl7br7b.cloudfront.net:443, ip = [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46719006.ts?m=1598670020' for reading [IJKMEDIA]dns getaddrinfo uri = d2e1asnsl7br7b.cloudfront.net [IJKMEDIA]tcp did open uri = tcp://d2e1asnsl7br7b.cloudfront.net:443, ip = [IJKMEDIA]Option safe not found. [IJKMEDIA]max_frame_duration: 10.000 [IJKMEDIA]Input #0, hls, from 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4.m3u8': [IJKMEDIA] Duration: [IJKMEDIA]N/A[IJKMEDIA], start: [IJKMEDIA]33621.416889[IJKMEDIA], bitrate: [IJKMEDIA]N/A [IJKMEDIA] Program 0 [IJKMEDIA] Metadata: [IJKMEDIA] variant_bitrate : [IJKMEDIA]0 [IJKMEDIA] Stream #0:0[IJKMEDIA]: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9][IJKMEDIA], [IJKMEDIA]25 fps, [IJKMEDIA]25 tbr, [IJKMEDIA]90k tbn [IJKMEDIA] Metadata: [IJKMEDIA] variant_bitrate : [IJKMEDIA]0 [IJKMEDIA] Stream #0:1[IJKMEDIA](und)[IJKMEDIA]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp [IJKMEDIA] Metadata: [IJKMEDIA] variant_bitrate : [IJKMEDIA]0 [IJKMEDIA]AudioCodec: avcodec, aac [IJKMEDIA]videotoolbox hwaccel switch:on [IJKMEDIA]try use videotoolbox accel [IJKMEDIA]VideoCodec: avcodec, h264 [IJKMEDIA]auto decision max buffer size:27MB [IJKMEDIA]Playback rate: 1.000000 [IJKMEDIA]Playback rate: 1.000000 [IJKMEDIA]ff avcc maybe wrong:014D401FFFE10025274D401FB9180A00B7602200000300020000 use origin avcc:000001274D401FB9180A00B7602200000300020000030065 [IJKMEDIA]Failed setup for format videotoolbox_vld: hwaccel initialisation returned error. [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46719007.ts?m=1598670020' for reading [IJKMEDIA]render pipeline:yuv420pFragmentShader,fullRange:1,matrix:BT709[IJKMEDIA]dns getaddrinfo uri = d2e1asnsl7br7b.cloudfront.net [IJKMEDIA]tcp did open uri = tcp://d2e1asnsl7br7b.cloudfront.net:443, ip = [IJKMEDIA]Skip ('#EXT-X-VERSION:3') [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4.m3u8' for reading [IJKMEDIA]Skip ('#EXT-X-VERSION:3') [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46719008.ts?m=1598670020' for reading [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46719009.ts?m=1598670020' for reading [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4.m3u8' for reading [IJKMEDIA]Skip ('#EXT-X-VERSION:3') [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46719010.ts?m=1598670020' for reading [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4.m3u8' for reading [IJKMEDIA]Skip ('#EXT-X-VERSION:3') [IJKMEDIA]Opening 'https://d2e1asnsl7br7b.cloudfront.net/7782e205e72f43aeb4a48ec97f66ebbe/index_4_46719011.ts?m=1598670020' for reading [IJKMEDIA]ffp_toggle_buffering: completed: OK [IJKMEDIA]Playback rate: 0.000000 [IJKMEDIA]ffp_toggle_buffering: eof

debugly commented 3 months ago
  1. player 的 shouldAutoplay 赋值为 YES,这样buffer满了就自动播放: player.shouldAutoplay = YES;
  2. 播放直播和回放配置上有点区别:
    //isLive表示是直播
    if (isLive) {
        // Param for living
        [options setPlayerOptionIntValue:1 forKey:@"infbuf"];
        [options setPlayerOptionIntValue:0 forKey:@"packet-buffering"];
    } else {
        // Param for playback
        [options setPlayerOptionIntValue:0 forKey:@"infbuf"];
        [options setPlayerOptionIntValue:1 forKey:@"packet-buffering"];
    }
  3. 确定你的网络能够正常访问这个直播流?换个播放器试试。