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.36k stars 9.95k forks source link

Embedding thumbnail to mp3 causes a error of file not found. #31454

Open p3nguinmeme opened 1 year ago

p3nguinmeme commented 1 year ago

Checklist

Verbose log

Enter youtube link here
: https://youtu.be/EmuBOfurv3o
[debug] Encodings: locale cp1252, fs utf-8, out utf-8, pref cp1252
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.9.7 (CPython) - Windows-10-10.0.19045-SP0
[debug] exe versions: ffmpeg N-55702-g920046a, ffprobe N-55702-g920046a
[debug] Proxy map: {}
[youtube] EmuBOfurv3o: Downloading webpage
[youtube] EmuBOfurv3o: Downloading thumbnail ...
[youtube] EmuBOfurv3o: Writing thumbnail to: C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp
[debug] Invoking downloader on 'https://rr3---sn-8pgbpohxqp5-auoz.googlevideo.com/videoplayback?expire=1673060111&ei=r4q4Y7XKFpL6WZHhiogJ&ip=82.20.109.132&id=o-ABJG1zZD9xhRDoI0mygZaA-sn8GKrAXQCfedDAIETFW1&itag=251&source=youtube&requiressl=yes&mh=Hl&mm=31%2C29&mn=sn-8pgbpohxqp5-auoz%2Csn-aigzrnld&ms=au%2Crdu&mv=m&mvi=3&pl=24&gcr=gb&initcwndbps=1452500&vprv=1&mime=audio%2Fwebm&ns=d2TFtsH5f29GfvewFyI1bsYK&gir=yes&clen=3652610&dur=218.881&lmt=1591477016463657&mt=1673038191&fvip=2&keepalive=yes&fexp=24007246&c=WEB&txp=5531432&n=TzRconJyS9f2typNK&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRgIhAJVxiFfSM06d1_ZYmKMk6jhglWpU9-0YH_kltRReOQYcAiEA0VDOLjdBtxCK37s53cgcwHcP8-6U7UOmKJLWNIezNuc%3D&sig=AOq0QJ8wRAIgRJWXXrTtel1uWPH1zK0jIr5-zvgmAlgVaQVIj2VH7loCIEOVpuTSB_t2UQabcAHc3HT7uUPTs557ZZxfrgwh-MPk'
[download] Destination: C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webm

