Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Broken] HLS: acodec of video+audio format not detected correctly (rai livestream) #887

Closed
5 tasks done
rgabbo opened this issue Sep 3, 2021 · 25 comments · Fixed by #9291 · May be fixed by #5924
Closed
5 tasks done

[Broken] HLS: acodec of video+audio format not detected correctly (rai livestream) #887

rgabbo opened this issue Sep 3, 2021 · 25 comments · Fixed by #9291 · May be fixed by #5924
Labels
bug Bug that is not site-specific help-wanted Extra attention is needed

Comments

@rgabbo
Copy link

rgabbo commented Sep 3, 2021

Checklist

  • I'm reporting a broken site support
  • I've verified that I'm running yt-dlp version 2021.09.02
  • I've checked that all provided URLs are alive and playable in a browser
  • I've checked that all URLs and arguments with special characters are properly quoted or escaped
  • I've searched the bugtracker for similar issues including closed ones

Verbose log

[debug] Command-line config: ['https://www.raiplay.it/dirette/rai1', '-v']
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] yt-dlp version 2021.09.02 (exe)
[debug] Python version 3.8.10 (CPython 64bit) - Windows-10-10.0.18363-SP0
[debug] exe versions: ffmpeg 2021-04-20-git-718e03e5f2-essentials_build-www.gyan.dev, ffprobe 2021-04-20-git-718e03e5f2-essentials_build-www.gyan.dev
[debug] Optional libraries: mutagen, pycryptodome, sqlite, websockets
[debug] Proxy map: {}
[debug] [RaiPlayLive] Extracting URL: https://www.raiplay.it/dirette/rai1
[RaiPlayLive] rai1: Downloading video JSON
[RaiPlayLive] rai1: Downloading XML metadata for platform mon
[RaiPlayLive] rai1: Downloading m3u8 information
[RaiPlayLive] rai1: Downloading XML metadata for platform flash
[RaiPlayLive] rai1: Downloading XML metadata for platform native
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, vcodec:vp9.2(10), acodec, filesize, fs_approx, tbr, vbr, abr, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: best/bestvideo+bestaudio
[info] 48cc9aec-d6f0-4e53-843e-23565b24cd82: Downloading 1 format(s): hls-2793+hls-aac-Lingua_Originale
[debug] Invoking downloader on "https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/rai1_2400/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/chunklist.m3u8?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC&aka_media_format_type=hls", "https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/engrai1_160/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/chunklist_ao.m3u8?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC&aka_media_format_type=hls"
[download] Destination: Diretta di Rai 1 2021-09-03 13_58 [48cc9aec-d6f0-4e53-843e-23565b24cd82].mp4
[debug] ffmpeg command line: ffmpeg -y -loglevel verbose -headers "User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3706.6 Safari/537.36
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: en-us,en;q=0.5
" -i "https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/rai1_2400/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/chunklist.m3u8?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC&aka_media_format_type=hls" -i "https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/engrai1_160/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/chunklist_ao.m3u8?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC&aka_media_format_type=hls" -c copy -map "0:v:0" -map "1:a:0" -f mpegts "file:Diretta di Rai 1 2021-09-03 13_58 [48cc9aec-d6f0-4e53-843e-23565b24cd82].mp4.part"
ffmpeg version 2021-04-20-git-718e03e5f2-essentials_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      56. 73.100 / 56. 73.100
  libavcodec     58.136.101 / 58.136.101
  libavformat    58. 78.100 / 58. 78.100
  libavdevice    58. 14.100 / 58. 14.100
  libavfilter     7.111.100 /  7.111.100
  libswscale      5. 10.100 /  5. 10.100
  libswresample   3. 10.100 /  3. 10.100
  libpostproc    55. 10.100 / 55. 10.100
