← Back to list

PoC: Worldwide FM Player using Python & VLC

Recent most of the smart phones don’t have FM Radio app installed. Moreover most of the time, one need to tune to the frequency available…

Shailesh N Ligade · 2025-02-16 07:49 · 0 claps · 2.8 min read
#fm-radio-online #python #pyqt #vlc #proof-of-concept
Open on Medium ↗
Wiki topics: 📐 · Mathematics 🎵 · Music & Audio

PoC: Worldwide FM Player using Python & VLC

Recent most of the smart phones don’t have FM Radio app installed. Moreover most of the time, one need to tune to the frequency available in the country/city.

We should be able to listen to all FM channels across globe in all possible languages.

Over weekend was busy with few things but managed to spend some to build this PoC with Python and VLC libraries.

Enjoy the Live stream of FM channels worldwide in all languages.

Screenshot of Worldwide FM Radio Player

Screenshot of Worldwide FM Radio Player

Here’s a Python project using PyQt6 for the GUI and VLC for streaming radio stations. The User Interface allows user to select a Country, Language and an Official Radio Station Name to play live FM streams. It uses your default internet connection for API calls and live streaming from radio stations.

The data source is radio-browser.info, a free APIs for worldwide radio stations are freely available here.

Components used:

  • Python latest version, I used 24.3.1 on windows
  • PyQt6 for simple UI
  • Python library for VLC from VideoLAN.

Features:

  • Uses PyQt6 for UI.
  • Fetches live FM radio stations using radio-browser.info API.
  • Plays selected radio stations using VLC.

Attached is full code for your reference along with steps.

Need any more information in this regards? you can reach out to me.

Installation:

  1. Ensure you have the required PHP packages:

pip install requests python-vlc PyQt6

  1. Install the latest VLC version from VideoLAN (python-vlc) led:

pip install python-vlc

3. You may have to modify VLC’s settings (if reqd only) Open VLC. Go to Tools → Preferences. Under Audio, change the Output module to “DirectX Audio Output” or “WaveOut”. Restart VLC and re-run the script. 4. Run the Python code and test the application

Please note: 1. There may have 4/5 seconds delay in the beginning first time running 2. There could be some stations not having live streaming right at the moment you are testing. Try some other stations too.

5. Finally this code needs to be disputable

I did it for windows with below steps, which created a .EXE file.

Step 1: Install PyInstaller installed. Run:

pip install pyinstaller

Step 2: Create Executable: Navigate to the folder containing your script and run:

pyinstaller — onefile — windowed — name “FM_Radio_Player” <python_script_name>.py

— onefile: Packs everything into a single .exe file. — windowed: Hides the console window. — name “FM_Radio_Player”: Names the output file.

Step 3: Find Your Executable After running the command, your .exe file will be in the “dist” folder inside your project directory.

Step 4: Test the Executable

Run FM_Radio_Player.exe to verify how it works.

Thats it for now!, hope you read my thoughts on other topics as well on Medium ***here.***

Request your comments so that I can improve myself on this topic. Happy to hear you at ***Linkedin.***

import os
import sys
import vlc
import requests
from PyQt6.QtWidgets import QApplication, QWidget, QVBoxLayout, QLabel, QPushButton, QComboBox 
from PyQt6.QtGui import QFont
from PyQt6.QtCore import Qt

# Ensure proper scaling on Windows
os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "1"

API_BASE = "https://de1.api.radio-browser.info/json"

def get_countries():
    response = requests.get(f"{API_BASE}/countries")
    return [c["name"] for c in response.json()]

def get_languages():
    response = requests.get(f"{API_BASE}/languages")
    return [l["name"] for l in response.json()]

def get_stations_by_country_and_language(country, language):
    response = requests.get(f"{API_BASE}/stations/bycountry/{country}")
    stations = response.json()
    return [s for s in stations if s["language"] == language]

class RadioPlayer(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

        # Use an alternative VLC instance mode
        instance = vlc.Instance("--no-video", "--quiet")
        self.player = instance.media_player_new()

    def initUI(self):
        self.setWindowTitle("Worldwide FM Radio Player by Shailesh")

        layout = QVBoxLayout()

        self.header = QLabel("Worldwide FM Radio Player")

        font = QFont("Verdana", 17, QFont.Weight.Bold)
        label_font = QFont("Verdana", 11)

        self.header.setFont(font)
        self.header.setAlignment(Qt.AlignmentFlag.AlignCenter)
        self.header.setStyleSheet("color: red; background-color: orange; padding: 10px;")

        self.country_label = QLabel("Select Country:")
        self.country_combo = QComboBox()
        self.country_combo.addItems(get_countries())
        self.country_combo.currentTextChanged.connect(self.load_stations)

        self.language_label = QLabel("Select Language:")
        self.language_combo = QComboBox()
        self.language_combo.addItems(get_languages())
        self.language_combo.currentTextChanged.connect(self.load_stations)

        self.station_label = QLabel("Select Station:")
        self.station_combo = QComboBox()

        self.play_button = QPushButton("Play")
        self.play_button.clicked.connect(self.play_radio)

        self.country_label.setFont(label_font)
        self.language_label.setFont(label_font)
        self.station_label.setFont(label_font)
        self.play_button.setFont(font)
        self.play_button.setStyleSheet("color: RED; background-color: orange; padding: 10px;")

        layout.addWidget(self.header)
        layout.addWidget(self.country_label)
        layout.addWidget(self.country_combo)
        layout.addWidget(self.language_label)
        layout.addWidget(self.language_combo)
        layout.addWidget(self.station_label)
        layout.addWidget(self.station_combo)
        layout.addWidget(self.play_button)

        self.setLayout(layout)

    def load_stations(self):
        country = self.country_combo.currentText()
        language = self.language_combo.currentText()
        self.station_combo.clear()
        self.stations = get_stations_by_country_and_language(country, language)
        for station in self.stations:
            self.station_combo.addItem(station["name"], station["url"])

    def play_radio(self):
        url = self.station_combo.currentData()
        if url:
            self.player.set_media(vlc.Media(url))
            self.player.play()

if __name__ == "__main__":
    app = QApplication(sys.argv)
    player = RadioPlayer()
    player.show()
    sys.exit(app.exec())

메타데이터
post_id
f93d989eb57c
slug
poc-worldwide-fm-player-using-python-vlc-f93d989eb57c
url
https://medium.com/@ShaileshLigade/poc-worldwide-fm-player-using-python-vlc-f93d989eb57c
canonical_url
https://medium.com/@ShaileshLigade/poc-worldwide-fm-player-using-python-vlc-f93d989eb57c
author_url
https://medium.com/@ShaileshLigade
status
ok
fetched_at
2026-07-20 23:28:45