[download]   0.0% of 3.48MiB at  5.98KiB/s ETA 09:56
[download]   0.1% of 3.48MiB at 16.76KiB/s ETA 03:32
[download]   0.2% of 3.48MiB at 38.90KiB/s ETA 01:31
[download]   0.4% of 3.48MiB at 82.44KiB/s ETA 00:43
[download]   0.9% of 3.48MiB at 65.26KiB/s ETA 00:54
[download]   1.8% of 3.48MiB at 57.15KiB/s ETA 01:01
[download]   3.2% of 3.48MiB at 48.38KiB/s ETA 01:11
[download]   4.3% of 3.48MiB at 52.48KiB/s ETA 01:05
[download]   6.3% of 3.48MiB at 53.38KiB/s ETA 01:02
[download]   7.8% of 3.48MiB at 51.38KiB/s ETA 01:03
[download]   9.1% of 3.48MiB at 50.83KiB/s ETA 01:03
[download]  10.4% of 3.48MiB at 50.84KiB/s ETA 01:02
[download]  11.8% of 3.48MiB at 51.41KiB/s ETA 01:01
[download]  13.4% of 3.48MiB at 52.27KiB/s ETA 00:59
[download]  15.1% of 3.48MiB at 51.78KiB/s ETA 00:58
[download]  16.4% of 3.48MiB at 51.70KiB/s ETA 00:57
[download]  17.9% of 3.48MiB at 52.03KiB/s ETA 00:56
[download]  19.4% of 3.48MiB at 51.44KiB/s ETA 00:55
[download]  20.7% of 3.48MiB at 51.24KiB/s ETA 00:55
[download]  22.1% of 3.48MiB at 51.28KiB/s ETA 00:54
[download]  23.5% of 3.48MiB at 51.60KiB/s ETA 00:52
[download]  25.1% of 3.48MiB at 52.10KiB/s ETA 00:51
[download]  26.8% of 3.48MiB at 51.89KiB/s ETA 00:50
[download]  28.2% of 3.48MiB at 51.92KiB/s ETA 00:49
[download]  29.7% of 3.48MiB at 51.34KiB/s ETA 00:48
[download]  30.9% of 3.48MiB at 51.87KiB/s ETA 00:47
[download]  32.8% of 3.48MiB at 51.42KiB/s ETA 00:46
[download]  34.1% of 3.48MiB at 51.95KiB/s ETA 00:45
[download]  36.1% of 3.48MiB at 51.58KiB/s ETA 00:44
[download]  37.4% of 3.48MiB at 51.49KiB/s ETA 00:43
[download]  38.7% of 3.48MiB at 51.52KiB/s ETA 00:42
[download]  40.2% of 3.48MiB at 51.71KiB/s ETA 00:41
[download]  41.8% of 3.48MiB at 51.49KiB/s ETA 00:40
[download]  43.1% of 3.48MiB at 51.42KiB/s ETA 00:39
[download]  44.5% of 3.48MiB at 51.46KiB/s ETA 00:38
[download]  46.0% of 3.48MiB at 51.65KiB/s ETA 00:37
[download]  47.6% of 3.48MiB at 51.47KiB/s ETA 00:36
[download]  48.9% of 3.48MiB at 51.36KiB/s ETA 00:35
[download]  50.3% of 3.48MiB at 51.36KiB/s ETA 00:34
[download]  51.7% of 3.48MiB at 51.49KiB/s ETA 00:33
[download]  53.3% of 3.48MiB at 51.71KiB/s ETA 00:32
[download]  55.0% of 3.48MiB at 51.60KiB/s ETA 00:31
[download]  56.3% of 3.48MiB at 51.60KiB/s ETA 00:30
[download]  57.8% of 3.48MiB at 51.72KiB/s ETA 00:29
[download]  59.4% of 3.48MiB at 51.54KiB/s ETA 00:28
[download]  60.6% of 3.48MiB at 51.49KiB/s ETA 00:27
[download]  62.0% of 3.48MiB at 51.50KiB/s ETA 00:26
[download]  63.5% of 3.48MiB at 51.59KiB/s ETA 00:25
[download]  65.0% of 3.48MiB at 51.79KiB/s ETA 00:24
[download]  66.8% of 3.48MiB at 51.72KiB/s ETA 00:22
[download]  68.1% of 3.48MiB at 51.74KiB/s ETA 00:21
[download]  69.6% of 3.48MiB at 51.51KiB/s ETA 00:21
[download]  70.8% of 3.48MiB at 51.74KiB/s ETA 00:20
[download]  72.8% of 3.48MiB at 51.51KiB/s ETA 00:18
[download]  74.0% of 3.48MiB at 51.47KiB/s ETA 00:18
[download]  75.4% of 3.48MiB at 51.49KiB/s ETA 00:17
[download]  76.9% of 3.48MiB at 51.57KiB/s ETA 00:15
[download]  78.5% of 3.48MiB at 51.74KiB/s ETA 00:14
[download]  80.2% of 3.48MiB at 51.70KiB/s ETA 00:13
[download]  81.6% of 3.48MiB at 51.72KiB/s ETA 00:12
[download]  83.1% of 3.48MiB at 51.52KiB/s ETA 00:11
[download]  84.3% of 3.48MiB at 51.70KiB/s ETA 00:10
[download]  86.2% of 3.48MiB at 51.49KiB/s ETA 00:09
[download]  87.4% of 3.48MiB at 51.70KiB/s ETA 00:08
[download]  89.4% of 3.48MiB at 51.57KiB/s ETA 00:07
[download]  90.7% of 3.48MiB at 51.54KiB/s ETA 00:06
[download]  92.1% of 3.48MiB at 51.57KiB/s ETA 00:05
[download]  93.6% of 3.48MiB at 51.66KiB/s ETA 00:04
[download]  95.2% of 3.48MiB at 51.56KiB/s ETA 00:03
[download]  96.5% of 3.48MiB at 51.53KiB/s ETA 00:02
[download]  97.9% of 3.48MiB at 51.55KiB/s ETA 00:01
[download]  99.4% of 3.48MiB at 51.61KiB/s ETA 00:00
[download] 100.0% of 3.48MiB at 51.71KiB/s ETA 00:00
[download] 100% of 3.48MiB in 01:09                 
[debug] ffmpeg command line: ffprobe -show_streams "file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webm"
[ffmpeg] Destination: C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).mp3
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webm" -vn -acodec libmp3lame "-b:a" 192k "file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).mp3"
Deleting original file C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webm (pass -k to keep)
[ffmpeg] Converting thumbnail "C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp" to JPEG
[debug] ffmpeg command line: ffmpeg -y -loglevel "repeat+info" -i "file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp" "-bsf:v" mjpeg2jpeg "file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).jpg"
[debug] ffmpeg version N-55702-g920046a Copyright (c) 2000-2013 the FFmpeg developers

  built on Aug 21 2013 18:10:00 with gcc 4.7.3 (GCC)

  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib

  libavutil      52. 42.100 / 52. 42.100

  libavcodec     55. 29.100 / 55. 29.100

  libavformat    55. 14.101 / 55. 14.101

  libavdevice    55.  3.100 / 55.  3.100

  libavfilter     3. 82.100 /  3. 82.100

  libswscale      2.  5.100 /  2.  5.100

  libswresample   0. 17.103 /  0. 17.103

  libpostproc    52.  3.100 / 52.  3.100

[image2 @ 00000000006ecc80] Could find no file with path 'file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp' and index in the range 0-4