[tcp @ 0000018af4de2cc0] Starting connection attempt to 2001:b00:1:c::210:1148 port 443
[tcp @ 0000018af4de2cc0] Successfully connected to 2001:b00:1:c::210:1148 port 443
[hls @ 0000018af4ddec80] Skip ('#EXT-X-VERSION:3')
[hls @ 0000018af4ddec80] Skip ('#EXT-X-DISCONTINUITY-SEQUENCE:0')
[hls @ 0000018af4ddec80] Skip ('#EXT-X-PROGRAM-DATE-TIME:2021-09-03T08:58:37.859+00:00')
[hls @ 0000018af4ddec80] HLS request for url 'https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/rai1_2400/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/j4f6045g/00000113/media_216225.ts?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC&aka_msn=216225&aka_hls_version=3&aka_media_format_type=hls', offset 0, playlist 0
[hls @ 0000018af4ddec80] Opening 'https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/rai1_2400/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/serve.key?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC' for reading
[tcp @ 0000018af6b19280] Starting connection attempt to 2001:b00:1:c::210:1148 port 443
[tcp @ 0000018af6b19280] Successfully connected to 2001:b00:1:c::210:1148 port 443
[AVIOContext @ 0000018af4e9c800] Statistics: 16 bytes read, 0 seeks
[hls @ 0000018af4ddec80] Opening 'crypto+https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/rai1_2400/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/j4f6045g/00000113/media_216225.ts?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC&aka_msn=216225&aka_hls_version=3&aka_media_format_type=hls' for reading
[tcp @ 0000018af4e95200] Starting connection attempt to 2001:b00:1:c::210:1148 port 443
[tcp @ 0000018af4e95200] Successfully connected to 2001:b00:1:c::210:1148 port 443
[mpegts @ 0000018af6b6ad40] parser not found for codec timed_id3, packets or times may be invalid.
[h264 @ 0000018af6d3ba80] Reinit context to 1280x720, pix_fmt: yuv420p
Input #0, hls, from 'https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/rai1_2400/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/chunklist.m3u8?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC&aka_media_format_type=hls':
  Duration: N/A, start: 62488.103933, bitrate: N/A
  Program 0
    Metadata:
      variant_bitrate : 0
  Stream #0:0: Data: timed_id3 (ID3  / 0x20334449)
    Metadata:
      variant_bitrate : 0
  Stream #0:1: Video: h264 (Main), 1 reference frame ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, left), 1280x720 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
    Metadata:
      variant_bitrate : 0
  Stream #0:2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
[tcp @ 0000018af4e84180] Starting connection attempt to 2001:b00:1:c::210:1148 port 443
[tcp @ 0000018af4e84180] Successfully connected to 2001:b00:1:c::210:1148 port 443
[https @ 0000018af75e2d00] HTTP error 403 Forbidden
https://raiuno1-live.akamaized.net/hls/live/598308/raiuno1/raiuno1/engrai1_160/exp=1630756721~acl=%2fhls%2flive%2f598308%2fraiuno1%2f*!%2fhls%2flive%2f598308-b%2fraiuno1%2f*!%2f*.key~data=hdntl~hmac=70c6c7d3d07c7f124eda42e0a8810ace6085092477cf25331bf57e3f53f5139b/chunklist_ao.m3u8?aka_me_session_id=AAAAAAAAAABxXzNhAAAAANK+8C3BR0b353VDxIsAe8CtqF0HHpZmBGKe450GJxy9HuI4P2sn%2fJrtfc6f7oEhJrINUEIUmvBC&aka_media_format_type=hls: Server returned 403 Forbidden (access denied)
[AVIOContext @ 0000018af4e27c40] Statistics: 364528 bytes read, 0 seeks
[AVIOContext @ 0000018af4de5080] Statistics: 242507 bytes read, 0 seeks


