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

Bo Berglund bo.berglund at gmail.com
Sat Dec 25 11:13:14 EET 2021

See earlier thread named "Can ffmpeg record video from this kind of URL?" where
I discussed extracting m3u8 stream URL from a webpage URL where the video would
appear in the browser....

This m3u8 URL is then used in an ffmpeg command to download video content.

The findings in that thread has been put to work and functions on several
different streaming video pages I use.

But yesterday I also wanted to download from the SVT_Play site and here the URL
extractor does not work...

The current solution is like this in the script running on Ubuntu Server

CMD="curl -s \"${STREAMURL}\" | grep -o -e \"https://.\+m3u8\" | head -n 1"
M3U8=$(eval $CMD)
if [ -z $M3U8 ]; then
  echo "Error, no response!"
  eval "echo ${STREAMURL} ${M3U8} > ${URLFILE}"
  echo "Done, result in  ${URLFILE}:  ${STREAMURL} ${M3U8}"
exit ${RESULT}

Here STREAMURL is the input, i.e. the URL to the webpage where the video plays.
And the result is saved to a file from which the download script reads its
referer and stream url.

But on the following pages it does not work at all:

These are the public Swedish TV channels.

Is there a programmatic way to extract the m3u8 URL from these sites so it can
be used with ffmpeg to download the videos?

Bo Berglund
Developer in Sweden

More information about the ffmpeg-user mailing list