Addon GO2RTC - Stream MP3 file

Hello

I have a Smart Speaker that support play music over RSTP protocol (I already tested with success over the VLC) , for my understand and from the infomation available on the addon GO2RTC, this addon can also stream a MP3 or a Webradio to a Smart Camera over RTSP also.

Can some one please help me to create a stream of a MP3 file or a webradio to test on me smart speaker?

I already try to create a stream but get some errors…

file1: rstp:/media/BigBuckBunny.mp4

Thank you

Hello MiAutomations,
This might help accessing media files…

When I want to store media, I want to be able to easily not back it up, so I do this. The backup integration has a specific button to exclude the media folder.
For me in configuration.yaml

homeassistant:
  media_dirs:
    local: /media

Then the /media path becomes part of /local .
And put the mp3 in a folder in HA under

/media/mp3

(The media folder already exists, you would want to add a sub folder to that, or at least I did, to keep your OCD happy.)
When I want to use an MP3, the path is

media-source://media_source/local/mp3/Ships_Bell_4.mp3

Adjust as you desire, but that is a basic version of mine. Works for all media.
Longer version in here: HA Config

First of all thank you for your relpy and support

Yes I already have the file into the Home Assistant server

Also in order to avoid any issue with names or special characters I rename de file to test.mp3, but I still not able to play the or stream the MP3 over the addon GO2RTC …

I I think that the issue is related to the addon or the way to configure them

Yes, but it requires a virtual “go2rtc media player”. No idea if you can create one for a speaker. The player is associated with the stream defined in go2rtc. This is what it looks like for my Reolink E1 Zoom camera (go2rtc and configuration.yaml file):

streams:
  rl_test:
    - rtsp://user:[email protected]:554//h264Preview_01_sub
    - ffmpeg:rl_test#audio=opus#audio=copy

media_player: 
  - platform: webrtc
    name: Reolink E1 Zoom
    stream: rl_test
    audio: pcmu/8000

The audio codec in the media_player definition is crucial (supported by the device and the highest possible quality, read more). With the above, I can play files etc. using the standard media_player.play_media invocation:

action: media_player.play_media
data:
  media_content_id: media-source://media_source/local/forest.mp3
  media_content_type: audio
target:
  entity_id: media_player.reolink_e1_zoom

Thank you one more time for your reply and support

I think that once I already have the smart speaker, the Addon GO2RTC only work as a stream server, please correct me if I’m wrong.

And, in that case, the unique configuration that I need is the one to put some mp3 file streaming from the server addon like somethings like this:>

rtsp://192.168.2.54:8554/1 (Configuration present on the Smart Speaker WEB GUI)

That is the configuration that I have when I stream coming from the VLC



OK now I get it, probably :slight_smile: Just tested this in VLC and it plays mp3, so hopefully your speaker can play it, too:

stream:
  file_test:
    - ffmpeg:/media/forest.mp3

Address used in VLC:
rtsp://homeassistant.address:8554/file_test?audio=all
or
rtsp://homeassistant.address:8554/file_test?video=all&audio=all
(both work)

Thank you for your reply

I created a new entry as your indications:

After this I try to play this stream using the addon GO2RTC GUI without sucees

I think there is a issue with some codecs… ~

Do you have any ideia to solve this?

Thank you

It doesn’t work in go2rtc GUI but does work [for me] as RTSP. You don’t test RTSP in browser - use VLC or your speaker and don’t forget the ?audio (or ?audio=all) at the end because it changes the response of go2rtc addon.

1 Like

Thank you so mutch for your help and support!! Now I’m able to play the music streamed from the HA using the GO2RTC addon to the smart speaker.

By the way is there any way to create this smart sepaker as a media_player.device / Entity ID to be seleceted as a player audio device over the Home Assistant?

Thank you

Regarding my last question:
By the way is there any way to create this smart sepaker as a media_player.device / Entity ID to be seleceted as a player audio device over the Home Assistant?

I try use this example that you give me: (inside te configuration.yaml)

media_player: 
  - platform: webrtc
    name: Reolink E1 Zoom
    stream: rl_test
    audio: pcmu/8000

Like this:

media_player: 
  - platform: webrtc
    name: SmartSpeaker
    stream: test
    audio: pcmu/8000

But wehn i try to use the device as a media player I’m receiving a error

Is there any way to check this error on the logs or sometihing to do in order to configur this using a diferent way?

Thank you in adavnce for your help !

No, it won’t work, this stream is fixed to 1 file and cannot accept any input.

You can check if Home Assistant has an integration for your speaker. Search by manufacturer or technology advertised on the speaker (e.g. MusicCast for Yamaha speakers). Go to Settings → Devices → Add (button) and search there.