yt-dlp / yt-dlp

A feature-rich command-line audio/video downloader
https://discord.gg/H5MNcFW63r
The Unlicense
85.93k stars 6.69k forks source link

how to download maximum quality of video if video have no sound (facebook) #9038

Closed wankio closed 9 months ago

wankio commented 9 months ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Please make sure the question is worded well enough to be understood

with "-f bv+ba/b" it will download highest video quality included sound

but if video had no sound, and 540 resolution (it downloaded as maximum 600x600, i think it's a gif) with -f bv it will downloaded : 600x600 maximum quality, but with -f bv+ba/b, it can only download up to 360p

so how i can make it automatic download best quality of videos (if video have no sound) with -f bv, and if video have sound, it will use -f bv+ba/b

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

No response

bashonly commented 9 months ago

Can you share a verbose log please? See the instructions in the checklist that you checked off

wankio commented 9 months ago

nsfw

-f bv+ba/b

downloaded result 360p

yt-dlp https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378 -P .\ -vU
[debug] Command-line config: ['https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378', '-P', '.\\', '-vU']
[debug] User config "C:\Users\GEN32UC\AppData\Roaming\yt-dlp\config.txt": ['-o', '%(extractor)s/%(uploader)s+%(uploader_id)s %(title)s-%(id)s.%(ext)s', '-P', 'I:\\youtube-dl', '-f', 'bv+ba/b', '-S', 'proto:https', '--write-thumbnail', '--cookies', 'C:/Users/GEN32UC/AppData/Roaming/youtube-dl/cookies.txt', '--write-sub', '--write-auto-sub', '--sub-lang', 'en-GB', '--embed-metadata', '--embed-chapters', '--embed-thumbnail', '--retries', 'infinite', '--http-chunk-size', '250M']
[debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.12.30 from yt-dlp/yt-dlp [f10589e34] (pip)
[debug] Python 3.10.7 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1q  5 Jul 2022)
[debug] exe versions: ffmpeg N-112480-g644b2235c5-20231019 (setts), ffprobe N-112480-g644b2235c5-20231019
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, requests-2.31.0, sqlite3-3.37.2, urllib3-2.1.0, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1798 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2023.12.30 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2023.12.30 from yt-dlp/yt-dlp)
[facebook] Extracting URL: https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378
[facebook] 612812707639145: Downloading webpage
[debug] Sort order given by user: proto:https
[debug] Formats sorted by: hasvid, ie_pref, proto:https(10), lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, vext, aext, hasaud, source, id
[info] 612812707639145: Downloading 1 format(s): sd
[info] There are no subtitles for the requested languages
[info] Downloading video thumbnail 0 ...
[info] Writing video thumbnail 0 to: facebook\Sherman Allison+100040840620890 Facebook-612812707639145.jpg
[debug] Invoking http downloader on "https://scontent.fhan5-8.fna.fbcdn.net/v/t42.1790-2/419681353_763905995759093_6549052885145186009_n.mp4?_nc_cat=108&ccb=1-7&_nc_sid=55d0d3&efg=eyJybHIiOjU3OSwicmxhIjo1MTIsInZlbmNvZGVfdGFnIjoic3ZlX3NkIn0%3D&_nc_ohc=smNwe8Q48d0AX8aKVWN&rl=579&vabr=322&_nc_ht=scontent.fhan5-8.fna&oh=00_AfDpJbDGTUT3nFchU85FA7gYM9ok2b2RrjqO4QFKi-YAVg&oe=65B1BA29"
[debug] File locking is not supported. Proceeding without locking
[download] Destination: facebook\Sherman Allison+100040840620890 Facebook-612812707639145.mp4
[download] 100% of  117.92KiB in 00:00:00 at 566.95KiB/s
[Metadata] Adding metadata to "facebook\Sherman Allison+100040840620890 Facebook-612812707639145.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:facebook\Sherman Allison+100040840620890 Facebook-612812707639145.mp4" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=Facebook" -metadata "date=20240118" -metadata "purl=https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378" -metadata "comment=https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378" -metadata "artist=Sherman Allison" -movflags "+faststart" "file:facebook\Sherman Allison+100040840620890 Facebook-612812707639145.temp.mp4"
[EmbedThumbnail] mutagen: Adding thumbnail to "facebook\Sherman Allison+100040840620890 Facebook-612812707639145.mp4"

-f bv downloaded result 600x600

