yt-dlp / yt-dlp

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

cropped thumbnail does not embed into OPUS #6666

Closed superislam closed 1 year ago

superislam commented 1 year ago

DO NOT REMOVE OR SKIP THE ISSUE TEMPLATE

Checklist

Provide a description that is worded well enough to be understood

Hello when i run the code to download opus audio with metadata the thumbnail cropped does not embed into the file

Provide verbose output that clearly demonstrates the problem

Complete Verbose Output

[debug] Command-line config: ['-vU', '-f', 'ba', '-x', '--audio-quality', '0', '--add-metadata', '--embed-thumbnail', '--convert-thumbnails', 'jpg', '--exec-before-download', 'ffmpeg -i %(thumbnails.-1.filepath)q -vf crop="\'if(gt(ih,iw),iw,ih)\':\'if(gt(iw,ih),ih,iw)\'" _%(thumbnails.-1.filepath)q', '--exec-before-download', 'rm %(thumbnails.-1.filepath)q', '--exec-before-download', 'mv _%(thumbnails.-1.filepath)q %(thumbnails.-1.filepath)q', '--output', '%(artist)s - %(title)s.%(ext)s', 'https://music.youtube.com/watch?v=eamiiuUmVz8']
[debug] Encodings: locale cp1256, fs utf-8, pref cp1256, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp/yt-dlp-nightly-builds version stable@2023.03.11.810 [c82ba3192] (win_exe)
[debug] ** IMPORTANT NOTICE
[debug] ** This unofficial daily builds is sunsetting on Mar 11 2023 (2023-03-11).
[debug] ** Please migrate to yt-dlp's nightly build for future updates: https://github.com/yt-dlp/yt-dlp-nightly-builds
[debug] ** Doing -U on this unofficial daily builds will migrate to yt-dlp's nightly build for some users (and all users after Mar 11)
[debug] **
[debug] ** This build is unofficial daily builds, provided for ease of use.
[debug] ** Please do not ask for any support.
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19044-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev (setts), ffprobe 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1788 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Available version: stable@2023.03.27.161807, Current version: stable@2023.03.11.810
Current Build Hash: 5644db490ba758d0bb544886c129cdd9b2906359a4a1110dcee4646b6538cbc7
[debug] Downloading _update_spec from https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/latest/download/_update_spec
Updating to stable@2023.03.27.161807 ...
[debug] Downloading yt-dlp.exe from https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/latest/download/yt-dlp.exe
[debug] Downloading SHA2-256SUMS from https://github.com/yt-dlp/yt-dlp-nightly-builds/releases/latest/download/SHA2-256SUMS
Updated yt-dlp to stable@2023.03.27.161807
[debug] Restarting: yt-dlp -vU -f ba -x --audio-quality 0 --add-metadata --embed-thumbnail --convert-thumbnails jpg --exec-before-download "ffmpeg -i %(thumbnails.-1.filepath)q -vf crop=\"'if(gt(ih,iw),iw,ih)':'if(gt(iw,ih),ih,iw)'\" _%(thumbnails.-1.filepath)q" --exec-before-download "rm %(thumbnails.-1.filepath)q" --exec-before-download "mv _%(thumbnails.-1.filepath)q %(thumbnails.-1.filepath)q" --output "%(artist)s - %(title)s.%(ext)s" "https://music.youtube.com/watch?v=eamiiuUmVz8"
[debug] Command-line config: ['-vU', '-f', 'ba', '-x', '--audio-quality', '0', '--add-metadata', '--embed-thumbnail', '--convert-thumbnails', 'jpg', '--exec-before-download', 'ffmpeg -i %(thumbnails.-1.filepath)q -vf crop="\'if(gt(ih,iw),iw,ih)\':\'if(gt(iw,ih),ih,iw)\'" _%(thumbnails.-1.filepath)q', '--exec-before-download', 'rm %(thumbnails.-1.filepath)q', '--exec-before-download', 'mv _%(thumbnails.-1.filepath)q %(thumbnails.-1.filepath)q', '--output', '%(artist)s - %(title)s.%(ext)s', 'https://music.youtube.com/watch?v=eamiiuUmVz8']
[debug] Encodings: locale cp1256, fs utf-8, pref cp1256, out utf-8, error utf-8, screen utf-8
[debug] yt-dlp version nightly@2023.03.27.161807 [0f0875ed5] (win_exe)
[debug] Python 3.8.10 (CPython AMD64 64bit) - Windows-10-10.0.19044-SP0 (OpenSSL 1.1.1k  25 Mar 2021)
[debug] exe versions: ffmpeg 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev (setts), ffprobe 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev
[debug] Optional libraries: Cryptodome-3.17, brotli-1.0.9, certifi-2022.12.07, mutagen-1.46.0, sqlite3-2.6.0, websockets-10.4
[debug] Proxy map: {}
[debug] Loaded 1793 extractors
[debug] Fetching release info: https://api.github.com/repos/yt-dlp/yt-dlp-nightly-builds/releases/latest
Available version: nightly@2023.03.27.161807, Current version: nightly@2023.03.27.161807
Current Build Hash: 3c219a2f1a54d00539a98d08058279cfd7a37361f22405a52d3955656aaaac48
yt-dlp is up to date (nightly@2023.03.27.161807)
[youtube] Extracting URL: https://music.youtube.com/watch?v=eamiiuUmVz8
[youtube] eamiiuUmVz8: Downloading webpage
[youtube] eamiiuUmVz8: Downloading android player API JSON
[youtube] eamiiuUmVz8: Downloading android music player API JSON
[youtube] eamiiuUmVz8: Downloading web music client config
[youtube] eamiiuUmVz8: Downloading player ace4d669
[youtube] eamiiuUmVz8: Downloading web music player API JSON
[debug] Sort order given by extractor: quality, res, fps, hdr:12, source, vcodec:vp9.2, channels, acodec, lang, proto
[debug] Formats sorted by: hasvid, ie_pref, quality, res, fps, hdr:12(7), source, vcodec:vp9.2(10), channels, acodec, lang, proto, filesize, fs_approx, tbr, vbr, abr, asr, vext, aext, hasaud, id
[info] eamiiuUmVz8: Downloading 1 format(s): 251
[info] Downloading video thumbnail 47 ...
[info] Writing video thumbnail 47 to: James Horner - A Kaleidoscope Of Mathematics.webp
[ThumbnailsConvertor] Converting thumbnail "James Horner - A Kaleidoscope Of Mathematics.webp" to jpg
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -f image2 -pattern_type none -i "file:James Horner - A Kaleidoscope Of Mathematics.webp" -update 1 "-bsf:v" mjpeg2jpeg -movflags "+faststart" "file:James Horner - A Kaleidoscope Of Mathematics.jpg"
Deleting original file James Horner - A Kaleidoscope Of Mathematics.webp (pass -k to keep)
[Exec] Executing command: ffmpeg -i "James Horner - A Kaleidoscope Of Mathematics.jpg" -vf crop="'if(gt(ih,iw),iw,ih)':'if(gt(iw,ih),ih,iw)'" _"James Horner - A Kaleidoscope Of Mathematics.jpg"
ffmpeg version 2022-11-03-git-5ccd4d3060-full_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 12.1.0 (Rev2, 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-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
  libavutil      57. 40.100 / 57. 40.100
  libavcodec     59. 51.101 / 59. 51.101
  libavformat    59. 34.101 / 59. 34.101
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.101 /  8. 49.101
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
  libpostproc    56.  7.100 / 56.  7.100
Input #0, image2, from 'James Horner - A Kaleidoscope Of Mathematics.jpg':
  Duration: 00:00:00.04, start: 0.000000, bitrate: 10204 kb/s
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 25 fps, 25 tbr, 25 tbn
Stream mapping:
  Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (native))
