我在Android上播放HLS时遇到困难,只播放音频。该流将播放第一个视频片段,然后变为仅音频流。以下是示例链接https://clipter.com/c/aymels8/hls.m3u8
hls.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-TARGETDURATION:9
#EXT-X-ALLOW-CACHE:YES
#EXTINF:8.5,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/2103cb31c3078eb5edd5c325108f6d6f.ts?1416176849
#EXTINF:7.33,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/1214ef63a031e3d3229893fdb60eea86.ts?1416176848
#EXTINF:8.5,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/99c47c49548521b0fff05119a5c63908.ts?1416176889
#EXTINF:8.43,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/143acefc2149f2572ddcc08abb705736.ts?1416176988
#EXTINF:4.43,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/11c92b5084971e0cf4768f958e97f936.ts?1416177431
#EXTINF:6.9,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/10ab810169fb684469f736a53f2cba3a.ts?1416177545
#EXTINF:8.57,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/88b037af27757e4805d7f1ed0496cbb8.ts?1416178434
#EXTINF:2.1,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/4a8cda13ea40228de4638dee9985b8b0.ts?1416178513
#EXTINF:8.47,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/e6fa0135987c86d323f1e994bcd2b429.ts?1416179772
#EXTINF:8.38,
https://d3ilpkc014v0xn.cloudfront.net/f5305de24/9a08aba19b45601c83854216bb07a6b6.ts?1416604373
#EXT-X-ENDLIST
来自ffprobe的输出
ffprobe version 2.3.3 Copyright (c) 2007-2014 the FFmpeg developers
built on Aug 25 2014 19:47:15 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.3.3 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 92.100 / 52. 92.100
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.100 / 55. 48.100
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.100 / 4. 11.100
libavresample 1. 3. 0 / 1. 3. 0
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mpegts, from '2103cb31c3078eb5edd5c325108f6d6f.ts?1416176849':
Duration: 00:00:08.53, start: 1.400000, bitrate: 1236 kb/s
Program 1
Metadata:
service_name : Service01
service_provider: FFmpeg
Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 480x480, 30 fps, 30 tbr, 90k tbn, 60 tbc
Stream #0:1[0x101](und): Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, mono, fltp, 67 kb/s
答案 0 :(得分:1)
通过在每个网址后添加#EXT-X-DISCONTINUITY标记来解决此问题。音频保持播放和视频停止的原因是因为每个视频片段具有相同的开始时间1.4(遗憾的是我的应用程序中无法更改的值)。有关详细信息,请参阅https://tools.ietf.org/html/draft-pantos-http-live-streaming-13