ERROR: file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp: No such file or directory
Traceback (most recent call last):
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 2115, in post_process
    files_to_delete, info = pp.run(info)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\postprocessor\embedthumbnail.py", line 70, in run
    self.run_ffmpeg(escaped_thumbnail_filename, escaped_thumbnail_jpg_filename, ['-bsf:v', 'mjpeg2jpeg'])
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 242, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, opts)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 238, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp: No such file or directory

Traceback (most recent call last):
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 2115, in post_process
    files_to_delete, info = pp.run(info)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\postprocessor\embedthumbnail.py", line 70, in run
    self.run_ffmpeg(escaped_thumbnail_filename, escaped_thumbnail_jpg_filename, ['-bsf:v', 'mjpeg2jpeg'])
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 242, in run_ffmpeg
    self.run_ffmpeg_multiple_files([path], out_path, opts)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\postprocessor\ffmpeg.py", line 238, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError: file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Tayga\Desktop\videos\download videos.py", line 26, in <module>
    ydl.download([video])
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 2068, in download
    res = self.extract_info(
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 808, in extract_info
    return self.__extract_info(url, ie, download, extra_info, process)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 815, in wrapper
    return func(self, *args, **kwargs)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 847, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 881, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 1692, in process_video_result
    self.process_info(new_info)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 2050, in process_info
    self.post_process(filename, info_dict)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 2117, in post_process
    self.report_error(e.msg)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 628, in report_error
    self.trouble(error_message, tb)
  File "C:\Users\Tayga\AppData\Local\Programs\Python\Python39\lib\site-packages\youtube_dl\YoutubeDL.py", line 598, in trouble
    raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp: No such file or directory

Description

A exception is raised when embedding the video thumbnail to the mp3 file, The program is unable to find the file despite the fact the file exists in the correct directory, The problem hasn't occurred when working on another computer with Windows 11 but occurs here on Windows 10 both computers have the same dependencies and running the same version of python

I am not sure what has caused this bug and I am unable to propose a solution due to this

dirkf commented 1 year ago

Please show the actual yt-dl command that you ran.

However this error seems familiar. I thought it might be a yt-dl version of yt-dlp#4604, but no, though it appears related.

This ffmpeg command is being run and giving this error:

ffmpeg -y -loglevel "repeat+info" -i "file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp" "-bsf:v" mjpeg2jpeg "file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).jpg"
[image2 @ 00000000006ecc80] Could find no file with path 'file:C:\Users\Tayga\Desktop\videos\Tusk (2018 Remaster).webp' and index in the range 0-4

I think that this is what is happening...

  1. The code from PR #25717 is trying to convert some possible image sequence format to a JPG.
  2. It invokes the mjpeg2jpeg bitstream filter with the -bsf:v option to fix the JPG encoding.
  3. As the input file is a single frame WEBP image, the image2 demuxer is implicitly used to get the image data from the input file.
  4. Some change in ffmpeg (>4.3) causes image2 to look for an image sequence by default when its output is connected to the mjpeg2jpeg codec.
  5. yt-dl should be adding -pattern_type none to the image2 parameters.

I don't have a new enough version of ffmpeg to trigger the issue but the fix appears to work with my older version (ie, behaviour doesn't change when adding the new parameters):

$ ffmpeg -f image2 -pattern_type none -i 'Nærøyfjorden.webp' '-bsf:v' mjpeg2jpeg 'Nærøyfjorden.jpg'
ffmpeg version 4.3-2ubuntu0~ppa16.04+8 Copyright (c) 2000-2020 the FFmpeg developers
...
Input #0, image2, from 'Nærøyfjorden.webp':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: webp, yuv420p(tv, bt470bg/unknown/unknown), 550x368, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (webp (native) -> mjpeg (native))
...
Output #0, image2, to 'Nærøyfjorden.jpg':
  Metadata:
    encoder         : Lavf58.45.100
    Stream #0:0: Video: mjpeg, yuvj420p(pc), 550x368, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.91.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=    1 fps=0.0 q=4.9 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=2.38x    
video:33kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
$

The test WEBP image is the first one on the G developer site for WEBP.

In order to pass the -pattern_type I had to make image2 an explicit demuxer, which might break some other thumbnail formats that yt-dl, with older ffmpeg, currently handles OK. Maybe we can just add -update 1 to the output options instead.

The difference between your Windows systems is likely to be different ffmpeg versions. The logged version is a development build and may be newer than the version on the machine where the problem doesn't occur. Please also show the output of ffmpeg -version on that system.

p3nguinmeme commented 1 year ago

Here is the output to ffmpeg -version

ffmpeg version N-55702-g920046a
built on Aug 21 2013 18:10:00 with gcc 4.7.3 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil      52. 42.100 / 52. 42.100
libavcodec     55. 29.100 / 55. 29.100
libavformat    55. 14.101 / 55. 14.101
libavdevice    55.  3.100 / 55.  3.100
libavfilter     3. 82.100 /  3. 82.100
libswscale      2.  5.100 /  2.  5.100
libswresample   0. 17.103 /  0. 17.103
libpostproc    52.  3.100 / 52.  3.100

