HLS-Stream-Creator icon indicating copy to clipboard operation
HLS-Stream-Creator copied to clipboard

Audio Bitrate Switch Missing

Open vineetmultitv opened this issue 6 years ago • 5 comments

The script seems great though missing audio bitrate control switches while encoding for Adaptive streams, Along with Video bitrates, audio can also be scaled down, is it missing or intentional?

vineetmultitv avatar Jul 26 '19 02:07 vineetmultitv

It's been omitted purely on the basis that it hasn't been needed yet. I'm more than happy to accept a pull implementing it though.

bentasker avatar Jul 26 '19 07:07 bentasker

Sure, It can be done by leveraging existing bitrate switch -b [AudioBitrate]-[VideoBitrate]-[width]x[height]

vineetmultitv avatar Jul 26 '19 08:07 vineetmultitv

That's one of the options I considered when I raised the FR (HLS-34) earlier.

It's the simplest option to implement, but also the least flexible.

Breaking the audio out into seperate tracks is harder to do, but allows a lot more flexibility (as it's a step on the path to being able to have alternative audio tracks - for multilanguage support - as well as things like having audio only adaptive streams - for radio streams).

However, because it's potentially that much harder (particularly if it's to be supported in linear streams too) I'm more than happy to accept a pull request which implements the simpler approach of passing into -b. I don't currently have the time to implement this myself.

What I would say though, is it would be prudent to have a different delimiter to denote audio, as it reduces the need to worry about what order things have been specified in (reducing the scope for operator error).

So something like -b [VideoBW]-[width]x[height]:[audiobw] rather than splitting with a hyphen. It doesn't have to be a colon specifically.

bentasker avatar Jul 26 '19 08:07 bentasker

@bentasker here's a guide created recently, i not sure how well it could be integrated with this script: https://www.martin-riedl.de/2020/05/31/using-ffmpeg-as-a-hls-streaming-server-part-9-multiple-audio-languages/

Denoder avatar Jun 25 '20 09:06 Denoder

Thanks, but splitting the audio out with ffmpeg itself isn't too challenging, the challenge really is in how you turn that into sensible command line arguments to pass into HLS-Stream-Creator.

Taking that post as an example, doing it with ffmpeg directly is "simply" a case of mapping streams

-map a:0 -map a:1 -c:a aac -b:a 128k -ac 2 \

.... -var_stream_map "a:0,agroup:audio128,language:GER a:1,agroup:audio128,language:ENG v:0,agroup:audio128 v:1,agroup:audio128"

Which is fine if you know the layout of your input, or how to discover it. If you don't, then it's almost completely incomprehensible.

Under the hood, we'd end up building a command not dissimilar to that, but the challenge really lies in how you best present the option to users in a simplified manner.

bentasker avatar Jun 25 '20 09:06 bentasker