tubesync
tubesync copied to clipboard
Thumbnail is not embedded into audio files even with "Embed Thumbnails" turned on
I'm using tubesync to download audio files from my playlist and play them on my phone (with the Musicolet app). I turned on both "Embed thumbnail" and "Embed metadata", and while metadata seems to be working fine, the thumbnails are not appearing in the previews.
What I tried
I tried many different combinations of embedding thumbnail, embedding metadata, writing NFO, and changing the audio codec. None of them had any embedded thumbnails.
I also wrote a test script to see if anything was wrong with yt-dlp. However, I saw that this actually did embed the thumbnail into the file:
import yt_dlp
ytopts = {
'format': 'm4a',
'writethumbnail': True,
'postprocessors': [{'key': 'FFmpegMetadata', 'add_metadata': True}, {'key': 'EmbedThumbnail'}],
'quiet': False
}
with yt_dlp.YoutubeDL(ytopts) as y:
y.download(['https://www.youtube.com/watch?v=aSXtXLAVgkE'])
with the output
[youtube] Extracting URL: https://www.youtube.com/watch?v=aSXtXLAVgkE
[youtube] aSXtXLAVgkE: Downloading webpage
[youtube] aSXtXLAVgkE: Downloading ios player API JSON
[youtube] aSXtXLAVgkE: Downloading web creator player API JSON
[youtube] aSXtXLAVgkE: Downloading m3u8 information
[info] aSXtXLAVgkE: Downloading 1 format(s): 140
[info] Downloading video thumbnail 46 ...
[info] Writing video thumbnail 46 to: Rachmaninoff: Piano Concerto #3 (Weissenberg 1968) [with score] [aSXtXLAVgkE].webp
[download] Destination: Rachmaninoff: Piano Concerto #3 (Weissenberg 1968) [with score] [aSXtXLAVgkE].m4a
[download] 100% of 40.05MiB in 00:00:04 at 9.37MiB/s
[FixupM4a] Correcting container of "Rachmaninoff: Piano Concerto #3 (Weissenberg 1968) [with score] [aSXtXLAVgkE].m4a"
[Metadata] Adding metadata to "Rachmaninoff: Piano Concerto #3 (Weissenberg 1968) [with score] [aSXtXLAVgkE].m4a"
[ThumbnailsConvertor] Converting thumbnail "Rachmaninoff: Piano Concerto #3 (Weissenberg 1968) [with score] [aSXtXLAVgkE].webp" to png
[EmbedThumbnail] mutagen: Adding thumbnail to "Rachmaninoff: Piano Concerto #3 (Weissenberg 1968) [with score] [aSXtXLAVgkE].m4a"
| Tubesync | Test script |
|---|---|
I skimmed tubesync's codebase, and I think that my test script's writethumbnail option may have something to do with it? I'm not sure though, since I can't test it because manually running tubesync without a container doesn't seem to be working for me (#534)
I also might be entirely getting the wrong idea of what embedding thumbnails is supposed to do 😅 Regardless, loving tubesync rn! Keep up the good work!
Same here. Thumbnail doesn't get embedded in the audio files..
Thanks for the issue. There are occasions where a relatively esoteric combination of yt-dlp and ffmpeg flags are required to get some metadata features to work. tubesync does set the same keys as you:
https://github.com/meeb/tubesync/blob/main/tubesync/sync/youtube.py#L164
The only difference is tubesync doesn't set 'writethumbnail': True for yt-dlp because thumbnails are downloaded separately and enabling this would download two copies of thumbnails with different file names.
I'll poke into it but it would seem that this particular container / encoding pair might require 'writethumbnail': True to work if your test is correct.
did you get this to work? For my with audio only files it is not embedding the thumbnail. Navidrome is showing default pictures for all songs i have downloaded
No, I haven't gotten it to work yet 😔
Is this still an issue?
The post processing options for yt-dlp were reworked recently.
2025-02-28 13:41:41,177 [tubesync/INFO] [EmbedThumbnail] started for: xY2Z7GvWBk8: Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)
[ThumbnailsConvertor] Converting thumbnail "/downloads/cache/.yt_dlp-xY2Z7GvWBk8-_poqayav/Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)_xY2Z7GvWBk8_opus.ogg.webp" to png
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -f image2 -pattern_type none -i 'file:/downloads/cache/.yt_dlp-xY2Z7GvWBk8-_poqayav/Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)_xY2Z7GvWBk8_opus.ogg.webp' -update 1 -movflags +faststart 'file:/downloads/cache/.yt_dlp-xY2Z7GvWBk8-_poqayav/Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)_xY2Z7GvWBk8_opus.ogg.png'
ERROR: Supported filetypes for thumbnail embedding are: mp3, mkv/mka, ogg/opus/flac, m4a/mp4/m4v/mov
Traceback (most recent call last):
File "/usr/local/lib/python3.11/dist-packages/yt_dlp/YoutubeDL.py", line 3714, in run_pp
files_to_delete, infodict = pp.run(infodict)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/yt_dlp/postprocessor/common.py", line 22, in run
ret = func(self, info, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/yt_dlp/postprocessor/common.py", line 127, in wrapper
return func(self, info)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/dist-packages/yt_dlp/postprocessor/embedthumbnail.py", line 222, in run
raise EmbedThumbnailPPError('Supported filetypes for thumbnail embedding are: mp3, mkv/mka, ogg/opus/flac, m4a/mp4/m4v/mov')
yt_dlp.postprocessor.embedthumbnail.EmbedThumbnailPPError: Supported filetypes for thumbnail embedding are: mp3, mkv/mka, ogg/opus/flac, m4a/mp4/m4v/mov
Think so. Running these versions in docker: TubeSync version 0.13.7 with yt-dlp version 2025.02.19 and FFmpeg version N-118500-g08e37fa082-20250218.
Config for the source: Source Resolution: Audio Only Source Video Codec: VP9 Source Audio Codec: OPUS Copy Thumbnails: False (since this only saves a image in the folder) Embed Metadata: True Embed Thumbnail: True Sponsorblock: False
Update: Changed to MP4A as 'Source Audio Codec' and now the embed is working:
[EmbedThumbnail] Neither mutagen nor AtomicParsley was found. Falling back to ffmpeg
[debug] ffprobe command line: ffprobe -hide_banner -show_format -show_streams -print_format json 'file:/downloads/cache/.yt_dlp-xY2Z7GvWBk8-uw2tmihe/Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)_xY2Z7GvWBk8_mp4a.m4a'
[EmbedThumbnail] ffmpeg: Adding thumbnail to "/downloads/cache/.yt_dlp-xY2Z7GvWBk8-uw2tmihe/Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)_xY2Z7GvWBk8_mp4a.m4a"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:/downloads/cache/.yt_dlp-xY2Z7GvWBk8-uw2tmihe/Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)_xY2Z7GvWBk8_mp4a.m4a' -i 'file:/downloads/cache/.yt_dlp-xY2Z7GvWBk8-uw2tmihe/Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)_xY2Z7GvWBk8_mp4a.png' -map 0 -dn -ignore_unknown -c copy -map 1 -disposition:1 attached_pic -movflags +faststart 'file:/downloads/cache/.yt_dlp-xY2Z7GvWBk8-uw2tmihe/Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)_xY2Z7GvWBk8_mp4a.temp.m4a'
2025-02-28 13:54:51,150 [tubesync/INFO] [EmbedThumbnail] finished for: xY2Z7GvWBk8: Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)
2025-02-28 13:54:51,165 [tubesync/INFO] [EmbedThumbnail] finished for: xY2Z7GvWBk8: Dankey Kong - JAG SKITER I feat. Östblockarn & ERK (DIY VIDEO)
Thanks for checking.
I've opened #791 to see if we can make opus work as well. Please close this issue, if thumbnails are being embedded with mp4a.
I think m4a's working as well, I'm getting the youtube thumbnails for the most recent things I've added to my playlist. Thanks for all the hard work!