Press [q] to stop, [?] for help
Output #0, image2, to '_James Horner - A Kaleidoscope Of Mathematics.jpg':
  Metadata:
    encoder         : Lavf59.34.101
  Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown, progressive), 720x720, q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc59.51.101 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
[image2 @ 000002873b6bdc00] The specified filename '_James Horner - A Kaleidoscope Of Mathematics.jpg' does not contain an image sequence pattern or a pattern is invalid.
[image2 @ 000002873b6bdc00] Use a pattern such as %03d for an image sequence or use the -update option (with -frames:v 1 if needed) to write a single image.
frame=    1 fps=0.0 q=6.7 Lsize=N/A time=00:00:00.00 bitrate=N/A speed=   0x
video:44kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Exec] Executing command: rm "James Horner - A Kaleidoscope Of Mathematics.jpg"
'rm' is not recognized as an internal or external command,
operable program or batch file.
ERROR: Preprocessing: Command returned error code 1
Traceback (most recent call last):
  File "yt_dlp\YoutubeDL.py", line 3492, in pre_process
  File "yt_dlp\YoutubeDL.py", line 3485, in run_all_pps
  File "yt_dlp\YoutubeDL.py", line 3463, in run_pp
  File "yt_dlp\postprocessor\common.py", line 24, in run
  File "yt_dlp\postprocessor\exec.py", line 33, in run
yt_dlp.utils.PostProcessingError: Command returned error code 1

