[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
20.04.3:

CMD="curl -s \"${STREAMURL}\" | grep -o -e \"https://.\+m3u8\" | head -n 1"
M3U8=$(eval $CMD)
if [ -z $M3U8 ]; then
  RESULT=1
  echo "Error, no response!"
else
  RESULT=0
  eval "echo ${STREAMURL} ${M3U8} > ${URLFILE}"
  echo "Done, result in  ${URLFILE}:  ${STREAMURL} ${M3U8}"
fi
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:
https://www.svtplay.se/kanaler/svt1?start=auto
https://www.svtplay.se/kanaler/svt2?start=auto
https://www.svtplay.se/kanaler/svt24?start=auto
https://www.svtplay.se/kanaler/kunskapskanalen?start=auto

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