ERROR: ffmpeg exited with code 1
  File "yt_dlp\__main__.py", line 19, in <module>
  File "yt_dlp\__init__.py", line 776, in main
  File "yt_dlp\__init__.py", line 766, in _real_main
  File "yt_dlp\YoutubeDL.py", line 2894, in download
  File "yt_dlp\YoutubeDL.py", line 1207, in extract_info
  File "yt_dlp\YoutubeDL.py", line 1214, in wrapper
  File "yt_dlp\YoutubeDL.py", line 1252, in __extract_info
  File "yt_dlp\YoutubeDL.py", line 1298, in process_ie_result
  File "yt_dlp\YoutubeDL.py", line 2320, in process_video_result
  File "yt_dlp\YoutubeDL.py", line 2747, in process_info
  File "yt_dlp\YoutubeDL.py", line 2461, in dl
  File "yt_dlp\downloader\common.py", line 386, in download
  File "yt_dlp\downloader\external.py", line 75, in real_download
  File "yt_dlp\downloader\common.py", line 170, in report_error
  File "yt_dlp\YoutubeDL.py", line 818, in report_error
  File "yt_dlp\YoutubeDL.py", line 774, in trouble

Description

Trying to download a livestream using yt-dlp on raiplay.it but error occurs. VOD links work as intended.

@pukkandan pukkandan added the geo-blocked Content is geo-blocked label Sep 5, 2021
@pukkandan

This comment was marked as resolved.

@pukkandan

This comment was marked as resolved.

@nixxo
Copy link
Contributor

nixxo commented Sep 5, 2021

the problem seems to be that the server block the request if you request 2 formats at the same time: bestvideo+bestaudio fails as reported.

If you only request one: bestvideo or bestaudio it works.

The video stream contains audio as well so bestvideo+bestaudio is not necessary. Just do bestvideo and you get the best video stream available.

@pukkandan
Copy link
Member

[debug] Default format spec: best/bestvideo+bestaudio
[info] 48cc9aec-d6f0-4e53-843e-23565b24cd82: Downloading 1 format(s): hls-2793+hls-aac-Lingua_Originale

yt-dlp seems to think that there is no single format with audio+ video. Can you show me the output of -F?

@rgabbo Please confirm whether you can work around the issue by simply using -f bv

@nixxo
Copy link
Contributor

nixxo commented Sep 5, 2021

yup, for some reason doing -f best doesn't work... you have to do -f bv

@nixxo
Copy link
Contributor

nixxo commented Sep 5, 2021

λ ydpm https://www.raiplay.it/dirette/rai1 -F
[RaiPlayLive] rai1: Downloading video JSON
[RaiPlayLive] rai1: Downloading XML metadata for platform mon
[RaiPlayLive] rai1: Downloading m3u8 information
[RaiPlayLive] rai1: Downloading XML metadata for platform flash
[RaiPlayLive] rai1: Downloading XML metadata for platform native
[info] Available formats for 48cc9aec-d6f0-4e53-843e-23565b24cd82:
ID                       EXT RESOLUTION |   TBR PROTO  | VCODEC       VBR ACODEC  MORE INFO
------------------------ --- ---------- - ----- ------ - ---------- ----- ------- -----------------------
hls-aac-Audiodescrizione mp4 audio only |       m3u8_n |                  unknown [des], Audiodescrizione
hls-aac-Italiano         mp4 audio only |       m3u8_n |                  unknown [ita], Italiano
hls-aac-Lingua_Originale mp4 audio only |       m3u8_n |                  unknown [V.O], Lingua Originale
hls-1365                 mp4 768x432    | 1365k m3u8_n | avc1.77.31 1365k
hls-2137                 mp4 1024x576   | 2137k m3u8_n | avc1.77.31 2137k
hls-2793                 mp4 1280x720   | 2793k m3u8_n | avc1.77.41 2793k

@pukkandan
Copy link
Member

pukkandan commented Sep 5, 2021

Can you attach the m3u8 manifest? so that I can check if there is any indication in it that the video file has an audio stream as well. If there isn't, we'll need to modify the extractor to identify that information.

PS: Actually, it would be helpful if you could also attach the other dumps from --write-pages (relinker xml and the media json)

@nixxo
Copy link
Contributor

nixxo commented Sep 5, 2021

@pukkandan put the 3 files on gist relinker, manifest and json... https://gist.github.com/nixxo