Below is the code involved in running the program:

from __future__ import unicode_literals 
import youtube_dl
import os

video = input("Enter youtube link here\n: ")

ydl_opts = {
    'verbose': True,
    'writethumbnail': True,
    'outtmpl': f'{os.getcwd()}/%(title)s.%(ext)s',
    'format': 'bestaudio/best',
    'postprocessors': [
        {'key': 'FFmpegExtractAudio',
         'preferredcodec': 'mp3',
         'preferredquality': '192'},
        {'key': 'EmbedThumbnail',},]}

with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download([video])
dirkf commented 1 year ago

N-55702-g920046a is the ffmpeg version in your problem log. Just to confirm, that is the same on the Win 11 machine where you don't get the problem?

This is what happens with the git master on my machine (the thumbnail code is the same), and ffmpeg 4.3:

$ python3
Python 3.5.2 (default, Dec  1 2022, 11:14:24) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import youtube_dl

>>> ydl_opts = { 
...     'verbose': True, 
...     'writethumbnail': True,
...     'outtmpl': '%(title)s.%(ext)s',
...     'format': 'bestaudio/best',
...     'postprocessors': [{
...         'key': 'FFmpegExtractAudio', 
...         'preferredcodec': 'mp3', 
...         'preferredquality': '192'
...     }, {'key': 'EmbedThumbnail',},
...     ]
... }
>>> with youtube_dl.YoutubeDL(ydl_opts) as ydl: 
...     ydl.download(['gdZLi9oWNZg'])
... 
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: 774b346f9
[debug] Python version 3.5.2 (CPython) - Linux-4.4.0-210-generic-i686-with-Ubuntu-16.04-xenial
[debug] exe versions: avconv 4.3, avprobe 4.3, ffmpeg 4.3, ffprobe 4.3
[debug] Proxy map: {}
[youtube] gdZLi9oWNZg: Downloading webpage
[debug] [youtube] Decrypted nsig MYwlgErBSIqWbuUyF => M0_RTOAWx5uSTA
[debug] [youtube] Decrypted nsig pJ07oijQzEmRciNJE => QBA0Jrw2s8qTPg
[youtube] gdZLi9oWNZg: Downloading thumbnail ...
[youtube] gdZLi9oWNZg: Writing thumbnail to: BTS (방탄소년단) 'Dynamite' Official MV.webp
[debug] Invoking downloader on 'https://rr2---sn-cu-aigss.googlevideo.com/videoplayback?fexp=24007246&mm=31%2C29&id=o-ACMt9fcvEwO7JdYiQoGgnFQxHSr0IgI1fx_B-BwHC_WN&mh=LC&mvi=2&dur=223.381&ei=e1y5Y7qqOZmxxN8PtL2NuA0&ns=yOw4JojIt8EIiwpHQGEGGwYK&mt=1673091933&sig=AOq0QJ8wRAIgG2vZFOJQHX7BfHH1Y-TVN3pICs-o9DKTyxcPzZWqB-YCIBeQHTJJUGI3WcZPQ1JP5Q-k62aOQd5lOCpLYF70PXCy&keepalive=yes&itag=251&lsig=AG3C_xAwRgIhANhgS1OgVn_tAR0WDmQYDP1139ikpK0RS-pvxwLP3O5XAiEA6bxHAD_3vrhZR9VGAGfPOxnM4-n2QmhADZJGladbfBE%3D&n=M0_RTOAWx5uSTA&clen=3730537&mv=m&vprv=1&c=WEB&mn=sn-cu-aigss%2Csn-cu-c9id&requiressl=yes&expire=1673113820&ip=46.208.6.34&gir=yes&ms=au%2Crdu&fvip=5&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&source=youtube&pl=25&mime=audio%2Fwebm&initcwndbps=1582500&txp=4532434&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lmt=1653149808559966'
[download] Destination: BTS (방탄소년단) 'Dynamite' Official MV.webm
[download] 100% of 3.56MiB in 00:04
[debug] ffmpeg command line: ffprobe -show_streams 'file:BTS (방탄소년단) '"'"'Dynamite'"'"' Official MV.webm'
[ffmpeg] Destination: BTS (방탄소년단) 'Dynamite' Official MV.mp3
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:BTS (방탄소년단) '"'"'Dynamite'"'"' Official MV.webm' -vn -acodec libmp3lame -b:a 192k 'file:BTS (방탄소년단) '"'"'Dynamite'"'"' Official MV.mp3'
Deleting original file BTS (방탄소년단) 'Dynamite' Official MV.webm (pass -k to keep)
[ffmpeg] Converting thumbnail "BTS (방탄소년단) 'Dynamite' Official MV.webp" to JPEG
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:BTS (방탄소년단) '"'"'Dynamite'"'"' Official MV.webp' -bsf:v mjpeg2jpeg 'file:BTS (방탄소년단) '"'"'Dynamite'"'"' Official MV.jpg'
[ffmpeg] Adding thumbnail to "BTS (방탄소년단) 'Dynamite' Official MV.mp3"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:BTS (방탄소년단) '"'"'Dynamite'"'"' Official MV.mp3' -i 'file:BTS (방탄소년단) '"'"'Dynamite'"'"' Official MV.jpg' -c copy -map 0 -map 1 -metadata:s:v 'title="Album cover"' -metadata:s:v 'comment="Cover (Front)"' 'file:BTS (방탄소년단) '"'"'Dynamite'"'"' Official MV.temp.mp3'
0
>>> 
p3nguinmeme commented 1 year ago

