aajanki / yle-dl

Download videos from Yle servers
https://aajanki.github.io/yle-dl/index-en.html
GNU General Public License v3.0
309 stars 52 forks source link

Piping to MPV in Windows seemingly broken #362

Open fragande opened 5 months ago

fragande commented 5 months ago

Using the latest version of yle-dl (20240429) I get the following error when trying to run yle-dl --pipe tv2 | mpv -:

Failed to recognize file format.

MPV is latest version and I'm running Windows 10. Saving to (and playing) file works fine but not piping.

Full verbose:

[file] Reading from stdin...
DEBUG: tv2 is a live TV channel
DEBUG: HTTP GET https://player.api.yle.fi/v1/preview/yle-tv2.json?language=fin&ssl=true&countryCode=FI&host=areenaylefi&app_id=player_static_prod&app_key=8930d72170e48303cf5f3867780d549b&isPortabilityRegion=true
DEBUG: HTTP status code: 200
DEBUG: HTTP response headers:
DEBUG: Content-Type: application/json; charset=utf-8
DEBUG: Transfer-Encoding: chunked
DEBUG: Connection: keep-alive
DEBUG: Date: Sun, 16 Jun 2024 16:56:10 GMT
DEBUG: Server: nginx
DEBUG: Cache-Control: max-age=30
DEBUG: Access-Control-Allow-Methods: GET, HEAD, OPTIONS
DEBUG: Access-Control-Allow-Origin: https://areena.yle.fi
DEBUG: Access-Control-Allow-Credentials: true
DEBUG: Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
DEBUG: Content-Encoding: gzip
DEBUG: Vary: Accept-Encoding
DEBUG: X-Cache: Miss from cloudfront
DEBUG: Via: 1.1 d13436be9e793d00b0273db3f7904816.cloudfront.net (CloudFront)
DEBUG: X-Amz-Cf-Pop: FRA60-P2
DEBUG: X-Amz-Cf-Id: kfup0xmC3Gntccie9PRyL7h0FwTNSIOyZd5s8iOAZ2bZyvxm54cXSw==
DEBUG: preview data:
{
  "meta": {
    "id": "yle-tv2"
  },
  "data": {
    "ongoing_channel": {
      "multiaudio": true,
      "media_id": "10-54",
      "program_id": "1-70382835",
      "dvr_window_in_seconds": 14400,
      "service_schedule": [
        {
          "subtitles": [],
          "startTime": "2024-06-16T15:54:32+03:00",
          "endTime": "2024-06-16T17:54:31+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            },
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "swe",
              "trackIndex": 1,
              "trackKey": "2.audio"
            },
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "eng",
              "trackIndex": 3,
              "trackKey": "4.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-16T17:54:31+03:00",
          "endTime": "2024-06-16T18:09:12+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            }
          ]
        },
        {
          "subtitles": [
            {
              "type": "CaptionTrack",
              "language": "fin",
              "kind": "hardOfHearing",
              "trackIndex": 2,
              "trackKey": "Ohjelmatekstitys"
            }
          ],
          "startTime": "2024-06-16T18:09:12+03:00",
          "endTime": "2024-06-16T18:24:49+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-16T18:25:37+03:00",
          "endTime": "2024-06-16T18:50:00+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-16T18:50:00+03:00",
          "endTime": "2024-06-16T20:55:00+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            },
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "swe",
              "trackIndex": 1,
              "trackKey": "2.audio"
            },
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "eng",
              "trackIndex": 3,
              "trackKey": "4.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-16T20:55:00+03:00",
          "endTime": "2024-06-16T21:10:00+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            }
          ]
        },
        {
          "subtitles": [
            {
              "type": "CaptionTrack",
              "language": "fin",
              "kind": "hardOfHearing",
              "trackIndex": 2,
              "trackKey": "Ohjelmatekstitys"
            }
          ],
          "startTime": "2024-06-16T21:10:00+03:00",
          "endTime": "2024-06-16T21:26:03+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-16T21:26:03+03:00",
          "endTime": "2024-06-16T21:50:00+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-16T21:50:00+03:00",
          "endTime": "2024-06-16T23:55:00+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            },
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "swe",
              "trackIndex": 1,
              "trackKey": "2.audio"
            },
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "eng",
              "trackIndex": 3,
              "trackKey": "4.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-16T23:55:00+03:00",
          "endTime": "2024-06-17T00:16:00+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-17T00:16:00+03:00",
          "endTime": "2024-06-17T00:45:43+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            },
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "eng",
              "trackIndex": 3,
              "trackKey": "4.audio"
            }
          ]
        },
        {
          "subtitles": [],
          "startTime": "2024-06-17T00:45:43+03:00",
          "endTime": "2024-06-17T03:31:58+03:00",
          "audioTracks": [
            {
              "format": "stereo",
              "type": "AudioTrack",
              "language": "fin",
              "trackIndex": 0,
              "trackKey": "1.audio"
            }
          ]
        }
      ],
      "title": {
        "fin": "Yle TV2"
      },
      "content_type": "VideoObject",
      "image": {
        "id": "yle-tv2",
        "version": null
      },
      "service_id": "yle-tv2",
      "manifest_url": "https://yletv.akamaized.net/hls/live/622366/yletv2fin/index.m3u8"
    }
  }
}
DEBUG: Detected a full-HD media
DEBUG: Probing for stream flavors
mime type is not rfc8216 compliant
[hls @ 00000279cd936d40] Can't support the subtitle(uri: yletv_sub3.m3u8)
[hls @ 00000279cd936d40] Can't support the subtitle(uri: yletv_sub4.m3u8)
[hls @ 00000279cd936d40] Can't support the subtitle(uri: yletv_sub1.m3u8)
[hls @ 00000279cd936d40] Can't support the subtitle(uri: yletv_sub2.m3u8)
DEBUG: Available flavors:
DEBUG: bitrate: 659.038, height: 270, width: 480, backends: ffmpeg
DEBUG: bitrate: 1120.055, height: 360, width: 640, backends: ffmpeg
DEBUG: bitrate: 2173.809, height: 480, width: 848, backends: ffmpeg
DEBUG: bitrate: 3491.001, height: 720, width: 1280, backends: ffmpeg
DEBUG: bitrate: 4861.671, height: 720, width: 1280, backends: ffmpeg
DEBUG: bitrate: 8154.651, height: 1080, width: 1920, backends: ffmpeg
DEBUG: max_height: None, max_bitrate: None
DEBUG: Selected flavor: StreamFlavor(media_type='video', height=1080, width=1920, bitrate=8154.651, streams=[<yledl.backends.DASHHLSBackend object at 0x0000015DE6A0E9D0>])
DEBUG: Now trying downloader ffmpeg
DEBUG: Executing:
DEBUG: ffmpeg -y -headers 'X-Forwarded-For: 91.159.231.113
' -loglevel warning -thread_queue_size 2048 -seekable 0 -stats -analyzeduration 10000000 -probesize 80000000 -i https://yletv.akamaized.net/hls/live/622366/yletv2fin/index.m3u8 -map '0:p:5:v?' -map '0:p:5:a?' -scodec srt -map '0:p:5:s?' -vcodec copy -acodec aac -dn -f matroska pipe:1
mime type is not rfc8216 compliant
[hls @ 0000024e67bafe80] Can't support the subtitle(uri: yletv_sub3.m3u8)
[hls @ 0000024e67bafe80] Can't support the subtitle(uri: yletv_sub4.m3u8)
[hls @ 0000024e67bafe80] Can't support the subtitle(uri: yletv_sub1.m3u8)
[hls @ 0000024e67bafe80] Can't support the subtitle(uri: yletv_sub2.m3u8)
Failed to recognize file format.3 bitrate=4308.9kbits/s speed=8.62x
Exiting... (Errors when loading file)
aajanki commented 5 months ago

Thanks for the detailed bug report! Did piping to mpv used to work for you before? Have you updated yle-dl, mpv or ffmpeg since then?

One thing that you could try is to enable cache on mpv:

yle-dl --pipe tv2 | mpv --cache=yes --cache-secs=60 -

This might not make any difference, because the cache should be enabled automatically