@pukkandan
Copy link
Member

pukkandan commented Oct 13, 2021

@pukkandan pukkandan changed the title [Broken] rai livestream error [Broken] acodec of mixed video+audio stream not detected correctly (rai livestream) Oct 13, 2021
@pukkandan pukkandan added bug Bug that is not site-specific and removed geo-blocked Content is geo-blocked labels Oct 13, 2021
@pukkandan pukkandan changed the title [Broken] acodec of mixed video+audio stream not detected correctly (rai livestream) [Broken] acodec of video+audio format not detected correctly (rai livestream) Oct 13, 2021
@pukkandan pukkandan changed the title [Broken] acodec of video+audio format not detected correctly (rai livestream) [Broken] HLS: acodec of video+audio format not detected correctly (rai livestream) Oct 13, 2021
@nixxo
Copy link
Contributor

nixxo commented Oct 13, 2021

@pukkandan the problem is this line:

f['acodec'] = 'none'

It basically removes the acodec info from the format in certain cases (I dunno why)

written by @shirt-dev in this commit 310c2ed and the lines before are:

# TODO: update acodec for audio only formats with
# the same GROUP-ID

but this check is still to be written and so it erases the acodec info in this case.

removing this line fixes the problem, but of course it will create it in other m3u8 manifest I guess...

@pukkandan
Copy link
Member

No, it was not written in 310c2ed, but in cb25208. The other commit only moved the code around. The issue is, I also have no idea what this piece of code is supposed to do. I can confirm that removing it fixes this manifest, but we don't know if it breaks something else

@pukkandan pukkandan added the help-wanted Extra attention is needed label Nov 3, 2021
@pukkandan
Copy link
Member

Same issue in #1931

@nixxo
Copy link
Contributor

nixxo commented Mar 15, 2022

Same in #27830 and #2918

nixxo added a commit to nixxo/yt-dlp that referenced this issue Jan 1, 2023
…anifest

- fixes yt-dlp#887
A+V stream getting recognized as only V

- fixes yt-dlp#2918 and ytdl-org/youtube-dl#27830
only V stream getting recognized as A+V

- added tests in test_InfoExtractor with the 2 manifest from the issues
@superclarkk
Copy link

superclarkk commented Feb 15, 2024

I wrote this script to work around this issue, until it is fixed. Also related to #9154

#!/bin/bash

# See issue:  https://github.com/yt-dlp/yt-dlp/issues/9154

# Set full path to yt-dlp
yt_dlp_path="/usr/local/bin/3rdparty/yt-dlp/yt-dlp"

_help() {
        echo "${0##*/}" 'https://www.raiplay.it/video/*.html'
        exit
}
test "$#" -ne 1 && _help
test "${1##*.}" = "html" || _help

if which jq >/dev/null;then
        _url="$(curl -sk "${1%.*}.json"|jq -r '.video |.content_url')"
else 
        _url="$(curl -sk "${1%.*}.json"|sed 's/.*content_url": "//;s/", ".*//')"
fi 

if test -n "$_url"; then
  direct_url="$(curl -sk -m 2 -L --max-redirs 1 --user-agent "Mozilla" -w %{url_effective} -o /dev/null "$_url")"
  echo "Download URL: $direct_url"
else 
  echo "URL not available"
  exit 1
fi

"$yt_dlp_path" -F "$direct_url"
echo
echo "Do you want to download the audio file?"
read -n 1 -rp "Press [Y] / [y] to confirm, OR [Enter] to skip (only press one key): " choice
if [[ "$choice" =~ ^[Yy]$ ]]; then
    echo "Downloading audio into the local directory as audio.mp4"
    echo
    echo "*** If errors occur, press [CTRL]+C, wait 30 seconds and restart the script until it's completely downloaded. If it says, 'URL not available', wait and try again"
    echo
    "$yt_dlp_path" -o audio.mp4 -f bestaudio "$direct_url"
fi

echo
echo


