A Python-based karaoke application that plays audio from YouTube and displays synchronized lyrics in real-time.
-
Extract audio from YouTube videos using yt-dlp.
-
Display synchronized lyrics with timestamps.
-
Fetch lyrics from LRCLib API, fallback to a local .lrc file.
-
Real-time lyric highlighting in a Tkinter GUI.
-
Playback controls: pause, resume, and skip lines.
-
Python 3.8+
-
VLC media player installed on your system
-
yt_dlp
-
python-vlc
-
tkinter (usually included with Python)
-
requests
Install required packages using:
pip install yt_dlp python-vlc requests
-
Set the YouTube URL and track info at the top of player-2.py:
YOUTUBE_URL = "https://youtu.be/LbLbkAMjPeM" TRACK_NAME = "Lonely" ARTIST_NAME = "Akon" LRC_FILE_PATH = "Lonely.lrc" -
Run the script:
python player-2.py -
Controls in the GUI:
-
Pause: Pause audio playback.
-
Resume: Resume audio playback.
-
Skip: Jump to the next line of lyrics.
-
Attempts to fetch lyrics from the LRCLib API using track name and artist.
-
Saves fetched lyrics to .lrc as a fallback.
-
If API fails, reads lyrics from local .lrc file.
-
Parses timestamps to synchronize lyrics with audio.
-
Ensure VLC is properly installed and accessible by Python.
-
The app currently supports a single song at a time.
-
For custom tracks, update YOUTUBE_URL, TRACK_NAME, and ARTIST_NAME.