yt-dlp https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378 -P .\ -vU
[debug] Command-line config: ['https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378', '-P', '.\\', '-vU']
[debug] User config "C:\Users\GEN32UC\AppData\Roaming\yt-dlp\config.txt": ['-o', '%(extractor)s/%(uploader)s+%(uploader_id)s %(title)s-%(id)s.%(ext)s', '-P', 'I:\\youtube-dl', '-f', 'bv', '-S', 'proto:https', '--write-thumbnail', '--cookies', 'C:/Users/GEN32UC/AppData/Roaming/youtube-dl/cookies.txt', '--write-sub', '--write-auto-sub', '--sub-lang', 'en-GB', '--embed-metadata', '--embed-chapters', '--embed-thumbnail', '--retries', 'infinite', '--http-chunk-size', '250M']
[debug] Encodings: locale cp65001, fs utf-8, pref cp65001, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version stable@2023.12.30 from yt-dlp/yt-dlp [f10589e34] (pip)
[debug] Python 3.10.7 (CPython AMD64 64bit) - Windows-10-10.0.19045-SP0 (OpenSSL 1.1.1q  5 Jul 2022)
[debug] exe versions: ffmpeg N-112480-g644b2235c5-20231019 (setts), ffprobe N-112480-g644b2235c5-20231019
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, requests-2.31.0, sqlite3-3.37.2, urllib3-2.1.0, websockets-12.0
[debug] Proxy map: {}
[debug] Request Handlers: urllib, requests, websockets
[debug] Loaded 1798 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp/releases/latest
Latest version: stable@2023.12.30 from yt-dlp/yt-dlp
yt-dlp is up to date (stable@2023.12.30 from yt-dlp/yt-dlp)
[facebook] Extracting URL: https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378
[facebook] 612812707639145: Downloading webpage
[debug] Sort order given by user: proto:https
[debug] Formats sorted by: hasvid, ie_pref, proto:https(10), lang, quality, res, fps, hdr:12(7), vcodec:vp9.2(10), channels, acodec, size, br, asr, vext, aext, hasaud, source, id
[info] 612812707639145: Downloading 1 format(s): 24611553648489285v
[info] There are no subtitles for the requested languages
Deleting existing file facebook\Sherman Allison+100040840620890 Facebook-612812707639145.jpg
[info] Downloading video thumbnail 0 ...
[info] Writing video thumbnail 0 to: facebook\Sherman Allison+100040840620890 Facebook-612812707639145.jpg
[debug] Invoking http downloader on "https://scontent.fhan5-8.fna.fbcdn.net/v/t39.25447-2/420593722_393236789745096_4780592792440517468_n.mp4?_nc_cat=110&ccb=1-7&_nc_sid=9a5d50&efg=eyJ2ZW5jb2RlX3RhZyI6ImRhc2hfdnA5XzVzZWNnb3BfbWlucmVzX2hhbG9fNzUwa19mcmFnXzJfdmlkZW8ifQ==&_nc_ohc=0BLkmXFtz_0AX-Fk3GL&_nc_ht=scontent.fhan5-8.fna&oh=00_AfDWkBp1SC0PUoHo00KTX3wfigu1QKxEDev-0yFwKTvC0Q&oe=65B13166"
[debug] File locking is not supported. Proceeding without locking
[download] Destination: facebook\Sherman Allison+100040840620890 Facebook-612812707639145.mp4
[download] 100% of  300.76KiB in 00:00:00 at 744.45KiB/s
[Metadata] Adding metadata to "facebook\Sherman Allison+100040840620890 Facebook-612812707639145.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:facebook\Sherman Allison+100040840620890 Facebook-612812707639145.mp4" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=Facebook" -metadata "date=20240118" -metadata "purl=https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378" -metadata "comment=https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378" -metadata "artist=Sherman Allison" -movflags "+faststart" "file:facebook\Sherman Allison+100040840620890 Facebook-612812707639145.temp.mp4"
[EmbedThumbnail] mutagen: Adding thumbnail to "facebook\Sherman Allison+100040840620890 Facebook-612812707639145.mp4"

i think because it's maybe a gif, so it messed up with yt-dlp config ?