echo "Do you want to download the video file?"
read -n 1 -rp "Press [Y] / [y] to confirm, OR [Enter] to skip (only press one key): " choice
if [[ "$choice" =~ ^[Yy]$ ]]; then
    echo "Downloading video into the local directory as video.mp4"
    "$yt_dlp_path" -o video.mp4 "$direct_url"
fi


echo
echo "Play the audio and video files to ensure they are valid"
echo "Then merge them"
echo
echo "Avoids recoding:"
echo "ffmpeg -i video.mp4 -i audio.mp4 -map 0 -map 1 -c copy output.mp4"
echo "Alternatively:"
echo "ffmpeg -i video.mp4 -i audio.mp4 -c:v copy -c:a aac output.mp4"

echo

echo "Do you want to merge the files, using the first method above?"
read -n 1 -rp "Press [Y] / [y] to confirm, OR [Enter] to skip (only press one key): " choice
if [[ "$choice" =~ ^[Yy]$ ]]; then
    echo "Merging files to output.mp4"
    ffmpeg -i video.mp4 -i audio.mp4 -map 0 -map 1 -c copy output.mp4
fi

@bann0
Copy link

bann0 commented Feb 15, 2024

youtube-dl works (merge v+a)
yt-dlp doesn't return the audio track

youtube-dl -F https://www.raiplay.it/video/2024/02/Sanremo-2024---74-Festival-della-Canzone-Italiana---Serata-Finale-del-10022024-c31c3075-13ab-4c3b-9133-91391eab7efb.html
hls-aac-Audiodescrizione mp4 audio only [Audiodescrizione]
hls-aac-Italiano mp4 audio only [Italiano]
hls-1800 mp4 1024x576 1758k
hls-2400 mp4 1280x720 2344k
hls-3600 mp4 1600x900 3516k (best)

youtube-dl -g -f hls-1800+hls-aac-Italiano https://www.raiplay.it/video/2024/02/Sanremo-2024---74-Festival-della-Canzone-Italiana---Serata-Finale-del-10022024-c31c3075-13ab-4c3b-9133-91391eab7efb.html
https://vod9-rai-it.akamaized.net/podcastcdn/raiuno/raiuno_multiaudio_nogeo/22348652_,1800,2400,3600/chunklist_b1758000_vo_slita_t64MTgwMA==.m3u8
https://vod9-rai-it.akamaized.net/podcastcdn/raiuno/raiuno_multiaudio_nogeo/22348652_,1800,2400,3600/chunklist_b192400_ao_slItaliano_t64SXRhbGlhbm9fYXVkaW8=.m3u8

yt-dlp -F https://www.raiplay.it/video/2024/02/Sanremo-2024---74-Festival-della-Canzone-Italiana---Serata-Finale-del-10022024-c31c3075-13ab-4c3b-9133-91391eab7efb.html
hls-aac-Audiodescrizione mp4 audio only │ m3u8 │ audio only unknown [Audiodescrizione] Audiodescrizione
hls-aac-Italiano mp4 audio only │ m3u8 │ audio only unknown [Italiano] Italiano
hls-1800 mp4 1024x576 │ ~ 3.85GiB 1758k m3u8 │ unknown unknown
hls-2400 mp4 1280x720 │ ~ 5.13GiB 2344k m3u8 │ unknown unknown
hls-3600 mp4 1600x900 │ ~ 7.70GiB 3516k m3u8 │ unknown unknown
hls-5000 mp4 1920x1080 │ ~11.41GiB 5210k m3u8 │ unknown unknown

yt-dlp -g -f hls-1800+hls-aac-Italiano https://www.raiplay.it/video/2024/02/Sanremo-2024---74-Festival-della-Canzone-Italiana---Serata-Finale-del-10022024-c31c3075-13ab-4c3b-9133-91391eab7efb.html
https://vod9-rai-it.akamaized.net/podcastcdn/raiuno/raiuno_multiaudio_nogeo/22348652_,1800,2400,3600,5000/chunklist_b1758000_vo_slita_t64MTgwMA==.m3u8

