alexta69 / metube

Self-hosted YouTube downloader (web UI for youtube-dl / yt-dlp)
GNU Affero General Public License v3.0
3.96k stars 259 forks source link

New Feature? Stream only output.m3u with #EXTM3U metadata #380

Closed siliconhippy closed 2 months ago

siliconhippy commented 5 months ago

I don't know if this feature exists already ....

But can I configure an input input.m3u playlist with #EXTM3U tags like tvg-chno tvg-id tvg-name tvg-logo tvg-epg for multiple stream URLs, to be processed into an output.m3u playlist with metadata preserved, but without downloading any content ?

This way the output.m3u can be fed into external players like VLC, Kodi and Jellyfin m3u tuner.

PikuZheng commented 5 months ago

why not bash and yt-dlp

siliconhippy commented 5 months ago

Yes but you have a popular webGUI yt_dlp processor. Why not integrate above feature to make it work for both streaming and downloading ?

This will make your project better than Tartube and others. I am surprised nobody has this feature yet. 😃

PikuZheng commented 5 months ago

can you provide an example of command line ?

siliconhippy commented 5 months ago

From much prompting Skype Bing Chat. Unlike streamlink which requires sed regex commands to loop for m3u metadata, yt_dlp has a built-in --exec command for #EXTM3U tags looping.

``

!/bin/bash

Define the input and output playlist files

input_playlist="input.m3u" output_playlist="output.m3u"

add /data/myscripts and /data/myscripts2

or, PATH=/root:$PATH

PATH=/data/myscripts:/data/myscripts2:$PATH

Define the URL of the input playlist

input_url="URL_input_m3u"

Download the input playlist from a remote server using wget

wget -O $input_playlist $input_url

Run yt-dlp with the desired options

yt-dlp -a input.m3u -f "bestvideo[height<=720]+bestaudio/best" --skip-download --hls-use-mpegts --no-progress --playlist-metadata-from-title "%(tvg_id)s %(tvg_name)s %(tvg_logo)s %(group_title)s %(tvg_chno)s %(tvg_epg)s" --no-playlist-metafiles --exec "echo #EXTINF:-1, tvg-id=\"{id}\", tvg-name=\"{title}\", tvg-logo=\"{thumbnail}\", group-title=\"{playlist_title}\", tvg-chno=\"{tvg_chno}\", tvg-epg=\"{tvg_epg}\", {title} >> output.m3u; echo {url} >> output.m3u"

chmod +x yt_dlp.sh

set up cronjob to refresh m3u files !

siliconhippy commented 5 months ago

Edit for bash loop above:

There is no yt_dlp http server for streaming live, except for maybe streaming downloaded videos !

So I have removed the erroneous http server references.

Alternatively people just set up a python http.server.

This might help too: https://cgomesu.com/blog/Tvhlink/#building-m3u-playlists