使用 FFMPEG 创建 HLS FLAC 流

问题描述

我使用以下命令从带有 FLAC 输出的 FLAC 文件创建了一个 HLS 流:

ffmpeg -i 10-brass-in-pocket.flac -map 0:a -c:a:0 flac -f hls -hls_playlist_type vod -master_pl_name master.m3u8 -hls_time 15 -hls_segment_filename %03d.ts -var_stream_map "a:0" stream_%v.m3u8

我已经在这里发布了:

https://di5wym8npn4cm.cloudfront.net/stackoverflow/master.m3u8

此处带有音频控件的页面:

https://di5wym8npn4cm.cloudfront.net/stackoverflow/index.html

我可以从 Safari 的网络选项卡中看到正在下载曲目的片段,但它们没有播放。 Safari 能够解码 FLAC,如果我链接到它播放的源文件。

Apple 的 mediastreamvalidator 工具返回以下内容:

--------------------------------------------------------------------------------
MUST fix issues
--------------------------------------------------------------------------------

Error: Illegal MIME type
--> Detail:  MIME type: application/x-mpegURL
--> Source:  https://di5wym8npn4cm.cloudfront.net/stackoverflow/master.m3u8

--> Detail:  MIME type: application/x-mpegURL
--> Source:  stream_0.m3u8

Error: Measured peak bitrate compared to master playlist declared value exceeds error tolerance
--> Detail:  Measured: 1005.65 kb/s,Master playlist: 140.80 kb/s,Error: 614.24%
--> Source:  https://di5wym8npn4cm.cloudfront.net/stackoverflow/master.m3u8
--> Compare: stream_0.m3u8

为什么这个流没有播放,有哪些工具可以调试这些问题?

解决方法

您在 MPEG-TS 中使用 FLAC。必须是 fMP4。

HLS Authoring Specification for Apple Devices

音频

  1. 音频编码要求

2.23。 xHE-AAC、Apple Lossless 和 FLAC 音频的容器格式必须为 fMP4。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...