@albino1
Copy link

albino1 commented Feb 17, 2024

Reposting my comment from the previous issue #9154 when using the updated rai.py:

Using Nightly I can confirm the same problem where yt-dlp only results in the video stream. @nixxo is it possible to update rai.py and add fixes for this issue?

Some example logs of previously working videos if you need them:

Example 1
yt-dlp.exe -vU https://www.raiplay.it/video/2024/02/Mameli-Il-ragazzo-che-sogno-lItalia-S1E1-55c96bea-498e-451d-a65f-4032132125a8.html
[debug] Command-line config: ['-vU', 'https://www.raiplay.it/video/2024/02/Mameli-Il-ragazzo-che-sogno-lItalia-S1E1-55c96bea-498e-451d-a65f-4032132125a8.html']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.02.16.232705 from yt-dlp/yt-dlp-nightly-builds [ddd4b5e10] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-109444-geef763c705-20221222 (setts), ffprobe N-109444-geef763c705-20221222, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.2.0, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1833 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.02.16.232705 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.02.16.232705 from yt-dlp/yt-dlp-nightly-builds)
[RaiPlay] Extracting URL: https://www.raiplay.it/video/2024/02/Mameli-Il-ragazzo-che-sogno-lItalia-S1E1-55c96bea-498e-451d-a65f-4032132125a8.html
[RaiPlay] 55c96bea-498e-451d-a65f-4032132125a8: Downloading video JSON
[RaiPlay] 55c96bea-498e-451d-a65f-4032132125a8: Downloading XML metadata
[RaiPlay] 55c96bea-498e-451d-a65f-4032132125a8: Downloading m3u8 information
[RaiPlay] 55c96bea-498e-451d-a65f-4032132125a8: Checking MP4 availability
[RaiPlay] 55c96bea-498e-451d-a65f-4032132125a8: MP4 direct download is not available: HTTP Error 403: Forbidden
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 55c96bea-498e-451d-a65f-4032132125a8: Downloading 1 format(s): hls-5000
[debug] Invoking hlsnative downloader on "https://StreamCdnG8-b70cb04c54ab478189e9d8ee45637b13.msvdn.net/ostr9/podcastcdn/teche_root/YT_ITALIA_TECHE_HD_multiaudio/BapPpPlusscmJBARkkWZHLN2bXTaQeeqqEEqualeeqqEEqual_,1200,1800,2400,3600,5000/chunklist_b5210000_vo_slita_t64NTAwMA==.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 318
[download] Destination: Mameli - Il ragazzo che sognò l'Italia - S1E1 [55c96bea-498e-451d-a65f-4032132125a8].mp4
[debug] File locking is not supported. Proceeding without locking
[download] 100% of    1.90GiB in 00:02:49 at 11.46MiB/s
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json "file:Mameli - Il ragazzo che sognò l'Italia - S1E1 [55c96bea-498e-451d-a65f-4032132125a8].mp4"
[debug] ffmpeg command line: ffprobe -show_streams "file:Mameli - Il ragazzo che sognò l'Italia - S1E1 [55c96bea-498e-451d-a65f-4032132125a8].mp4"
[FixupM3u8] Fixing MPEG-TS in MP4 container of "Mameli - Il ragazzo che sognò l'Italia - S1E1 [55c96bea-498e-451d-a65f-4032132125a8].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Mameli - Il ragazzo che sognò l'Italia - S1E1 [55c96bea-498e-451d-a65f-4032132125a8].mp4" -map 0 -dn -ignore_unknown -c copy -f mp4 -movflags "+faststart" "file:Mameli - Il ragazzo che sognò l'Italia - S1E1 [55c96bea-498e-451d-a65f-4032132125a8].temp.mp4"
Example 2
yt-dlp.exe -vU https://www.raiplay.it/programmi/solecuoreamore
[debug] Command-line config: ['-vU', 'https://www.raiplay.it/programmi/solecuoreamore']
[debug] Encodings: locale cp1252, fs utf-8, pref cp1252, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2024.02.16.232705 from yt-dlp/yt-dlp-nightly-builds [ddd4b5e10] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg N-109444-geef763c705-20221222 (setts), ffprobe N-109444-geef763c705-20221222, phantomjs 2.1.1
[debug] Optional libraries: Cryptodome-3.20.0, brotli-1.1.0, certifi-2024.02.02, mutagen-1.47.0, requests-2.31.0, sqlite3-3.35.5, urllib3-2.2.0, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1833 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Latest version: nightly@2024.02.16.232705 from yt-dlp/yt-dlp-nightly-builds
yt-dlp is up to date (nightly@2024.02.16.232705 from yt-dlp/yt-dlp-nightly-builds)
[RaiPlayPlaylist] Extracting URL: https://www.raiplay.it/programmi/solecuoreamore
[RaiPlayPlaylist] solecuoreamore: Downloading program JSON
[RaiPlayPlaylist] ContentSet-da756fb7-0eb0-4c58-95fe-d0e49440d8a6: Downloading content set JSON
[download] Downloading playlist: Sole Cuore Amore
[RaiPlayPlaylist] Playlist Sole Cuore Amore: Downloading 1 items of 1
[download] Downloading item 1 of 1
[RaiPlay] Extracting URL: https://www.raiplay.it/video/2019/08/Sole-Cuore-Amore-20ea42ca-d856-44de-8eac-05ecddd67192.json
[RaiPlay] 20ea42ca-d856-44de-8eac-05ecddd67192: Downloading video JSON
[RaiPlay] 20ea42ca-d856-44de-8eac-05ecddd67192: Downloading XML metadata
[RaiPlay] 20ea42ca-d856-44de-8eac-05ecddd67192: Downloading m3u8 information
[RaiPlay] 20ea42ca-d856-44de-8eac-05ecddd67192: Checking MP4 availability
[RaiPlay] 20ea42ca-d856-44de-8eac-05ecddd67192: MP4 direct download is not available: HTTP Error 403: Forbidden
[debug] Formats sorted by: hasvid, ie_pref, lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, proto, vext, aext, hasaud, source, id
[debug] Default format spec: bestvideo*+bestaudio/best
[info] 20ea42ca-d856-44de-8eac-05ecddd67192: Downloading 1 format(s): hls-5000
[debug] Invoking hlsnative downloader on "https://StreamCdnR2-b70cb04c54ab478189e9d8ee45637b13.msvdn.net/ostr8/podcastcdn/teche_root/YT_ITALIA_TECHE_HD_multiaudio/14466819_,1200,1800,2400,3600,5000/chunklist_b5210000_vo_slita_t64NTAwMA==.m3u8"
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 661
[download] Destination: Sole Cuore Amore [20ea42ca-d856-44de-8eac-05ecddd67192].mp4
[debug] File locking is not supported. Proceeding without locking
[download] 100% of    3.82GiB in 00:04:56 at 13.21MiB/s
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json "file:Sole Cuore Amore [20ea42ca-d856-44de-8eac-05ecddd67192].mp4"
[debug] ffmpeg command line: ffprobe -show_streams "file:Sole Cuore Amore [20ea42ca-d856-44de-8eac-05ecddd67192].mp4"
[FixupM3u8] Fixing MPEG-TS in MP4 container of "Sole Cuore Amore [20ea42ca-d856-44de-8eac-05ecddd67192].mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:Sole Cuore Amore [20ea42ca-d856-44de-8eac-05ecddd67192].mp4" -map 0 -dn -ignore_unknown -c copy -f mp4 -movflags "+faststart" "file:Sole Cuore Amore [20ea42ca-d856-44de-8eac-05ecddd67192].temp.mp4"
[download] Finished downloading playlist: Sole Cuore Amore

