1 (edited by chumby3000 2020-09-22 11:00:17)

Topic: How to make chumby play any stream

Chumby's ability to play audio streams has been deteriorating over the years due to the changes in encryption and streaming formats.

I posted about dealing with the encryption earlier in http://forum.chumby.com/viewtopic.php?id=9953 but it doesn't address the audio format problems.

The solution requires a web server able to execute cgi-bin scripts and ffmpeg to repack the audio streams. It is also possible to convert the audio to a different format - mp3 -  but it is much more expensive (about 30x) and not necessary unless you are using dash.

Here is a cgi-bin script to repack audio from e.g HLS stream into something chumby can play:

#!/bin/bash
# /cgi-bin/repack
# repack HLS/AAC stream

# Query string must begin with http(s)://
if [ "${QUERY_STRING:0:8}" == "https://" -o "${QUERY_STRING:0:7}" == "http://" ]; then
  # change accordingly to the the stream content(maybe?)
  # it seems CC is able to auto detect(?) 
  echo Content-Type: audio/aac
  echo
  exec 2>/dev/null
  exec /usr/bin/ffmpeg -hide_banner -loglevel warning -nostdin -i "$QUERY_STRING" -vn -acodec copy -f adts -
  
  # to convert to mp3 change also the header Content-type to audio/mpeg
  #ffmpeg -hide_banner -loglevel warning -nostdin -i "$QUERY_STRING" -vn -acodec libmp3lame -f mp3 -

fi

The script discards the video from the stream so it should be possible to play audio from video streams.
Now if you want to listen to audio from an audio/video stream at URL you can put http://your_server_ip:port/cgi-bin/repack?URL in chumby to play it.

Re: How to make chumby play any stream

Nice!

3 (edited by chumby3000 2020-09-29 11:48:53)

Re: How to make chumby play any stream

infocastme wrote:

Nice!

Thanks big_smile

I am having trouble finding streams that do not play on CC and actually require this script. E.g. iHeart uses  http://stream.revma.ihrhls.com/zc5060/hls.m3u8 on the station page https://www.iheart.com/live/iheart80s-radio-5060/

The same stream is available as AAC simply by removing hls.m3u8 from the URL - http://stream.revma.ihrhls.com/zc5060

Re: How to make chumby play any stream

This will be a good project for my youngest son, when he returns home from college. Thank you for posting that!

Re: How to make chumby play any stream

Jim1348 wrote:

This will be a good project for my youngest son, when he returns home from college. Thank you for posting that!

You didn't mention being an unlucky dash owner.

Somebody should compile ffmpeg for dash to make it a self contained project. Throw in a recent openssl while at it. wink