I've just spotted that the latest build of TVHeadend has Hypfer's audio ES muxer enabled which allows you to extract the audio stream from a channel and transcode that to one of the supported audio formats that TVHeadend supports. What's exciting about this is that it allows you to pass an audio stream in a standard audio format (AAC or Vorbis) to audio appliances such as Sonos which cannot handle playing only the audio from a video stream.
Pre-requisites:
TVHeadend 4.1-2267~g6efcfd2
Hardware capable of transcoding
Sonos or other audio appliance
Here's how I set up my TVHeadend server to send an audio stream to my Sonos system:
Create a new transcode profile:
Configuration > Stream > Stream Profiles > Add
Type: Transcode/av-lib
Enabled: True
Profile Name: Audio (or whatever you like)
Container: Raw Audio Stream
Video Codec: Do not use
Audio Codec: AAC or Vorbis
Audio Bitrate: 128 (or whatever you like)
*Leave any settings not mentioned above as default.*
Create a new user for your Sonos setup to use, I found that the Sonos controller doesn't like usernames, passwords or parameters in URL's (so I couldn't pass "?profile=audio" to the end of my stream so I created a user that can only be accessed from the IP addresses of my Sonos clients). Configuration below:
Enabled: True
Username: *
Streaming: True
Advanced Streaming: True
Allowed Networks: 192.168.1.71/32,192.168.1.72/32,192.168.1.77/32
Streaming Profiles: audio (or whatever you called your new profile above)
*Leave any settings not mentioned above as default.*
In the 'Allowed Networks' section, add the IP address of each of your Sonos devices (or whatever device you want to stream to) prefixed with /32 (means "this IP only" in CIDR notation).
Next, go to your Sonos controller, click on "Manage" then "Add Radio Station..." and enter the URL of your server and the channel you want to stream, remove any parameters that TVHeadend added
http://TVHeadendIPAddress:9981/play/stream/channel/07edf0bcaa0fbc6cd045c670688f672d
The above URL (which you can grab by visiting the channels tab, and right clicking on the blue "Play" icon and copying the URL to the clipboard) passes a transcoded audio stream from TVHeadend to Sonos and plays as expected.
The Sonos step can be substituted for any other audio application that can accept an audio stream from a http source as its input.