@bann0
Copy link

bann0 commented Feb 17, 2024

I can confirm that with #5924 , yt-dlp correctly identifies this malformed? m3u8 as video only and therefore the merge works.
cd yt-dlp-path
git fetch https://github.com/yt-dlp/yt-dlp pull/5924/head:pr/5924
git checkout pr/5924

yt-dlp -F https://www.raiplay.it/video/2024/02/Sanremo-2024---74-Festival-della-Canzone-Italiana---Serata-Finale-del-10022024-c31c3075-13ab-4c3b-9133-91391eab7efb.html
hls-aac-Audiodescrizione mp4 audio only │ m3u8 │ audio only unknown [Audiodescrizione] Audiodescrizione
hls-aac-Italiano mp4 audio only │ m3u8 │ audio only unknown [Italiano] Italiano
hls-1800 mp4 1024x576 │ ~ 3.85GiB 1758k m3u8 │ unknown 1758k video only
hls-2400 mp4 1280x720 │ ~ 5.13GiB 2344k m3u8 │ unknown 2344k video only
hls-3600 mp4 1600x900 │ ~ 7.70GiB 3516k m3u8 │ unknown 3516k video only
hls-5000 mp4 1920x1080 │ ~11.41GiB 5210k m3u8 │ unknown 5210k video only