The windows 11 machine has ffmpeg 5.1.2 on it.

how would I get the program to use a specific version of ffmpeg as the N-55702-g920046a version is being prioritised over any other version I install.

dirkf commented 1 year ago

If you have a known version of ffmpeg that you would like to use rather than whatever is in your %PATH%, use the --ffmpg-location ... option (or its API equivalent ffmpeg_location).

I expect that Chocolatey has some way of forcing a particular version but I don't use it myself.

p3nguinmeme commented 1 year ago

I've now removed the version of ffmpeg an have installed 4.3, the log is similar to the one you have shown earlier while the FileNotFound error has stopped the resulting mp3 file does not have the thumbnail embedded when I go to preview it I've tried this with 5.1.2 as well with the same results

dirkf commented 1 year ago

The test for which I posted the log above creates a file BTS (방탄소년단) 'Dynamite' Official MV.mp3 containing a JPEG cover art item, as in this MediaInfo output:

General
Complete name                            : BTS (방탄소년단) 'Dynamite' Official MV.mp3
Format                                   : MPEG Audio
File size                                : 5.15 MiB
Duration                                 : 3mn 43s
Overall bit rate mode                    : Constant
Overall bit rate                         : 192 Kbps
Writing library                          : LAME3.100
Cover                                    : Yes
Cover description                        : "Album cover"
Cover MIME                               : image/jpeg

Audio
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Mode                                     : Joint stereo
Mode extension                           : MS Stereo
Duration                                 : 3mn 43s
Bit rate mode                            : Constant
Bit rate                                 : 192 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 5.11 MiB (99%)
Writing library                          : LAME3.100

A picture of some random K-Pop Backstreet Boys revivalists is shown when playing the MP3 in mpv.

dirkf commented 1 year ago

