VideoHelp Forum




+ Reply to Thread
Results 1 to 10 of 10
  1. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    I was here on this forum about a month ago asking for help about using svtplay-dl on an Ubuntu server to download excerpts from the SVT1 and SVT2 live streams.

    But there was no solution found at that time and the thread digressed to discuss an alternate utility (whichj partially worked but I could never get both video and audio properly done.

    So I am wondering now if there has been progress in making svtplay-dl work for live streams.

    Apparently it does work for show snippets published by SVT on their website but I would like to get the live stream...
    The snippets can be downloaded already using yt-dlp, so no need for svtplay-dl for that.

    I want to build a PVR application to download from the live stream between set times so I can watch later even if the program has not been published (yet) on the SVTPlay website.
    Quote Quote  
  2. Doesn't look like it: https://github.com/spaam/svtplay-dl/issues/1558#issuecomment-1742168091

    Since there's no DRM, you can just use Streamlink:
    Code:
    streamlink "https://svt1-d.akamaized.net/se/svt1/manifest.mpd?defaultSubLang=1" best -o "svt1.mp4"
    It doesn't come with all the bells and whistles of N_m3u8DL-RE, but it does the job really well.
    Quote Quote  
  3. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    Originally Posted by stabbedbybrick View Post
    Since there's no DRM, you can just use Streamlink:
    Code:
    streamlink "https://svt1-d.akamaized.net/se/svt1/manifest.mpd?defaultSubLang=1" best -o "svt1.mp4"
    It doesn't come with all the bells and whistles of N_m3u8DL-RE, but it does the job really well.
    Thanks for that!
    I had looked at streamlink some years back but I never got it to work....
    The reason was that it did not have a way to stop recording then.

    So instead after some research I managed to get a raw ffmpeg command to work if given the m3u8 url argument.
    This m3u8, though, is not easy to find but since ffmpeg has a "t" argument I could set the duration that way if I could get the m3u8 url.
    Never managed to get m3u8 for SVTPlay, though.

    One question:
    Is there a streamlink argument to set the duration of the recording/download?

    Anyway, I have now tested streamlink after your suggestion like this:
    Code:
    timeout --signal=2 3m streamlink "https://svt1-d.akamaized.net/se/svt1/manifest.mpd?defaultSubLang=1" 540p -o "svt1-strm-3m-540.mp4"
    This works by sending Ctrl-C to streamlink after 3 minutes from start, but I feel it is really a rough way to stop its recording so I would like to know if there is some other (built-in) way to tell it to stop after a specific duration?

    BTW
    Code:
    $ streamlink -V
    streamlink 1.3.1
    But on the streamlink download page it says version 6.5.1!
    I have used apt install streamlink on my Ubuntu Workstation to get the 1.3.1 version....
    Last edited by BosseB; 29th Jan 2024 at 11:40. Reason: Found version problem
    Quote Quote  
  4. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by BosseB View Post
    Is there a streamlink argument to set the duration of the recording/download?
    See https://streamlink.github.io/cli.html#hls-options
    Specifically --hls-start-offset and --hls-duration
    Quote Quote  
  5. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    So now I have tested the SVTplay downloading using streamlink on a separate Ubuntu workstation, which seems to work fine.
    So now I wanted to move over to the real server and make sure I have the latest version on my Ubuntu server.

    When I check the server I get this response:

    Code:
    $ which streamlink
    /home/bosse/.local/bin/streamlink
    
    $ streamlink -V
    streamlink 2.4.0
    
    $ ll /home/bosse/.local/bin/streamlink
    -rwxrwxr-x 1 bosse bosse 218 2021-11-09 09:36 /home/bosse/.local/bin/streamlink
    So this version is old and the timestamp suggests that it needs to be updated...
    I think that this also indicates that it was installed using pip, but I do not remember so long ago...

    So I tried to use the pip way:
    Code:
    $ pip install --upgrade streamlink
    Collecting streamlink
      Downloading streamlink-6.5.1-py3-none-any.whl (510 kB)
    
    ....activity until....
    
    Collecting zipp>=3.1.0; python_version < "3.10"
      Downloading zipp-3.17.0-py3-none-any.whl (7.4 kB)
    ERROR: requests 2.26.0 has requirement urllib3<1.27,>=1.21.1, but you'll have urllib3 2.1.0 which is incompatible.
    Installing collected packages: exceptiongroup, sortedcontainers, attrs, outcome, sniffio, trio, h11, wsproto, trio-websocket, urllib3, zipp, importlib-resources, pycountry, typing-extensions, streamlink
      Attempting uninstall: streamlink
        Found existing installation: streamlink 2.4.0
        Uninstalling streamlink-2.4.0:
          Successfully uninstalled streamlink-2.4.0
    Successfully installed attrs-23.2.0 exceptiongroup-1.2.0 h11-0.14.0 importlib-resources-5.13.0 outcome-1.3.0.post0 pycountry-23.12.11 sniffio-1.3.0 sortedcontainers-2.4.0 streamlink-6.5.1 trio-0.24.0 trio-websocket-0.11.1 typing-extensions-4.9.0 urllib3-2.1.0 wsproto-1.2.0 zipp-3.17.0
    
    $ which streamlink
    /home/bosse/.local/bin/streamlink <===== Should not be there after an uninstall, right?
    $ streamlink -V
    /home/bosse/.local/lib/python3.8/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (2.1.0) or chardet (3.0.4)/charset_normalizer (2.0.7) doesn't match a supported version!
      warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported "
    streamlink 6.5.1
    
    $ sudo pip uninstall streamlink
    WARNING: Skipping streamlink as it is not installed. <===???????????
    
    $ which streamlink
    /home/bosse/.local/bin/streamlink  <===???????????
    
    $ pip install streamlink
    Requirement already satisfied: streamlink in ./.local/lib/python3.8/site-packages (6.5.1)
    Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in /usr/lib/python3/dist-packages (from streamlink) (1.6.8)
    Requirement already satisfied: lxml<6,>=4.6.4 in ./.local/lib/python3.8/site-packages (from streamlink) (4.6.4)
    Requirement already satisfied: pycountry in ./.local/lib/python3.8/site-packages (from streamlink) (23.12.11)
    Requirement already satisfied: certifi in /usr/lib/python3/dist-packages (from streamlink) (2019.11.28)
    Requirement already satisfied: websocket-client<2,>=1.2.1 in ./.local/lib/python3.8/site-packages (from streamlink) (1.2.1)
    Requirement already satisfied: urllib3<3,>=1.26.0 in ./.local/lib/python3.8/site-packages (from streamlink) (2.1.0)
    Requirement already satisfied: trio-websocket<1,>=0.9.0 in ./.local/lib/python3.8/site-packages (from streamlink) (0.11.1)
    Requirement already satisfied: isodate in ./.local/lib/python3.8/site-packages (from streamlink) (0.6.0)
    Requirement already satisfied: pycryptodome<4,>=3.4.3 in ./.local/lib/python3.8/site-packages (from streamlink) (3.11.0)
    Requirement already satisfied: typing-extensions>=4.0.0 in ./.local/lib/python3.8/site-packages (from streamlink) (4.9.0)
    Requirement already satisfied: requests<3,>=2.26.0 in ./.local/lib/python3.8/site-packages (from streamlink) (2.26.0)
    Requirement already satisfied: trio<1,>=0.22.0 in ./.local/lib/python3.8/site-packages (from streamlink) (0.24.0)
    Requirement already satisfied: importlib-resources<6.0.0,>=5.12.0; python_version < "3.9" in ./.local/lib/python3.8/site-packages (from pycountry->streamlink) (5.13.0)
    Requirement already satisfied: wsproto>=0.14 in ./.local/lib/python3.8/site-packages (from trio-websocket<1,>=0.9.0->streamlink) (1.2.0)
    Requirement already satisfied: exceptiongroup; python_version < "3.11" in ./.local/lib/python3.8/site-packages (from trio-websocket<1,>=0.9.0->streamlink) (1.2.0)
    Requirement already satisfied: six in /usr/lib/python3/dist-packages (from isodate->streamlink) (1.14.0)
    Requirement already satisfied: idna<4,>=2.5; python_version >= "3" in /usr/lib/python3/dist-packages (from requests<3,>=2.26.0->streamlink) (2.8)
    Requirement already satisfied: charset-normalizer~=2.0.0; python_version >= "3" in ./.local/lib/python3.8/site-packages (from requests<3,>=2.26.0->streamlink) (2.0.7)
    Requirement already satisfied: sniffio>=1.3.0 in ./.local/lib/python3.8/site-packages (from trio<1,>=0.22.0->streamlink) (1.3.0)
    Requirement already satisfied: outcome in ./.local/lib/python3.8/site-packages (from trio<1,>=0.22.0->streamlink) (1.3.0.post0)
    Requirement already satisfied: sortedcontainers in ./.local/lib/python3.8/site-packages (from trio<1,>=0.22.0->streamlink) (2.4.0)
    Requirement already satisfied: attrs>=20.1.0 in ./.local/lib/python3.8/site-packages (from trio<1,>=0.22.0->streamlink) (23.2.0)
    Requirement already satisfied: zipp>=3.1.0; python_version < "3.10" in ./.local/lib/python3.8/site-packages (from importlib-resources<6.0.0,>=5.12.0; python_version < "3.9"->pycountry->streamlink) (3.17.0)
    Requirement already satisfied: h11<1,>=0.9.0 in ./.local/lib/python3.8/site-packages (from wsproto>=0.14->trio-websocket<1,>=0.9.0->streamlink) (0.14.0)
    
    $ streamlink
    -bash: /home/bosse/.local/bin/streamlink: No such file or directory
    Sigh! Now I have a broken remnant of streamlink and no idea about how to get it fixed...

    If I try to install via apt I will get a really outdated version 1.3.1...:
    Code:
    $ apt policy streamlink
    streamlink:
      Installed: (none)
      Candidate: 1.3.1+dfsg-1
      Version table:
         1.3.1+dfsg-1 500
            500 http://se.archive.ubuntu.com/ubuntu focal/universe amd64 Packages
            500 http://se.archive.ubuntu.com/ubuntu focal/universe i386 Packages
            500 http://archive.ubuntu.com/ubuntu focal/universe amd64 Packages
            500 http://archive.ubuntu.com/ubuntu focal/universe i386 Packages
    
    $ apt policy python3
    python3:
      Installed: 3.8.2-0ubuntu2
      Candidate: 3.8.2-0ubuntu2
      Version table:
     *** 3.8.2-0ubuntu2 500
    What can I do now? I don't know if the problem is python or streamlink...
    But I would like to get this fixed, any advice on how???

    Can I use apt to get the distribution version of streamlink, and is it really so far behind or have they used a different version numbering system?
    What can be the problem here?
    Will
    Code:
    sudo apt install streamlink
    override the existing (now broken) install and give me a working streamlink?
    Quote Quote  
  6. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    I managed to fix the problem with the help of ChatGPT.
    So now the streamlink installation is OK with the latest version on-line.
    Quote Quote  
  7. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    Originally Posted by 2nHxWW6GkN1l916N3ayz8HQoi View Post
    Originally Posted by BosseB View Post
    Is there a streamlink argument to set the duration of the recording/download?
    See https://streamlink.github.io/cli.html#hls-options
    Specifically --hls-start-offset and --hls-duration
    No this does not work, the stream just continues past the 30 seconds I have tested with.
    I believe this is a duration for individual hls packets and not the entire stream download.
    Quote Quote  
  8. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by BosseB View Post
    No this does not work, the stream just continues past the 30 seconds I have tested with.
    I believe this is a duration for individual hls packets and not the entire stream download.
    Well yeah. Of course it goes past your time. The question is, does it stop in the end? Just wait a couple more seconds (30 max).

    --hls-duration [[XX:]XX:]XX[.XX] | [XXh][XXm][XX[.XX]s]


    Limit the playback duration, useful for watching segments of a stream. The actual duration may be slightly longer, as it is rounded to the nearest HLS segment.
    Quote Quote  
  9. Member
    Join Date
    Feb 2021
    Location
    Sweden
    Search Comp PM
    Well, I figured out how to fix this and also my video formatting.
    See this thread here.
    I am sending the stream via streamlink into ffmpeg to do the final formatting to the way I want to have the output files.
    The timeout is set inside ffmpeg so the videos end up at exactly the correct length.
    Quote Quote  
  10. Feels Good Man 2nHxWW6GkN1l916N3ayz8HQoi's Avatar
    Join Date
    Jan 2024
    Location
    Pepe Island
    Search Comp PM
    Originally Posted by BosseB View Post
    Well, I figured out how to fix this and also my video formatting.
    See this thread here.
    I am sending the stream via streamlink into ffmpeg to do the final formatting to the way I want to have the output files.
    The timeout is set inside ffmpeg so the videos end up at exactly the correct length.
    Well done.
    --[----->+<]>.++++++++++++.---.--------.
    [*drm mass downloader: widefrog*]~~~~~~~~~~~[*how to make your own mass downloader: guide*]
    Quote Quote  



Similar Threads

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