yt-dlp -g -f hls-1800+hls-aac-Italiano https://www.raiplay.it/video/2024/02/Sanremo-2024---74-Festival-della-Canzone-Italiana---Serata-Finale-del-10022024-c31c3075-13ab-4c3b-9133-91391eab7efb.html
https://vod9-rai-it.akamaized.net/podcastcdn/raiuno/raiuno_multiaudio_nogeo/22348652_,1800,2400,3600,5000/chunklist_b1758000_vo_slita_t64MTgwMA==.m3u8
https://vod9-rai-it.akamaized.net/podcastcdn/raiuno/raiuno_multiaudio_nogeo/22348652_,1800,2400,3600,5000/chunklist_b192400_ao_slItaliano_t64SXRhbGlhbm9fYXVkaW8=.m3u8

undo:
git checkout master
git branch -D pr/5924
#git pull

@albino1
Copy link

albino1 commented Feb 18, 2024

Reading through this PR, I don't see any reasons not to merge this. At the very least, we can add it only to the RAI extractor if you're concerned about it inadvertently breaking any other the extractors.

@bann0
Copy link

bann0 commented Feb 19, 2024

as @nixxo suggests, it would be better to use a regex, in rai.py, that search like "multiaudio.*_vo_" to identify video only streams.

@albino1
Copy link

albino1 commented Feb 19, 2024

@nixxo, what do you think, can you add that regex to rai.py? As it currently stands the rai.py extractor is effectively broken without it.

@nixxo
Copy link
Contributor

nixxo commented Feb 21, 2024

This weekend I'll give it a look and see what is possible to do.

nixxo added a commit to nixxo/yt-dlp that referenced this issue Feb 25, 2024
@bashonly bashonly linked a pull request Feb 26, 2024 that will close this issue
5 tasks
bashonly pushed a commit that referenced this issue Feb 29, 2024
@nixxo
Copy link
Contributor

nixxo commented Mar 1, 2024

That is because the fix is done in the RAI extractor and not in the common extractor.

@bashonly
Copy link
Member

bashonly commented Mar 1, 2024

@maxcanna that's what #5924 tries to do. The solution to this problem in both #9291 and #5924 is to assume video- or audio-only formats based on URL patterns (rather than any sort of HLS spec). This is fine to do with a single extractor like rai, which is why #9291 was merged, but IMO it is too risky to do so with every m3u8

@bashonly
Copy link
Member

bashonly commented Mar 1, 2024

you can use the #5924 branch

@bashonly
Copy link
Member

bashonly commented Mar 1, 2024

@maxcanna

yt-dlp --update-to bashonly/yt-dlp@malformed

aalsuwaidi pushed a commit to aalsuwaidi/yt-dlp that referenced this issue Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is not site-specific help-wanted Extra attention is needed
Projects
None yet
7 participants