tubesync icon indicating copy to clipboard operation
tubesync copied to clipboard

Don't produce thumbnails with weird aspect ratios

Open Anusien opened this issue 6 months ago • 4 comments

Tubesync forces a maximum thumbnail resolution of 430x240. 43:24 is a weird aspect ratio. For example Jellyfin uses 16:9 for thumbnails: https://github.com/jellyfin/jellyfin-meta/issues/12#issuecomment-759373678. This isn't configurable and results in all the thumbnails looking weird and cut off. This setting is in code, not exposed by an environment variable, and therefore very challenging to change permanently.

Some options:

  1. Make the resolution configurable in environment variables
  2. Make the desired aspect ratio configurable in environment variables
  3. Don't crop images at all (or make this an option)
  4. Crop images but preserve aspect ratio. So instead of taking a 640x480 thumbnail and making it 430x240, it becomes 320x240 and at least keeps the correct resolution.

I end up really disliking the way the thumbnails get cut off in my player and have to redownload them separately.

Anusien avatar May 31 '25 04:05 Anusien

Better link on info about Jellyfin image sizes: https://github.com/jellyfin-archive/jellyfin-docs/issues/181

Anusien avatar May 31 '25 04:05 Anusien

This isn't configurable and results in all the thumbnails looking weird and cut off. This setting is in code, not exposed by an environment variable, and therefore very challenging to change permanently.

It is actually configurable.

https://github.com/meeb/tubesync/blob/e3ce550e6ae9038e771d459213b7491eae6dff7a/tubesync/tubesync/settings.py#L155-L156

Changing it involves putting your desired values into your local_settings.py file.

Some options:

  1. Make the resolution configurable in environment variables

There are a lot of these already, and very few people have mentioned even wanting to change the thumbnail size displayed in the web UI.

  1. Make the desired aspect ratio configurable in environment variables

The aspect ratio thumbnails begin with isn't always consistent. YouTube does some post processing leading to images that can appear very differently despite having similar dimensions.

  1. Don't crop images at all (or make this an option)

That is already an option. Configure these settings large enough and you can save the original image.

https://github.com/meeb/tubesync/blob/e3ce550e6ae9038e771d459213b7491eae6dff7a/tubesync/sync/tasks.py#L601-L615

  1. Crop images but preserve aspect ratio. So instead of taking a 640x480 thumbnail and making it 430x240, it becomes 320x240 and at least keeps the correct resolution.

Again, the image dimensions won't always correspond to the actual aspect ratio for thumbnails.

I end up really disliking the way the thumbnails get cut off in my player and have to redownload them separately.

From this, I gather you are using the copy thumbnails setting on your source. Try turning that off and using embed thumbnail instead.

Jellyfin has options to extract thumbnail attachments from video files and there are also plugins that will download images for YouTube videos.

tcely avatar May 31 '25 05:05 tcely

I am actually setting it to embed thumbnails as well. Jellyfin doesn’t seem to read them from there for tv shows.

Good to know about local_settings. I’ll mess around with it and see if we can document this on README.md better.

YouTube does some post processing leading to images that can appear very differently despite having similar dimensions Is there more information on this? When I’ve manually used yt-dlp to list thumbnails and then downloaded them with wget, the aspect ratios are what’s advertised (for the ones with listed aspect ratios anyway).

Anusien avatar May 31 '25 13:05 Anusien

I am actually setting it to embed thumbnails as well. Jellyfin doesn’t seem to read them from there for TV shows.

I would not be surprised if Jellyfin prefers external images.

Try not copying a thumbnail, for a bit, then see if Jellyfin starts using the embedded thumbnail instead.

That's interesting about TV shows. I always have YouTube videos included as movies with Jellyfin. For grouping those, I use the studio metadata to track the channel that the video was retrieved from.

Good to know about local_settings.py. I’ll mess around with it and see if we can document this on README.md better.

I have some code sitting somewhere[^foundit] that copied that file out of /config/tubesync during container start-up that has greatly improved the convenience of using that file for me.

[^foundit]: Oh, good; I have included that code in one of my recent pull requests. #1075

Attaching my volumes to the container was easier than remembering to bind mount that file into place and attach the /config volume.

Adding a distinct file would be a good idea. The README.md is already huge.

Maybe mention the file in the README.md and link to the new file under docs like the advanced usage guides already do.

YouTube does some post processing leading to images that can appear very differently despite having similar dimensions

Is there more information on this? When I’ve manually used yt-dlp to list thumbnails and then downloaded them with wget, the aspect ratios are what’s advertised (for the ones with listed aspect ratios anyway).

It was probably from one of the many Google documents that I've read about how the YouTube API works. I simply don't remember where that detail came from though.

We have seen rare cases where the thumbnail image was screwy reported by users.

tcely avatar Jun 01 '25 04:06 tcely