[FFmpeg-user] Producing audio-only HLS

Tom Worster fsb at thefsb.org
Tue Oct 27 16:41:52 EET 2020


I'm experimenting with using HLS to serve audio on demand to web 
clients. The server has a weeks-long continuous audio recording. The 
user chooses an arbitrary point in time in the recording to start 
listening. The audio plays until the user stops it or unloads the web 
page from the browser.

When the source of the audio recording is mp3 encoded (from a Shoutcast 
live stream) I'd be interested to avoid transcoding to AAC in producing 
the HLS files.

Iiuc, FFmpeg's hls muxer supports only mpegts and fmp4 segment types. Do 
these formats accept mp3 audio streams?

Can I create Packed Audio[1] with FFMpeg using the segment muxer? The 
tricky part seems to be where the HLS spec says

    Each Packed Audio Segment MUST signal the timestamp of its first
    sample with an ID3 Private frame (PRIV) tag [ID3] at the beginning of
    the segment.  The ID3 PRIV owner identifier MUST be
    "com.apple.streaming.transportStreamTimestamp".  The ID3 payload MUST
    be a 33-bit MPEG-2 Program Elementary Stream timestamp expressed as a
    big-endian eight-octet number, with the upper 31 bits set to zero.

I don't think segment muxer will do that. But could a script add the 
timestamp to a finished segment via ffmpeg cli using metadata key 
"id3v2_priv.com.apple.streaming.transportStreamTimestamp"[2]?

I'm not sure using either mp3 or Packed Audio segments in HLS are good 
for breadth of client compatibility but I'm interested to try it out.

Tom

[1] 
https://tools.ietf.org/html/draft-pantos-hls-rfc8216bis-07#section-3.1.3

[2] 
https://github.com/FFmpeg/FFmpeg/commit/8a4cc0a2567fa8418709f75af5539cdf76fefb99


More information about the ffmpeg-user mailing list