[FFmpeg-user] Getting m3u8 URL from SVTPlay channels?

Bo Berglund bo.berglund at gmail.com
Mon Dec 27 08:41:15 EET 2021


On Sun, 26 Dec 2021 21:10:05 +0100, Moritz Barsnick <barsnick at gmx.net> wrote:

>On Sun, Dec 26, 2021 at 08:26:34 +0100, Bo Berglund wrote:
>> 1) I already have several of the tools mentioned (ytube-dl, yt-dlp, svtplay-dl
>> etc), but they did not manage to download the real-time streams from SVT.
>
>I double-checked this. The svtplay-dl binary offered as a download
>(version 4.10) seems to be broken. It has a date parsing error which
>seems to be fixed in the git version (and the fix should be in 4.10, so
>d'uh).

On my Ubuntu Server 20.04.3 system:
Installed like this:
$ sudo apt install svtplay-dl

Version test:
$ svtplay-dl --version
svtplay-dl 2.4-2

Very old! So I did:
sudo apt remove svtplay-dl

Then I used the directions on this page to modify apt repository and then
install:
https://svtplay-dl.se/install/linux/ (for Debian/Ubuntu)

New version test:
$ svtplay-dl --version
svtplay-dl 4.10

>With the git version, I get this result:
>
>[barsnick at goodtimes svtplay-dl]$ ./svtplay-dl --live --only-video -g https://www.svtplay.se/kanaler/svt1
>https://svt1-d.akamaized.net/se/svt1/manifest.mpd?defaultSubLang=1


So next I used the new svtplay-dl and I got these results:

$ svtplay-dl --live --only-video -g https://www.svtplay.se/kanaler/svt1
https://svt1-d.akamaized.net/se/svt1/manifest.mpd?defaultSubLang=1

$ svtplay-dl --live --only-video -g https://www.svtplay.se/kanaler/svt2
https://svt2-d.akamaized.net/se/svt2/manifest.mpd?defaultSubLang=1

$ svtplay-dl --live --only-video -g https://www.svtplay.se/kanaler/svtbarn
https://svtb-d.akamaized.net/se/svtb/manifest.mpd?defaultSubLang=1

$ svtplay-dl --live --only-video -g
https://www.svtplay.se/kanaler/kunskapskanalen
https://svtk-d.akamaized.net/se/svtk/manifest.mpd?defaultSubLang=1

$ svtplay-dl --live --only-video -g https://www.svtplay.se/kanaler/svt24
https://svtb-d.akamaized.net/se/svtb/manifest.mpd?defaultSubLang=1

Good progress!

>And ffmpeg can handle that given URL just fine.

I have checked this too since my script expected an m3u8 URL.
And it does work also with the .mpd URL. :-)


>(Funny thing: Since SVT seems to have separate substream manifests for
>video and audio now, svtplay-dl apparently currently cannot give you
>both those URLs with "-g", you get only a pure video URL. With the
>"--only-video" only "--only-audio" option as shown above, I get the
>overall manifest which includes three stream qualities. If you throw
>that at ffmpeg, it will select the best stream qualities by itself, or
>you can just do "-map 0:M -map 0:N".)

My script is using ffmpeg to reformat to a fixed resolution while downloading
using these arguments:

 -vf scale=w=-4:h=480 -c:v libx264 -preset fast -crf 26 -c:a copy

>> 3) The problem is that some broadcasts are not available after the fact (like
>> some sports events) and have to be "recorded" in real time off of the stream
>> itself.
>
>I agree, I do the same once in a while. :-)

I tried to use svtplay-dl directly to download the live stream but that did not
work:

$ svtplay-dl -c 60 --live -o svt1test2.mp4
https://www.svtplay.se/kanaler/svt1?start=auto
INFO: Outfile: svt1test2.mp4.mp4
INFO: Selected to download dash, bitrate: 4720 format: h264
ERROR: This is a live DASH stream, and they are not supported.

But since it works with ffmpeg I will use my existing script anyway...

THANK YOU VERY MUCH FOR CLARIFYING THE ISSUE!

I will now add this to my video handling documentation.


-- 
Bo Berglund
Developer in Sweden



More information about the ffmpeg-user mailing list