gpt4 book ai didi

Android HLS 播放第一段然后只播放音频

转载 作者:行者123 更新时间:2023-12-04 23:16:54 27 4
gpt4 key购买 nike

我在仅播放音频的 Android 上播放 HLS 时遇到困难。该流将播放第一个视频 fragment ,然后变成仅音频流。这是一个示例链接 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

最佳答案

这是通过在每个 url 后添加 #EXT-X-DISCONTINUITY 标记来解决的。音频继续播放而视频停止的原因是因为每个视频 fragment 都有相同的开始时间 1.4(不幸的是,我无法在我的应用程序中更改这个值)。见 https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-13了解更多详情

关于Android HLS 播放第一段然后只播放音频,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27070563/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com