ossrs / httpx-static

A HTTP/HTTPS API proxy for SRS.
https://github.com/ossrs/srs
MIT License
642 stars 222 forks source link

HLS: Support audio only HLS stream. #45

Open winlinvip opened 8 years ago

winlinvip commented 8 years ago

About the audio only HLS, need to use aac, not ts; the timestamp need to recalculate.

Hello Winlin,

> Hi, I am the author of SRS(Simple RTMP Server) which delivery RTMP/HLS/HTTP-FLV and other features. I have rewrite the HLS which remuxing from RTMP according to the Apple HLS standard, it works very well.
> 
> I got another question about HLS: when I remux the rtmp stream without video, that is the pure audio stream to HLS, seems the audio exists some noise. The audio codec is mp3 or aac. Is there any example or specification about pure audio HLS stream?

I assume that by "pure audio stream" you mean an MPEG elementary audio stream? (As opposed to an audio-only MPEG-2 Transport Stream.) Here are a couple of simple examples from https://developer.apple.com/streaming/examples/ :

https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/gear0/prog_index.m3u8

https://devimages.apple.com.edgekey.net/streaming/examples/bipbop_16x9/alternate_audio_aac_sinewave/prog_index.m3u8

One thing to bear in mind when converting from RTMP is that the millisecond timestamps will eventually accumulate enough error to create gaps in the audio. So when you create the "com.apple.streaming.transportStreamTimestamp" ID3 tag, its value should be calculated from the sum of the previous audio sample durations, not from the ms timestamps in the original file.

regards,

Roger Pantos
Apple Inc.