If you can still run the problem version of ffmpeg, it would be very helpful to run this test.

  1. Download the test WEBP image as aaa.webp (or some other name that doesn't match any existing WEBP or JPEG image in the directory). It should show a Nordic landscape.
  2. Try these commands:
ffmpeg -f image2 -pattern_type -i aaa.webp -bsf:v mjpeg2jpeg aaa_1.jpg
ffmpeg -i aaa.webp -bsf:v mjpeg2jpeg -update 1 aaa_2.jpg
p3nguinmeme commented 1 year ago

for the first line I receive this:

Desktop>ffmpeg -f image2 -pattern_type -i aaa.webp -bsf:v mjpeg2jpeg aaa_1.jpg
ffmpeg version N-55702-g920046a Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug 21 2013 18:10:00 with gcc 4.7.3 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 42.100 / 52. 42.100
  libavcodec     55. 29.100 / 55. 29.100
  libavformat    55. 14.101 / 55. 14.101
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.100 /  3. 82.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
File 'aaa.webp' already exists. Overwrite ? [y/N] y
Output #0, image2, to 'aaa.webp':
Output file #0 does not contain any stream

the second command did create a file called aaa_2.jpg which contains the nordic landscape the output was this

Desktop>ffmpeg -i aaa.webp -bsf:v mjpeg2jpeg -update 1 aaa_2.jpg
ffmpeg version N-55702-g920046a Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug 21 2013 18:10:00 with gcc 4.7.3 (GCC)
  configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 42.100 / 52. 42.100
  libavcodec     55. 29.100 / 55. 29.100
  libavformat    55. 14.101 / 55. 14.101
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.100 /  3. 82.100
  libswscale      2.  5.100 /  2.  5.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
Input #0, image2, from 'aaa.webp':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: webp, yuv420p, 550x368, 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0000000002656260] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'aaa_2.jpg':
  Metadata:
    encoder         : Lavf55.14.101
    Stream #0:0: Video: mjpeg, yuvj420p, 550x368, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (webp -> mjpeg)
Press [q] to stop, [?] for help
[mjpeg @ 0000000002667f80] input is not MJPEG/AVI1
Failed to open bitstream filter mjpeg2jpeg for stream 0 with codec mjpeg: Invalid data found when processing input
frame=    1 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.04 bitrate=N/A
video:34kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.062528%
dirkf commented 1 year ago

Excellent, thanks. I'll investigate adding -update 1 for all ffmpeg versions. The yt-dlp issue shows that it ought to be supported way back, to 2.8.

In principle we probably ought not to run the mjpeg2jpeg filter unless the image type is suitable, but that hasn't been a problem so far.

nicolaasjan commented 1 year ago

@dirkf Can you explain why the mp3 downloaded with youtube-dl doesn't show the thumbnail in explorer, while the one downloaded with yt-dlp does. Both show "Cover" in MediaInfo.

screenshot4

This is on Windows10 with the most recent FFmpeg.

On Linux the thumbnail is shown in both cases.

Yt-dlp and youtube-dl built from latest master.

dirkf commented 1 year ago

Thanks for this research.

On Linux the thumbnail is shown in both cases.

What, after copying to the Windows test machine? That's the acid test.

The postprocessor code has evolved somewhat in yt-dlp. It's possible that there's some subtle difference in the ffmpeg command lines used for the embedding, and/or for the MP3 extraction, such that the yt-dlp result matches Win10 Explorer's understanding of MP3 cover art better. Use --verbose to show the ffmpeg command lines.

Windows versions may differ. In the olden days there was a separate shell extension that could be inspected separately but who knows what's going on in the too-bad-for-open-source Windows code.

nicolaasjan commented 1 year ago

On Linux the thumbnail is shown in both cases.

What, after copying to the Windows test machine? That's the acid test.

I downloaded it on the Windows VM, but the same one downloaded from my Linux Mint Mate system also didn't show the thumbnail, when copied to the Windows VM.

ytd -v -f bestaudio -x --audio-format mp3 --add-metadata --embed-thumbnail --audio-quality 0 EmuBOfurv3o
[debug] System config: []
[debug] User config: ['-i', '-o', '/dev/shm/test-ytd/%(title)s.%(ext)s', '-f', 'bestvideo[height<=1080][ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best', '--no-mtime', '--add-metadata', '--embed-thumbnail', '--force-ipv4', '--external-downloader', 'aria2c', '--external-downloader-args', '-x 10 -s 10 -j 10 -k 1M --log-level=info --file-allocation=none']
[debug] Custom config: []
[debug] Command-line args: ['-v', '-f', 'bestaudio', '-x', '--audio-format', 'mp3', '--add-metadata', '--embed-thumbnail', '--audio-quality', '0', 'EmuBOfurv3o']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2022.11.13
[debug] Python version 3.8.10 (CPython) - Linux-5.4.0-136-generic-x86_64-with-glibc2.29
[debug] exe versions: ffmpeg N-109468-gd39b34123d-Nico-20221230, ffprobe N-109468-gd39b34123d-Nico-20221230, phantomjs 2.1.1, rtmpdump 2.4
[debug] Proxy map: {}
[youtube] EmuBOfurv3o: Downloading webpage
[debug] [youtube] Decrypted nsig GsVlz4RsTGGjmpwP => m9gOz-l0Y7dUFA
[debug] [youtube] Decrypted nsig HorEBoGt335RsoH8 => nkbEboHdHEVCYQ
[youtube] EmuBOfurv3o: Downloading thumbnail ...
[youtube] EmuBOfurv3o: Writing thumbnail to: /dev/shm/test-ytd/Tusk (2018 Remaster).webp
[debug] Invoking downloader on 'https://rr2---sn-5hne6n6e.googlevideo.com/videoplayback?expire=1673457798&ei=Jpy-Y7W2C4ix1gK9-ZToDg&ip=<redacted>&id=o-AMn7ra_jQBBstAtHk-tybVyezVogrARotC2nfj4I8K6w&itag=251&source=youtube&requiressl=yes&mh=Hl&mm=31%2C26&mn=sn-5hne6n6e%2Csn-4g5ednss&ms=au%2Conr&mv=m&mvi=2&pl=20&gcr=nl&initcwndbps=2325000&vprv=1&mime=audio%2Fwebm&ns=aCy_ixdJAIk0-0aSiIB8jLsK&gir=yes&clen=3652610&dur=218.881&lmt=1591477016463657&mt=1673435835&fvip=2&keepalive=yes&fexp=24007246&c=WEB&txp=5531432&n=m9gOz-l0Y7dUFA&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgbfqsrDe3ZGl-0OykhMql5uS9MnVywD83vFWprik1EecCIQCUL_kfiUdONtzLBq94ATHredrYWXDjtZKLHc7cFANetQ%3D%3D&sig=AOq0QJ8wRQIgBmIQpFiIzCy_THEkJSM9J7CLfe8wiMNWlXwzeZq7nRECIQCJteu9kaGScU0kZn3D-yy3RZzwqz_q5h5DcG66FwYmgQ%3D%3D'
[download] Destination: /dev/shm/test-ytd/Tusk (2018 Remaster).webm
[debug] aria2c command line: aria2c -c -x 10 -s 10 -j 10 -k 1M --log-level=info --file-allocation=none --dir /dev/shm/test-ytd --out 'Tusk (2018 Remaster).webm.part' --header 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3765.1 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' --interface 0.0.0.0 --check-certificate=true --remote-time=false -- 'https://rr2---sn-5hne6n6e.googlevideo.com/videoplayback?expire=1673457798&ei=Jpy-Y7W2C4ix1gK9-ZToDg&ip=<redacted>&id=o-AMn7ra_jQBBstAtHk-tybVyezVogrARotC2nfj4I8K6w&itag=251&source=youtube&requiressl=yes&mh=Hl&mm=31%2C26&mn=sn-5hne6n6e%2Csn-4g5ednss&ms=au%2Conr&mv=m&mvi=2&pl=20&gcr=nl&initcwndbps=2325000&vprv=1&mime=audio%2Fwebm&ns=aCy_ixdJAIk0-0aSiIB8jLsK&gir=yes&clen=3652610&dur=218.881&lmt=1591477016463657&mt=1673435835&fvip=2&keepalive=yes&fexp=24007246&c=WEB&txp=5531432&n=m9gOz-l0Y7dUFA&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cgcr%2Cvprv%2Cmime%2Cns%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRQIgbfqsrDe3ZGl-0OykhMql5uS9MnVywD83vFWprik1EecCIQCUL_kfiUdONtzLBq94ATHredrYWXDjtZKLHc7cFANetQ%3D%3D&sig=AOq0QJ8wRQIgBmIQpFiIzCy_THEkJSM9J7CLfe8wiMNWlXwzeZq7nRECIQCJteu9kaGScU0kZn3D-yy3RZzwqz_q5h5DcG66FwYmgQ%3D%3D'

01/11 12:23:20 [NOTICE] Downloading 1 item(s)
[#feddab 2.7MiB/3.4MiB(80%) CN:1 DL:286KiB ETA:2s]                             
01/11 12:23:30 [NOTICE] Download complete: /dev/shm/test-ytd/Tusk (2018 Remaster).webm.part

Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
feddab|OK  |   351KiB/s|/dev/shm/test-ytd/Tusk (2018 Remaster).webm.part

Status Legend:
(OK):download completed.
[aria2c] Downloaded 3652610 bytes
[download] 100% of 3.48MiB in 00:10
[debug] ffmpeg command line: ffprobe -show_streams 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).webm'
[ffmpeg] Destination: /dev/shm/test-ytd/Tusk (2018 Remaster).mp3
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).webm' -vn -acodec libmp3lame -q:a 0 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).mp3'
Deleting original file /dev/shm/test-ytd/Tusk (2018 Remaster).webm (pass -k to keep)
[ffmpeg] Adding metadata to '/dev/shm/test-ytd/Tusk (2018 Remaster).mp3'
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).mp3' -c copy -metadata 'title=Tusk (2018 Remaster)' -metadata date=20181115 -metadata 'description=Provided to YouTube by Rhino/Warner Records

