ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.22k stars 9.93k forks source link

Rai without audio #27830

Open avagraha opened 3 years ago

avagraha commented 3 years ago

Checklist

Question

WRITE QUESTION HERE

1 of 3)

C:\Users\andrea>y https://www.raiplay.it/video/2021/01/Che-Dio-ci-aiuti-S6E6 -Deja-vu-383bca47-d8a1-49c0-876c-f20a2d56d4c1.html -F [RaiPlay] 383bca47-d8a1-49c0-876c-f20a2d56d4c1: Downloading video JSON [RaiPlay] 383bca47-d8a1-49c0-876c-f20a2d56d4c1: Downloading XML metadata fo r platform mon [RaiPlay] 383bca47-d8a1-49c0-876c-f20a2d56d4c1: Downloading m3u8 informatio n [RaiPlay] 383bca47-d8a1-49c0-876c-f20a2d56d4c1: Downloading XML metadata fo r platform flash [RaiPlay] 383bca47-d8a1-49c0-876c-f20a2d56d4c1: Downloading XML metadata fo r platform native [info] Available formats for 383bca47-d8a1-49c0-876c-f20a2d56d4c1: format code               extension  resolution note hls-aac-Audiodescrizione  mp4        audio only [Audiodescrizione] hls-aac-Italiano          mp4        audio only [Italiano] hls-1200                  mp4        704x396    1172k hls-1800                  mp4        928x522    1758k hls-2400                  mp4        1024x576   2100k  (best)

2 of 3)

C:\Users\andrea>y https://www.raiplay.it/video/2021/01/Che-Dio-ci-aiuti-S6E -Obbligo-o-verita-027f044e-836d-4a3b-b1da-8eaa81715e3d.html [RaiPlay] 027f044e-836d-4a3b-b1da-8eaa81715e3d: Downloading video JSON [RaiPlay] 027f044e-836d-4a3b-b1da-8eaa81715e3d: Downloading XML metadata f r platform mon [RaiPlay] 027f044e-836d-4a3b-b1da-8eaa81715e3d: Downloading m3u8 informati n [RaiPlay] 027f044e-836d-4a3b-b1da-8eaa81715e3d: Downloading XML metadata f r platform flash [RaiPlay] 027f044e-836d-4a3b-b1da-8eaa81715e3d: Downloading XML metadata f r platform native [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 251 [download] Destination: Che Dio ci aiuti S6E6 - Obbligo o verità-027f044e- 36d-4a3b-b1da-8eaa81715e3d.mp4 [download] 100% of 875.83MiB in 19:06

3 of 3) where is the audio (not downloaded for unknown reasons)??

414n commented 3 years ago

I had this too on some raiplay streams in the past. I worked around it by:

  1. letting it download the video-only stream
  2. downloading the audio-only track by using -f hls-aac-Italiano with the same URL
  3. remuxing the two together in mkv format (mp4 had delay issues) using ffmpeg:
# Convert audio track to wav first. I observed that this removes audio delays after
ffmpeg -i AUDIO_ONLY_FILE.mp4 AUDIO_ONLY_FILE.wav
# Mux the video and audio files together:
ffmpeg -i VIDEO_ONLY_FILE.mp4 -i AUDIO_ONLY_FILE.wav -c:v copy FINAL_VIDEO.mkv
avagraha commented 3 years ago

Thank you for your reply and suggestions, much appreciated!

----- Original Message ----- From: 414n To: ytdl-org/youtube-dl Cc: avagraha ; Author Sent: Sunday, January 17, 2021 8:54 PM Subject: Re: [ytdl-org/youtube-dl] Rai without audio (#27830)

I had this too on some raiplay streams in the past. I worked around it by:

1.. letting it download the video-only stream
2.. downloading the audio-only track by using -f hls-aac-Italiano with 

the same URL 3.. remuxing the two together in mkv format (mp4 had delay issues) using ffmpeg — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ghost commented 3 years ago

I have no problems with the following commands:

youtube-dl "https://www.raiplay.it/video/2021/01/Che-Dio-ci-aiuti-S6E6-Deja-vu-383bca47-d8a1-49c0-876c-f20a2d56d4c1.html" -o video.mp4
youtube-dl "https://www.raiplay.it/video/2021/01/Che-Dio-ci-aiuti-S6E6-Deja-vu-383bca47-d8a1-49c0-876c-f20a2d56d4c1.html" -f hls-aac-Italiano -o audio.mp4
ffmpeg -i video.mp4 -i audio.mp4 -c copy che-dio-ci-aiuti-s06e06.mp4
avagraha commented 3 years ago

Yes, ok. But I dont understand why the app is unable to download both streams (with merging process too) with the usual command, like in past. Ex. gr. Pasty is able to donwload the complete mp4 (video+audio).

----- Original Message ----- From: Francesco Turco To: ytdl-org/youtube-dl Cc: avagraha ; Author Sent: Sunday, January 24, 2021 1:29 PM Subject: Re: [ytdl-org/youtube-dl] Rai without audio (#27830)

I have no problems with the following commands:

youtube-dl "https://www.raiplay.it/video/2021/01/Che-Dio-ci-aiuti-S6E6-Deja-vu-383bca47-d8a1-49c0-876c-f20a2d56d4c1.html" -o video.mp4 youtube-dl "https://www.raiplay.it/video/2021/01/Che-Dio-ci-aiuti-S6E6-Deja-vu-383bca47-d8a1-49c0-876c-f20a2d56d4c1.html" -f hls-aac-Italiano -o audio.mp4 ffmpeg -i video.mp4 -i audio.mp4 -c copy che-dio-ci-aiuti-s06e06.mp4 — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

pjammo commented 3 years ago

In this case hls-1200, hls-1800 and hls-2400 have no audio, they should be marked as video only formats. Temporary workaround: -f best+bestaudio.

christian-0s commented 3 years ago

In this case hls-1200, hls-1800 and hls-2400 have no audio, they should be marked as video only formats. Temporary workaround: -f best+bestaudio.

Unfortunately this doesn't work for me, audio is ok only for first 7 minutes, then it's muted.

audetto commented 2 years ago

You don't need to use ffmpeg, just do

-f "hls-2400+hls-aac-Italiano"

audetto commented 2 years ago

It is possible to fix it, but requires a small code change:

https://github.com/ytdl-org/youtube-dl/blob/70d0d4f9beba0e5b6d95ee50ad62ae7ab5be9be1/youtube_dl/extractor/common.py#L1810

if you remove and codecs then the format is marked as video only and audio is downloaded automatically.

If you read the comment just above that line, I think the code is trying to be defensive about audio+video formats that look like video only, so reducing the cases of video only.

If RAI added CODECS='' as per spec, it would work out of the box.

format code               extension  resolution note
hls-aac-Audiodescrizione  mp4        audio only [Audiodescrizione] 
hls-aac-Italiano          mp4        audio only [Italiano] 
hls-1200                  mp4        736x414    1288k , video only
hls-1800                  mp4        1024x576   1758k , video only
hls-2400                  mp4        1280x720   2344k , video only (best)
fabzzap commented 2 years ago

Found more examples of this. Could the suggested fix by @audetto be implemented?

thePanz commented 2 years ago

The solution from @audetto works for me.

Sidenote: the download speed of the RaiPlay videos/streams are way faster when ffmpeg is used, instead of the native method.

Try with: -f 'hls-2400+hls-aac-Italiano' --hls-prefer-ffmpeg (download went from 10mins to 2mins for a ~50min episode)