wankio commented 9 months ago
yt-dlp https://www.facebook.com/100018911267235/videos/906056044646490/?idorvanity=1181764132325378 -P .\ -F
[facebook] Extracting URL: https://www.facebook.com/100018911267235/videos/906056044646490/?idorvanity=1181764132325378
[facebook] 906056044646490: Downloading webpage
[info] Available formats for 906056044646490:
ID                EXT RESOLUTION │   FILESIZE   TBR PROTO │ VCODEC        VBR ACODEC     ABR ASR MORE INFO
─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
696112125671522a  m4a audio only │ ~245.32KiB   66k https │ audio only        mp4a.40.5  66k 48k DASH audio, m4a_dash
sd                mp4 unknown    │                  https │ unknown           unknown
hd                mp4 unknown    │                  https │ unknown           unknown
2296160993907271v mp4 640x360    │ ~  1.09MiB  299k https │ avc1.4d001e  299k video only         DASH video, mp4_dash
916256956731729v  mp4 960x540    │ ~  2.49MiB  684k https │ avc1.64001f  684k video only         DASH video, mp4_dash
289697950748388v  mp4 1280x720   │ ~  4.93MiB 1352k https │ avc1.64001f 1352k video only         DASH video, mp4_dash
305701262446120v  mp4 1920x1080  │ ~  7.68MiB 2104k https │ avc1.640028 2104k video only         DASH video, mp4_dash

yt-dlp https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378 -P .\  -F
[facebook] Extracting URL: https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378
[facebook] 612812707639145: Downloading webpage
[info] Available formats for 612812707639145:
ID                 EXT RESOLUTION │   FILESIZE  TBR PROTO │ VCODEC         VBR ACODEC     MORE INFO
──────────────────────────────────────────────────────────────────────────────────────────────────────────────
sd                 mp4 unknown    │                 https │ unknown            unknown
1123521511977457v  mp4 426x426    │ ~ 60.82KiB 162k https │ vp09.00.21.08 162k video only DASH video, mp4_dash
3237295629897819v  mp4 426x426    │ ~105.75KiB 282k https │ vp09.00.21.08 282k video only DASH video, mp4_dash
1430716234521813v  mp4 600x600    │ ~189.80KiB 506k https │ vp09.00.30.08 506k video only DASH video, mp4_dash
24611553648489285v mp4 600x600    │ ~307.14KiB 819k https │ vp09.00.30.08 819k video only DASH video, mp4_dash
bashonly commented 9 months ago

-f bv+ba/b will try to select the best video-only format AND best audio-only format (to merge them), and if that combination is not available, then fall back to best pre-merged video+audio. Since this post does not have an audio track, using bv+ba/b will fallback to b, resulting in the sd format being selected (yt-dlp thinks it has audio, even if it actually doesn't, since there is no metadata available about the format).

I can't think of an -f arg that you could apply generally / add to your config that would handle this. Passing -f bv manually is what you'll need to do for video-only facebook posts. Maybe this could be fixed somehow in the extractor, though

wankio commented 9 months ago

yeah i think so, because resolution is not standard 360-480-720-1080p, so it will fall back to sd 360p instead

yt-dlp https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378 -P .\  -F
[facebook] Extracting URL: https://www.facebook.com/sherman.allison.1/videos/612812707639145/?idorvanity=1181764132325378
[facebook] 612812707639145: Downloading webpage
[info] Available formats for 612812707639145:
ID                 EXT RESOLUTION │   FILESIZE  TBR PROTO │ VCODEC         VBR ACODEC     MORE INFO
──────────────────────────────────────────────────────────────────────────────────────────────────────────────
sd                 mp4 unknown    │                 https │ unknown            unknown
1123521511977457v  mp4 426x426    │ ~ 60.82KiB 162k https │ vp09.00.21.08 162k video only DASH video, mp4_dash
3237295629897819v  mp4 426x426    │ ~105.75KiB 282k https │ vp09.00.21.08 282k video only DASH video, mp4_dash
1430716234521813v  mp4 600x600    │ ~189.80KiB 506k https │ vp09.00.30.08 506k video only DASH video, mp4_dash
24611553648489285v mp4 600x600    │ ~307.14KiB 819k https │ vp09.00.30.08 819k video only DASH video, mp4_dash

i try to download 1080p video which dont have sound, it downloaded 1080p video without any problems

bashonly commented 9 months ago

If you want to use a facebook-specific config file, you could add -f "bv+ba/b[format_id!~='^(h|s)d$']/bv" to it. I say facebook-specific config because it would interfere with other sites that use hd and sd as format IDs

wankio commented 9 months ago

np, with other site i just run python code "yt" which automatic use specified config file for all

i tested your "-f" i think it worked