Tusk (2018 Remaster) · Fleetwood Mac

50 Years - Don'"'"'t Stop

℗ 1979 Warner Records Inc. 2018 Remastered Rhino Entertainment

Engineer: Barry Goldberg
Additional  Guitar: Brett Tuggle
Additional  Keyboards: Brett Tuggle
Backing  Vocals: Brett Tuggle
Unknown: Charlie Bouis
Unknown: Dr. Arthur C. Bartner
Unknown: Elliot Scheiner
Engineer: Elliot Scheiner
Producer: Elliot Scheiner
Unknown: Guy Charboneau
Bass  Guitar: John McVie
Unknown: John Nelson
Additional  Percussion: Lenny Castro
Guitar, Producer, Vocals: Lindsey Buckingham
Drums, Percussion: Mick Fleetwood
Backing  Vocals: Mindy Stein
Additional  Guitar: Neale Heywood
Backing  Vocals: Neale Heywood
Engineer: Paul DeCarli
Engineer: Scott Humphrey
Backing  Vocals: Sharon Celani
Vocals: Stevie Nicks
Unknown: Ted Jensen
Engineer: Ted Jensen
Ensemble: USC Marching Band
Writer: Lindsey Buckingham

Auto-generated by YouTube.' -metadata 'comment=Provided to YouTube by Rhino/Warner Records

Tusk (2018 Remaster) · Fleetwood Mac

50 Years - Don'"'"'t Stop

℗ 1979 Warner Records Inc. 2018 Remastered Rhino Entertainment