[debug] Invoking dashsegments downloader on "https://rr1---sn-uxaxjvhxbt2u-xhtz.googlevideo.com/videoplayback?expire=1680052449&ei=gTwjZIaxL8XN0wXs2pTIBA&ip=156.209.130.16&id=o-AA-5bz9yqSqOZEBwKs-ahXBv1rISRGwezX9UUI-pD3qE&itag=251&source=youtube&requiressl=yes&mh=MK&mm=31%2C29&mn=sn-uxaxjvhxbt2u-xhtz%2Csn-4g5ednds&ms=au%2Crdu&mv=m&mvi=1&pl=19&gcr=eg&initcwndbps=258750&spc=99c5CTErZ8jld-6dVN0VxSpcnW-21o8&vprv=1&svpuc=1&mime=audio%2Fwebm&gir=yes&clen=5238147&dur=294.701&lmt=1565888752453343&mt=1680030545&fvip=1&keepalive=yes&fexp=24007246&c=ANDROID&txp=1311222&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cspc%2Cvprv%2Csvpuc%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&sig=AOq0QJ8wRgIhAKLL1Sq5rquMZ2Y5cjrbmjtHW8Yp9KHXX6O7VDgjkcb7AiEAw9N61xxPr0JGj5MkpbR9oAj8NcHZEj3x9bkH8Aji9wk%3D&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIhAIgHM7we9eK_RvN3R983O9GgkXd-iYF6c8c2NCwuWp_AAiAFV9Tco-c4PHGpduN1AVfcptka039nIY9HsGJWtviJdA%3D%3D"
[dashsegments] Total fragments: 1
[download] Destination: James Horner - A Kaleidoscope Of Mathematics.webm
[debug] File locking is not supported. Proceeding without locking
[download] 100% of    5.00MiB in 00:00:03 at 1.30MiB/s
ERROR: Preprocessing: Command returned error code 1
[debug] ffmpeg command line: ffprobe -show_streams "file:James Horner - A Kaleidoscope Of Mathematics.webm"
[ExtractAudio] Destination: James Horner - A Kaleidoscope Of Mathematics.opus
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:James Horner - A Kaleidoscope Of Mathematics.webm" -vn -acodec copy -movflags "+faststart" "file:James Horner - A Kaleidoscope Of Mathematics.opus"
Deleting original file James Horner - A Kaleidoscope Of Mathematics.webm (pass -k to keep)
[Metadata] Adding metadata to "James Horner - A Kaleidoscope Of Mathematics.opus"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:James Horner - A Kaleidoscope Of Mathematics.opus" -map 0 -dn -ignore_unknown -c copy -write_id3v1 1 -metadata "title=A Kaleidoscope Of Mathematics" -metadata "date=20180920" -metadata "description=Provided to YouTube by Universal Music Group

A Kaleidoscope Of Mathematics · James Horner

A Beautiful Mind

℗ 2001 Universal Classics Group, a Division of UMG Recordings Inc.

Released on: 2001-12-11

Producer, Studio  Personnel, Recording  Engineer, Mixer: Simon Rhodes
Producer, Associated  Performer, Orchestra  Contractor: James Horner
Editor: Chris Landen
Associated  Performer, Orchestra  Contractor: Randy Kerber
Studio  Personnel, Asst.  Recording  Engineer: David Marquette
Composer: James Horner

Auto-generated by YouTube." -metadata "synopsis=Provided to YouTube by Universal Music Group

A Kaleidoscope Of Mathematics · James Horner

A Beautiful Mind

℗ 2001 Universal Classics Group, a Division of UMG Recordings Inc.

Released on: 2001-12-11

Producer, Studio  Personnel, Recording  Engineer, Mixer: Simon Rhodes
Producer, Associated  Performer, Orchestra  Contractor: James Horner
Editor: Chris Landen
Associated  Performer, Orchestra  Contractor: Randy Kerber
Studio  Personnel, Asst.  Recording  Engineer: David Marquette
Composer: James Horner

Auto-generated by YouTube." -metadata "purl=https://www.youtube.com/watch?v=eamiiuUmVz8" -metadata "comment=https://www.youtube.com/watch?v=eamiiuUmVz8" -metadata "artist=James Horner" -metadata "album=A Beautiful Mind" -movflags "+faststart" "file:James Horner - A Kaleidoscope Of Mathematics.temp.opus"
[EmbedThumbnail] mutagen: Adding thumbnail to "James Horner - A Kaleidoscope Of Mathematics.opus"
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:James Horner - A Kaleidoscope Of Mathematics.jpg"
'feature' is not recognized as an internal or external command,
operable program or batch file.
bashonly commented 1 year ago

'rm' is not recognized as an internal or external command, operable program or batch file.

Your --exec arguments are failing because they are using unix shell commands (rm, mv); these aren't going to work on windows. Try changing mv to move and rm to del

[EmbedThumbnail] mutagen: Adding thumbnail to "James Horner - A Kaleidoscope Of Mathematics.opus"

It does embed a thumbnail, just not the cropped thumb because the --exec commands failed

'feature' is not recognized as an internal or external command, operable program or batch file.

Put the URL in quotes

superislam commented 1 year ago

'rm' is not recognized as an internal or external command, operable program or batch file.

Your --exec arguments are failing because they are using unix shell commands (rm, mv); these aren't going to work on windows. Try changing mv to move and rm to del

[EmbedThumbnail] mutagen: Adding thumbnail to "James Horner - A Kaleidoscope Of Mathematics.opus"

It does embed a thumbnail, just not the cropped thumb because the --exec commands failed

'feature' is not recognized as an internal or external command, operable program or batch file.

Put the URL in quotes

ok it worked