VideoHelp Forum




+ Reply to Thread
Results 1 to 9 of 9
  1. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    I am trying to create a PVR for recording from a 24/7 live stream at specified start times lasting for a specific time.
    I have succeeded doing this for sites that stream into a video player in a webpage, but I have not found a working method for the SVT streams on SVT1 and SVT2

    The URL lands on a page with a Play button which will start playing if clicked.

    What I need is:
    1) Some way to extract the playing URL which can be used with ffmpeg
    2) The ffmpeg command to record the stream for a set time.

    I have done this for the working sites:
    Code:
    "ffmpeg -hide_banner -referer \"${VIDEOURL}\" -i \"${VIDEOSTR}\" -vf scale=w=-4:h=480 -c:v libx264 -preset fast -crf 26 -c:a copy -t ${CAPTURETIME} ${TARGETFILE}"
    Where:
    VIDEOURL is the URL to the webpage containing the video player
    VIDEOSTR is the m3u8 stream URL on that player
    CAPTURETIME is the video duration to record
    TARGETFILE is the output mp4 file

    I use this command in at jobs on a Linux server to record the other streams.
    So the start is given by the at command trigger time.

    But the SVT site seems not to use m3u8 streams and has no embedded player either.

    Any suggestions welcome!
    Quote Quote  
  2. ffmpeg -hide_banner -i "https://svt1-d.akamaized.net/se/svt1/master-fmp4.m3u8?defaultSubLang=1" -c copy video.mp4
    [hls @ 06ca3ec0] Skip ('#EXT-X-VERSION:5')
    [hls @ 06ca3ec0] Skip ('#EXT-X-INDEPENDENT-SEGMENTS')
    ...
    Input #0, hls, from 'https://svt1-d.akamaized.net/se/svt1/master-fmp4.m3u8?defaultSubLang=1':
    Duration: N/A, start: 1401232.000000, bitrate: N/A
    Program 0
    Metadata:
    variant_bitrate : 1870000
    Stream #0:0(sv): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Svenska
    Stream #0:1(sv-x-tal): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Uppl├дst undertext
    Stream #0:2: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 960x540, 0 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
    variant_bitrate : 1870000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashavc1cmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Video
    Program 1
    Metadata:
    variant_bitrate : 536000
    Stream #0:0(sv): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Svenska
    Stream #0:1(sv-x-tal): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Uppl├дst undertext
    Stream #0:3: Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 416x234, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
    variant_bitrate : 536000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashavc1cmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Video
    Program 2
    Metadata:
    variant_bitrate : 1222000
    Stream #0:0(sv): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Svenska
    Stream #0:1(sv-x-tal): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Uppl├дst undertext
    Stream #0:4: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 640x360, 0 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
    variant_bitrate : 1222000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashavc1cmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Video
    Program 3
    Metadata:
    variant_bitrate : 3125000
    Stream #0:0(sv): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Svenska
    Stream #0:1(sv-x-tal): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Uppl├дst undertext
    Stream #0:5: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 0 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
    variant_bitrate : 3125000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashavc1cmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Video
    Program 4
    Metadata:
    variant_bitrate : 4720000
    Stream #0:0(sv): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Svenska
    Stream #0:1(sv-x-tal): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Uppl├дst undertext
    Stream #0:6: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 0 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashavc1cmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Video
    Output #0, mp4, to 'video.mp4':
    Metadata:
    encoder : Lavf58.29.100
    Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, q=2-31, 0 kb/s, 50 fps, 50 tbr, 90k tbn, 90k tbc (default)
    Metadata:
    variant_bitrate : 3125000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashavc1cmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Video
    Stream #0:1(sv): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp (default)
    Metadata:
    variant_bitrate : 4720000
    major_brand : dash
    minor_version : 1
    compatible_brands: iso8mp41dashcmfc
    creation_time : 2021-12-08T13:25:54.000000Z
    comment : Svenska
    Stream mapping:
    Stream #0:5 -> #0:0 (copy)
    Stream #0:0 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    [hls @ 06ca3ec0] No longer receiving playlist 2 ('https://svt1-d.akamaized.net/se/svt1/7adcdd89-f795-467b-a63a-27e8d35932ce/dash-v2/v2.m3u8')
    [hls @ 06ca3ec0] No longer receiving playlist 4 ('https://svt1-d.akamaized.net/se/svt1/7adcdd89-f795-467b-a63a-27e8d35932ce/dash-v1/v1.m3u8')
    [https @ 0775ad40] Opening 'https://svt1-d.akamaized.net/se/svt1/7adcdd89-f795-467b-a63a-27e8d35932ce/dash-v3/v3.m3u8' for reading
    [hls @ 06ca3ec0] Skip ('#EXT-X-VERSION:6')
    [https @ 08564b40] Opening 'https://svt1-d.akamaized.net/se/svt1/7adcdd89-f795-467b-a63a-27e8d35932ce/dash-v3/v3-init.mp4' for reading...
    Quote Quote  
  3. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    Question:
    How did you get to this:
    Code:
    https://svt1-d.akamaized.net/se/svt1/master-fmp4.m3u8?defaultSubLang=1
    from this:
    Code:
    https://www.svtplay.se/kanaler/svt1?start=auto

    If I use your URL above then I am able to download the stream (at least the test for 66 seconds was successful).
    But I would like to know how you arrived at your URL from my URL so I can apply the method to other URL sources.
    Quote Quote  
  4. Member
    Join Date
    Nov 2015
    Location
    Campuchia - Sapoche
    Search Comp PM
    try with api link in F12
    Last edited by therain; 26th Dec 2021 at 06:06.
    Quote Quote  
  5. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    Originally Posted by therain View Post
    try with api link in F12
    I cannot see that in my browser...
    I am using Firefox on Windows 10, but the download and other operations are done on an Ubuntu Server 20.04.3 machine without any GUI installed. And it is automated such that it runs via at jobs 24/7...

    I am using this command in a script to extract the m3u8 URL from a given website, but it does not work on SVTPlay:

    Code:
    CMD="curl -s \"${STREAMURL}\" | grep -o -e \"https://.\+m3u8\" | head -n 1"
    M3U8=$(eval $CMD)
    Here STREAMURL is the input, i.e. the URL to the webpage where the video plays.

    I really need an alternate extractor for the m3u8 stream that works for SVT too.
    Quote Quote  
  6. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    Originally Posted by LZAA View Post
    Code:
    ffmpeg -hide_banner -i "https://svt1-d.akamaized.net/se/svt1/master-fmp4.m3u8?defaultSubLang=1" -c copy video.mp4
    From this I have extracted the proposed URL as:
    Code:
    https://svt1-d.akamaized.net/se/svt1/master-fmp4.m3u8
    And used it in my script, and it works OK.

    I have also modified it to this for svt2:
    Code:
    https://svt2-d.akamaized.net/se/svt2/master-fmp4.m3u8
    This too works.

    But when I try to do the same for the other 3 channels it stops working, so these are non-working m3u8 URL:
    Code:
    https://svt24-d.akamaized.net/se/svt24/master-fmp4.m3u8
    https://kunskapskanalen-d.akamaized.net/se/kunskapskanalen/master-fmp4.m3u8
    https://svtbarn-d.akamaized.net/se/svtbarn/master-fmp4.m3u8
    So I would really very much like to know HOW you arrived at the URL used in the ffmpeg command shown in your reply to my question...
    Quote Quote  
  7. Originally Posted by BosseB View Post
    Originally Posted by therain View Post
    try with api link in F12
    I cannot see that in my browser...
    I am using Firefox on Windows 10
    Firefox
    Image
    [Attachment 62567 - Click to enlarge]


    ---------------
    Originally Posted by BosseB View Post

    But when I try to do the same for the other 3 channels it stops working, so these are non-working m3u8 URL:
    Code:
    https://svt24-d.akamaized.net/se/svt24/master-fmp4.m3u8
    https://kunskapskanalen-d.akamaized.net/se/kunskapskanalen/master-fmp4.m3u8
    https://svtbarn-d.akamaized.net/se/svtbarn/master-fmp4.m3u8
    Kunskapskanalen

    Image
    [Attachment 62571 - Click to enlarge]


    Code:
    your code 
    https://kunskapskanalen-d.akamaized.net/se/kunskapskanalen/master-fmp4.m3u8
    
    code from sreenshot
    https://svtk-d.akamaized.net/se/svtk/master-fmp4.m3u8?defaultSubLang=1
    Last edited by mister_ nex; 26th Dec 2021 at 14:54.
    Quote Quote  
  8. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    I tried to use the browser again but was not able to bring on the screen display in the way you show.
    But then I instead used the original URL from the first reply above by @LZAA and modified the identifiers until I got it to work.
    It seems like these are the correct URL's to use:
    Code:
    # SVT1:  http://www.svtplay.se https://svt1-d.akamaized.net/se/svt1/master-fmp4.m3u8
    # SVT2:  http://www.svtplay.se https://svt2-d.akamaized.net/se/svt2/master-fmp4.m3u8
    # SVT24/Barnkanalen: http://www.svtplay.se https://svtb-d.akamaized.net/se/svtb/master-fmp4.m3u8
    # Kunskapskanalen:   http://www.svtplay.se https://svtk-d.akamaized.net/se/svtk/master-fmp4.m3u8
    SVT24 and Barnkanalen share the same stream URL so they are known as svtb but the broadcast times are non-overlapping....
    I will let it be for now, but you never know when they change again and then I have to somehow grab them myself...
    Quote Quote  
  9. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    Just an update for completeness:
    I found a way to extract a usable URL for ffmpeg from the SVTPlay live stream URLs:

    1) I installed svtplay-dl using these instructions for Debian-Ubuntu.
    2) Then I used this type of command:
    Code:
    $ svtplay-dl --live --only-video -g https://www.svtplay.se/kanaler/svt1
    https://svt1-d.akamaized.net/se/svt1/manifest.mpd?defaultSubLang=1
    Notice that this gives the mpd reference rather than m3u8, but ffmpeg accepts it and downloads happily using this URL too.
    I remove the last part before submitting to ffmpeg of course.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!