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
132.38k stars 10.04k forks source link

Pornhub not downloading the best quality #29460

Closed guy123guy123 closed 1 month ago

guy123guy123 commented 3 years ago

Checklist

Verbose log

[PornHub] ph603bd8b89dad4: Downloading pc webpage
[PornHub] ph603bd8b89dad4: Downloading JSON metadata
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[info] Available formats for ph603bd8b89dad4:
format code  extension  resolution note
hls-287-0    mp4        426x240     287k , avc1.640015, 25.0fps, mp4a.40.2
hls-287-1    mp4        426x240     287k , avc1.640015, 25.0fps, mp4a.40.2
hls-614-0    mp4        854x480     614k , avc1.64001e, 25.0fps, mp4a.40.2
hls-614-1    mp4        854x480     614k , avc1.64001e, 25.0fps, mp4a.40.2
240p         mp4        240p       1000k
hls-1116-0   mp4        1280x720   1116k , avc1.64001f, 25.0fps, mp4a.40.2
hls-1116-1   mp4        1280x720   1116k , avc1.64001f, 25.0fps, mp4a.40.2
hls-1673-0   mp4        1920x1080  1673k , avc1.640028, 25.0fps, mp4a.40.2
hls-1673-1   mp4        1920x1080  1673k , avc1.640028, 25.0fps, mp4a.40.2
480p         mp4        480p       2000k
720p         mp4        720p       4000k  (best)

[[snip]]

[debug] System config: []
[debug] User config: ['--add-metadata', '--fixup', 'warn', '--convert-subs', 'srt', '--all-subs', '--embed-subs', '--write-info-json', '--merge-output-format', 'mkv', '--external-downloader', 'aria2c', '--external-downloader-args', '-j 50 -x 16 -c --summary-interval=0']
[debug] Custom config: []
[debug] Command-line args: ['-vvv', 'https://www.pornhub.com/view_video.php?viewkey=ph603bd8b89dad4']
[debug] Encodings: locale cp1253, fs mbcs, out cp65001, pref cp1253
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17763
[debug] exe versions: ffmpeg 2021-06-30-git-de8e6e67e7-full_build-www.gyan.dev, ffprobe 2021-06-30-git-de8e6e67e7-f
ull_build-www.gyan.dev, phantomjs 0, rtmpdump 2.4-20190330-gc5f04a5-GnuTLS_3.6.7-x86_64-static
[debug] Proxy map: {}
[PornHub] ph603bd8b89dad4: Downloading pc webpage
[PornHub] ph603bd8b89dad4: Downloading JSON metadata
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[debug] Default format spec: bestvideo+bestaudio/best
[info] Writing video description metadata as JSON to: Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.info.json
[debug] Invoking downloader on 'https://ev.phncdn.com/videos/[[removed personal info]]'
[download] Destination: Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.mp4
[debug] aria2c command line: aria2c -c -j 50 -x 16 -c --summary-interval=0 --out 'Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.mp4.part' --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.104 Safari/537.36' --header 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7' --header 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' --header 'Accept-Encoding: gzip, deflate' --header 'Accept-Language: en-us,en;q=0.5' --check-certificate=true --remote-time=true -- 'https://ev.phncdn.com/videos/[[removed personal info]]'

07/03 20:06:25 [NOTICE] Downloading 1 item(s)
[#1281b2 164MiB/164MiB(99%) CN:2 DL:1.3MiB]
07/03 20:07:47 [NOTICE] Download complete: /home/user/downloads/Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.mp4.part

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
1281b2|OK  |   2.0MiB/s|/home/user/downloads/Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.mp4.part

Status Legend:
(OK):download completed.
[aria2c] Downloaded 172815435 bytes
[download] 100% of 164.81MiB in 01:21
[ffmpeg] Adding metadata to 'Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.mp4'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.mp4' -c copy -metadata 'title=Oops! I Squirted On Your Face - Dripping Wet Pussy' -metadata date=20210228 -metadata 'purl=https://www.pornhub.com/view_video.php?viewkey=ph603bd8b89dad4' -metadata 'artist=Sweet Bunny' 'file:Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.temp.mp4'
[ffmpeg] There aren't any subtitles to convert
[ffmpeg] There aren't any subtitles to embed

[[snip]]

[debug] System config: []
[debug] User config: ['--add-metadata', '--fixup', 'warn', '--convert-subs', 'srt', '--all-subs', '--embed-subs', '--write-info-json', '--merge-output-format', 'mkv', '--external-downloader', 'aria2c', '--external-downloader-args', '-j 50 -x 16 -c --summary-interval=0']
[debug] Custom config: []
[debug] Command-line args: ['-f', 'bestvideo+bestaudio', '-vvv', 'https://www.pornhub.com/view_video.php?viewkey=ph603bd8b89dad4']
[debug] Encodings: locale cp1253, fs mbcs, out cp65001, pref cp1253
[debug] youtube-dl version 2021.06.06
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17763
[debug] exe versions: ffmpeg 2021-06-30-git-de8e6e67e7-full_build-www.gyan.dev, ffprobe 2021-06-30-git-de8e6e67e7-f
ull_build-www.gyan.dev, phantomjs 0, rtmpdump 2.4-20190330-gc5f04a5-GnuTLS_3.6.7-x86_64-static
[debug] Proxy map: {}
[PornHub] ph603bd8b89dad4: Downloading pc webpage
[PornHub] ph603bd8b89dad4: Downloading JSON metadata
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
[PornHub] ph603bd8b89dad4: Downloading m3u8 information
ERROR: requested format not available
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 847, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 881, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/lib/python3.9/site-packages/youtube_dl/YoutubeDL.py", line 1683, in process_video_result
    raise ExtractorError('requested format not available',
youtube_dl.utils.ExtractorError: requested format not available

Description

Video resolutions over 720p are freely available for a long time but even though youtube-dl detects them with -F it downloads 720p instead

dirkf commented 3 years ago

The 720p format is selected because its bitrate is 4000kbit/s while the highest bitrate for 1080p is 1673kbit/s.

If you want the latter, use -f '(bestvideo+bestaudio/best)[height>?720]/bestvideo+bestaudio/best'.

guy123guy123 commented 3 years ago

Thanks, that worked (changed width to height, likely a typo). I think in this case resolution should be prioritized by default over bitrate, it may also prove problematic on over 1080p resolutions on paid premium accounts.

The resulting video isn't even 4000kbps, it's much lower at ~1000-1100

(bestvideo+bestaudio/best)[height>?720]/bestvideo+bestaudio/best:

General
Complete name                            : Oops! I Squirted On Your Face - Dripping Wet Pussy-ph603bd8b89dad4.mp4
Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/avc1/mp41)
File size                                : 247 MiB
Duration                                 : 20 min 31 s
Overall bit rate mode                    : Variable
Overall bit rate                         : 1 681 kb/s
Movie name                               : Oops! I Squirted On Your Face - Dripping Wet Pussy
Performer                                : Sweet Bunny
Recorded date                            : 20210228
Writing application                      : Lavf58.76.100

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 20 min 31 s
Source duration                          : 20 min 31 s
Bit rate                                 : 1 452 kb/s
Maximum bit rate                         : 1 521 kb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.028
Stream size                              : 213 MiB (86%)
Source stream size                       : 223 MiB (90%)
Writing library                          : x264 core 155
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=90 / keyint_min=46 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=4000 / vbv_bufsize=160 / crf_max=27.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
mdhd_Duration                            : 1231120
Codec configuration box                  : avcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 20 min 31 s
Bit rate mode                            : Variable
Bit rate                                 : 154 kb/s
Maximum bit rate                         : 173 kb/s / 173 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 22.5 MiB (9%)
Default                                  : Yes
Alternate group                          : 1

default:

General
Complete name                            : Oops! I Squirted On Your Face - Dripping Wet Pussy 20210228 best.mkv
Format                                   : Matroska
Format version                           : Version 4
File size                                : 164 MiB
Duration                                 : 20 min 31 s
Overall bit rate                         : 1 120 kb/s
Movie name                               : Oops! I Squirted On Your Face - Dripping Wet Pussy
Writing application                      : Lavf58.76.100
Writing library                          : Lavf58.76.100
ErrorDetectionType                       : Per level 1
ARTIST                                   : Sweet Bunny
DATE                                     : 20210228
PURL                                     : https://www.pornhub.com/view_video.php?viewkey=ph603bd8b89dad4

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L3.1
Format settings                          : CABAC / 4 Ref Frames
Format settings, CABAC                   : Yes
Format settings, Reference frames        : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 20 min 31 s
Width                                    : 1 280 pixels
Height                                   : 720 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Writing library                          : x264 core 155
Encoding settings                        : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / lookahead_threads=2 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / weightb=1 / open_gop=0 / weightp=2 / keyint=90 / keyint_min=46 / scenecut=0 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=23.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / vbv_maxrate=4000 / vbv_bufsize=160 / crf_max=27.0 / nal_hrd=none / filler=0 / ip_ratio=1.40 / aq=1:1.00
Default                                  : Yes
Forced                                   : No
VENDOR_ID                                : [0][0][0][0]

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : A_AAC-2
Duration                                 : 20 min 31 s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 44.1 kHz
Frame rate                               : 43.066 FPS (1024 SPF)
Compression mode                         : Lossy
Default                                  : Yes
Forced                                   : No
VENDOR_ID                                : [0][0][0][0]
dirkf commented 3 years ago

The bitrate data 4000K comes from the media URL https:// ev.phncdn.com/videos/202102/28/384409592/720P_4000K_384409592.mp4, but clearly it lies. One video is named according to the actual bit-rate, one according to the putative bit-rate limit (vbv-maxrate), which is the same for both.

Although this inconsistency in the site may be distressing, someone who cares enough could download all the best resolutions and pick the best by eyeball.

afterdelight commented 2 years ago

use -f 1080p