Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[welle-cli,feature request] Support more than one channel/ensemble per instance #712

Open
nRaecheR opened this issue Feb 11, 2022 · 10 comments

Comments

@nRaecheR
Copy link

Welle-cli features a headless network server mode which is a really nice feature to stream DAB+ over a network and integrate it into other solutions like TVHeadEnd etc. The stream URLs can be downloaded as m3u playlist from a fixed URL.

But it supports only one channel at a time and the channel number needs to be set by command line or web interface.
It would be nice to support more then one channel/ensemble with help of an initial scan of a list of given channels and then switch the channel/SID on the fly when the stream with a SID has been requested by a http request. Using one SDR receiver per channel/ensemble seems to be overkill when only one service should be played. It should even be possible to support multiple streams per channel/ensemble. That's the way TVHeadEnd is using the muxes on a DVB-T2 or DVB-S2 device.

This would make Welle-cli a full solution as DAB+ streaming server.

@AlbrechtL
Copy link
Owner

Great idea! To use welle.io via TVHeadEnd is one if my dream because this makes it possible to integrate it into Kodi and it distributions. The aim for welle-cli is monitoring for DAB broadcasters so it is different from you request.

I saw that you started your own fork of welle-cli https://github.com/nRaecheR/dab_plus_streamer. I invite your to contribute to this project. What is your idea with dab_plus_streamer?

@nRaecheR
Copy link
Author

The goal is to have a streaming server for multiple DAB+ channels as described in the first post here. I learned that I need to do a lot of modifications in the shared code of CLI and GUI, so I think it's better to fork it and remove the QT-GUI completely because I don't want to do work on something I don't need for the core functionality. The same goes for the Windows, Mac and Android support.
I don't have a lot of spare time so this will be a low prio project for me. I really would like to interface DAB+ to TVHeadEnd with multiple channel and maybe slideshow support.

@gvanem
Copy link
Contributor

gvanem commented Feb 16, 2022

@AlbrechtL What happened to the idea to use SDRDAB as a library in Welle-IO? Ref: #102. I still see you have a branch for it.

@AlbrechtL
Copy link
Owner

@nRaecheR welle-cli and welle.io GUI are complete independent from each other (different code, different build system, different maintainer, different use case). But both are implementing the interface https://github.com/AlbrechtL/welle.io/blob/master/src/backend/radio-controller.h. I highly recommend that you do the same way. If you do it in the same way you can benefit from the welle.io community and we can benefit from you work (e.g. if you do improvements in the backend). I have no problem to add your implementation as a third application besides welle.io GUI and welle-cli because your use case is complete different.
But anyway you can start as you own. That's open source! If you would like to contribute to welle.io our doors are open.

@gvanem As you see there is no activity since 22 November 2017. The original website https://sdr.kt.agh.edu.pl/sdrdab-decoder/ is down and at https://github.com/kwanty/sdrdab that last commit is from 8 August 2017. So I assume that the sdrdab project is dead. In the last 4 years we improved the backend code a lot so there is no need to change the decoder. Most likely I will remove sdrdab branch.

@lo-decibel
Copy link

lo-decibel commented Apr 8, 2022

To use welle.io via TVHeadEnd is one if my dream because this makes it possible to integrate it into Kodi and it distributions.

Yep, totally possible. I had DAB radio working in Tvheadend by creating a script to pipe the output of eti-cmdline --> dablin --> ffmpeg --> tvheadend. I just had to create an m3u8 playlist for radio manually. However, I found this approach made my system unstable, and it also took about 15 seconds to switch programmes. I'm going to try and find another solution with the welle-cli webserver.

My only gripe with welle is that the webserver transcodes the DAB stream to MP3. Is it possible to output the raw AAC stream and let ffmpeg add the headers for Tvheadend?

@rocus
Copy link

rocus commented Jul 31, 2022

Below I describe a rather hacky way to change the channel of a running welle-cli -w8888 server. I am not a fan of C (cpp is much better) and incapable of making changes in a big and complicated program like welle-cli. The result of a very small change in welle-cli and a monitoring script does a channel change as was the purpose. I am not proud of it (everything should happen in welle-cli) but it works.

The change in welle-cli is a few lines that create a file (in /tmp) containing the radio sid that was supposed to play.
A diff between the old and new webradiointerface.cpp is:

t446,447d445
< FILE *fptr;
< 
509,513d506
<                     if ( ! success) {
<                          fptr = fopen ( "/tmp/dabwrongchannel.txt" , "w+" );
<                          fprintf ( fptr , "%s" , req.url.c_str() );
<                          fclose  ( fptr );
<                     }

This is right after the line: success = send_mp3(s, match_mp3[1]);

Together with the starting of welle-cli there is a script constantly monitoring the existance of the file /tmp/dabwrongchannel.txt.
See issue 747 for how to make the file stations.json.

for (( ; ; ))
do
   if [ -f /tmp/dabwrongchannel.txt ];   then
      sidhex=`sed 's/\/mp3\/0x//' /tmp/dabwrongchannel.txt | tr [:lower:] [:upper:]`
      sid=$(echo "ibase=16; $sidhex" | bc)
      chn=`jq '.[] | select (.stationSId =='$sid' ) | .channelName'  stations.json  | sed s/\"//g`
      echo stationid: $sid stationidhex: $sidhex Newchannel: $chn
      curl -X POST --data "$chn" http://localhost:8888/channel
      rm /tmp/dabwrongchannel.txt
   fi
   sleep  1 
done

If this file exists then a (hex) stationid is extracted. The stationid is converted to decimal and the channel is searched for
this stationid. With curl the currentchannel is changed for the desired channel and the temporary file is deleted. The channelchange takes some time and thereafter the radio station must be selected again on the streamer.
When the playing of a stream goes wrong the first time that is an indication that a channelchange must take place; it should play the second time.

Again, the program should check beforehand if the channel is correct , make, if necessary, a channel change and then stream the choosen channel. Maybe somebody is capable of changing welle-cli in such a way.

@rocus
Copy link

rocus commented Aug 2, 2022

Because I found this hack unsatisfactory I decided to try to change the origional welle-cli program. I made some changes in the program webradiointerface.cpp and very few changes in an other file and got this working. I try to put this all in a pull request. This might take some time because I have not used git before.
See Pull request 748

@AlbrechtL
Copy link
Owner

See PR #748

@SzymonZy
Copy link

SzymonZy commented Feb 15, 2023

I got lost. Reading discussion I did not get if we can use channel and program in mp3 stream to retune? Or we are still forced to use single channel in welle.io and can't do playlist with channel and program together.

Edit: I see that http://192.168.1.35:8000/mp3-channel/12D/0x3a0b will not work. So there is no progress on possible tvheadend and kodi use of weele-io :/

Edit: I saw PR for next branch - so I compiled it, still mp3-channel is not supported.

@Lamarqe
Copy link

Lamarqe commented Aug 6, 2024

I implemented a DAB streaming server which is based on welle.io and handles the scenario discussed above:
https://github.com/Lamarqe/mpdcast-dab

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants