tubesync icon indicating copy to clipboard operation
tubesync copied to clipboard

get_best_video_format falls back to low resolution of requested codec

Open Errkeyni opened this issue 1 month ago • 3 comments

Desired format  4320p (video:VP9, audio:OPUS) 60FPS HDR
Fallback        Get next best resolution or codec instead

Matched 360p (VP9) despite 1080p (AVC1) being available

Available formats
ID: sb2
ID: sb1
ID: sb0
ID: 139 , audio:MP4A @48.807k / 22,050Hz low
ID: 140 , audio:MP4A @129.496k / 44,100Hz medium
ID: 251 , audio:OPUS @98.686k / 48,000Hz medium (matched)
ID: 160 , 144p (256x144),       fps:30, video:AVC1  @32.429k
ID: 134 , 360p (640x360),       fps:30, video:AVC1  @119.921k
ID: 18  , 360p (640x360),       fps:30, video:AVC1  @248.129k , audio:MP4A 44,100Hz
ID: 243 , 360p (640x360),       fps:30, video:VP9   @86.351k (matched)
ID: 136 , 720p (1280x720),      fps:30, video:AVC1  @307.784k
ID: 137 , 1080p (1920x1080),    fps:30, video:AVC1  @583.603k
Matched formats 	Combined: no match
Audio: 251 (exact match)
Video: 243 (fallback)

I think the search for the requested codec (lines 227-232) should be limited to the highest available resolution

https://github.com/meeb/tubesync/blob/c5af0ca3241aa7901721de1816043214cc21e064/tubesync/sync/matching.py#L221-L235

Errkeyni avatar Nov 29 '25 19:11 Errkeyni

What happens after you change your source to desire AV1 instead?

tcely avatar Nov 29 '25 19:11 tcely

A fallback would be 1080p (AVC1), but on a video that is:

  • Not 4320p
  • Not HDR
  • Not 60fps
  • Has AV1

The fallback would be any AV1, not next best resolution.

Errkeyni avatar Nov 29 '25 20:11 Errkeyni

Here is the fix that worked for me https://github.com/meeb/tubesync/commit/9961cdc67ad9b32dc389553f54d7d9b1f8b5f4b9. I can submit a PR and maybe you can take a look?

Errkeyni avatar Nov 29 '25 21:11 Errkeyni