Engineer: Barry Goldberg
Additional  Guitar: Brett Tuggle
Additional  Keyboards: Brett Tuggle
Backing  Vocals: Brett Tuggle
Unknown: Charlie Bouis
Unknown: Dr. Arthur C. Bartner
Unknown: Elliot Scheiner
Engineer: Elliot Scheiner
Producer: Elliot Scheiner
Unknown: Guy Charboneau
Bass  Guitar: John McVie
Unknown: John Nelson
Additional  Percussion: Lenny Castro
Guitar, Producer, Vocals: Lindsey Buckingham
Drums, Percussion: Mick Fleetwood
Backing  Vocals: Mindy Stein
Additional  Guitar: Neale Heywood
Backing  Vocals: Neale Heywood
Engineer: Paul DeCarli
Engineer: Scott Humphrey
Backing  Vocals: Sharon Celani
Vocals: Stevie Nicks
Unknown: Ted Jensen
Engineer: Ted Jensen
Ensemble: USC Marching Band
Writer: Lindsey Buckingham

Auto-generated by YouTube.' -metadata 'purl=https://www.youtube.com/watch?v=EmuBOfurv3o' -metadata 'artist=Fleetwood Mac' -metadata 'album=50 Years - Don'"'"'t Stop' 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).temp.mp3'
[ffmpeg] Converting thumbnail "/dev/shm/test-ytd/Tusk (2018 Remaster).webp" to JPEG
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).webp' -qmin 1 -q:v 1 -bsf:v mjpeg2jpeg 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).jpg'
[ffmpeg] Adding thumbnail to "/dev/shm/test-ytd/Tusk (2018 Remaster).mp3"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).mp3' -i 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).jpg' -c copy -map 0 -map 1 -metadata:s:v 'title="Album cover"' -metadata:s:v 'comment="Cover (Front)"' 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).temp.mp3'

Note however, that I have edited line 72 in embedthumbnail.py to produce better jpeg quality. Doubt that can be the cause.

self.run_ffmpeg(escaped_thumbnail_filename, escaped_thumbnail_jpg_filename, ['-qmin', '1', '-q:v', '1', '-bsf:v', 'mjpeg2jpeg'])

dirkf commented 1 year ago

Probably it's this difference:

         if info['ext'] == 'mp3':
             options = [
-                '-c', 'copy', '-map', '0', '-map', '1',
-                '-metadata:s:v', 'title="Album cover"', '-metadata:s:v', 'comment="Cover (Front)"']
-
-            self._downloader.to_screen('[ffmpeg] Adding thumbnail to "%s"' % filename)
-
+                '-c', 'copy', '-map', '0:0', '-map', '1:0', '-write_id3v1', '1', '-id3v2_version', '3',
+                '-metadata:s:v', 'title="Album cover"', '-metadata:s:v', 'comment=Cover (front)']
+
+            self._report_run('ffmpeg', filename)
             self.run_ffmpeg_multiple_files([filename, thumbnail_filename], temp_filename, options)
nicolaasjan commented 1 year ago

It's a bit offtopic here, but can't youtube-dl's behaviour be changed accordingly? Disclaimer: I'm not a coder myself. 😀️

Difference between conversion: Youtube-dl:

[ffmpeg] Converting thumbnail "/dev/shm/test-ytd/Tusk (2018 Remaster).webp" to JPEG
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).webp' -qmin 1 -q:v 1 -bsf:v mjpeg2jpeg 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).jpg'

Yt-dlp:

[ThumbnailsConvertor] Converting thumbnail "/dev/shm/test-dlp/Tusk (2018 Remaster).webp" to jpg
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -f image2 -pattern_type none -i 'file:/dev/shm/test-dlp/Tusk (2018 Remaster).webp' -update 1 -bsf:v mjpeg2jpeg -movflags +faststart -qmin 1 -q:v 1 -metadata synopsis= 'file:/dev/shm/test-dlp/Tusk (2018 Remaster).jpg'
dirkf commented 1 year ago

For the embedding, there are these two yt-dlp commits that make up the diff above:

At some point this comment applied and probably still does:

# Write id3v1 metadata also since Windows Explorer can't handle id3v2 tags

For the conversion:

ffmpeg -y -loglevel repeat+info -i 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).webp' ...
--qmin 1 -q:v 1 -bsf:v mjpeg2jpeg 'file:/dev/shm/test-ytd/Tusk (2018 Remaster).jpg'
+-update 1 -bsf:v mjpeg2jpeg -movflags +faststart -qmin 1 -q:v 1 -metadata synopsis= 'file:/dev/shm/test-dlp/Tusk (2018 Remaster).jpg'

So I think -update 1 and the ID3 options have to be added.

dirkf commented 1 year ago

Also, embedding in MKV ought to be supported.

pukkandan commented 1 year ago
  • synopsis= is forcing an empty description but from the yt-dlp code I have no idea how it came to be there (would be comment= in yt-dl or, I guess, with yt-dlp compat set).

It looks like @nicolaasjan is manually supplying -qmin 1 -q:v 1 -metadata synopsis=with --ppa. It's not being added by yt-dlp

Since ffmpeg ignores movflags for non-mp4, yt-dlp just adds it to everything

nicolaasjan commented 1 year ago

It looks like @nicolaasjan is manually supplying -qmin 1 -q:v 1 -metadata synopsis=with --ppa. It's not being added by yt-dlp

This is indeed the case.