tubesync icon indicating copy to clipboard operation
tubesync copied to clipboard

next best codec

Open Hawam opened this issue 5 months ago • 1 comments

I set my Source video codec to AV1 and Fallback to Get next best resolution or codec instead if AV1 is not available shouldn't the next codec chosen be VP9?

Source | karazah
-- | --
Duration | 00:03:09
Published | 2025-05-16 03:00
Desired format | 1080p (video:AV1, audio:OPUS) 60FPS HDR
Fallback | Get next best resolution or codec instead
Title | نحن أمل الأجيال \| رسالة أطفال كرزة من أجل السلام
Downloaded? |  
Can download? |  
Available formats | ID: sb3ID: sb2ID: sb1ID: sb0ID: 139 , audio:MP4A @48.815k / 22,050Hz [ar] low, MISSING POTID: 249 , audio:OPUS @49.778k / 48,000Hz [ar] lowID: 250 , audio:OPUS @65.528k / 48,000Hz [ar] lowID: 140 , audio:MP4A @129.504k / 44,100Hz [ar] mediumID: 251 , audio:OPUS @125.937k / 48,000Hz [ar] medium (matched)ID: 160 , 144p (256x144), fps:25, video:AVC1 @77.952kID: 278 , 144p (256x144), fps:25, video:VP9 @65.964kID: 133 , 240p (426x240), fps:25, video:AVC1 @164.435kID: 242 , 240p (426x240), fps:25, video:VP9 @110.1kID: 134 , 360p (640x360), fps:25, video:AVC1 @301.849kID: 18 , 360p (640x360), fps:25, video:AVC1 @396.062k , audio:MP4A 44,100Hz [ar]ID: 243 , 360p (640x360), fps:25, video:VP9 @176.871kID: 135 , 480p (854x480), fps:25, video:AVC1 @575.379kID: 244 , 480p (854x480), fps:25, video:VP9 @280.214kID: 136 , 720p (1280x720), fps:25, video:AVC1 @972.679kID: 247 , 720p (1280x720), fps:25, video:VP9 @487.186kID: 137 , 1080p (1920x1080), fps:25, video:AVC1 @1629.715k (matched)ID: 248 , 1080p (1920x1080), fps:25, video:VP9 @801.369kID: 271 , 1440p (2560x1440), fps:25, video:VP9 @2249.734kID: 313 , 2160p (3840x2160), fps:25, video:VP9 @3696.297k
Matched formats | Combined: no matchAudio: 251 (exact match)Video: 137 (fallback)
Source	[karazah](http://192.168.1.120:4848/source/31f59f81-a758-417a-ba6d-661653314675)
Duration	00:03:09
Published	2025-05-16 03:00
Desired format	1080p (video:AV1, audio:OPUS) 60FPS HDR
Fallback	Get next best resolution or codec instead
Title	نحن أمل الأجيال | رسالة أطفال كرزة من أجل السلام
Downloaded?	
Can download?	
Available formats	
ID: sb3
ID: sb2
ID: sb1
ID: sb0
ID: 139 , audio:MP4A @48.815k / 22,050Hz [ar] low, MISSING POT
ID: 249 , audio:OPUS @49.778k / 48,000Hz [ar] low
ID: 250 , audio:OPUS @65.528k / 48,000Hz [ar] low
ID: 140 , audio:MP4A @129.504k / 44,100Hz [ar] medium
ID: 251 , audio:OPUS @125.937k / 48,000Hz [ar] medium (matched)
ID: 160 , 144p (256x144), fps:25, video:AVC1 @77.952k
ID: 278 , 144p (256x144), fps:25, video:VP9 @65.964k
ID: 133 , 240p (426x240), fps:25, video:AVC1 @164.435k
ID: 242 , 240p (426x240), fps:25, video:VP9 @110.1k
ID: 134 , 360p (640x360), fps:25, video:AVC1 @301.849k
ID: 18 , 360p (640x360), fps:25, video:AVC1 @396.062k , audio:MP4A 44,100Hz [ar]
ID: 243 , 360p (640x360), fps:25, video:VP9 @176.871k
ID: 135 , 480p (854x480), fps:25, video:AVC1 @575.379k
ID: 244 , 480p (854x480), fps:25, video:VP9 @280.214k
ID: 136 , 720p (1280x720), fps:25, video:AVC1 @972.679k
ID: 247 , 720p (1280x720), fps:25, video:VP9 @487.186k
ID: 137 , 1080p (1920x1080), fps:25, video:AVC1 @1629.715k (matched)
ID: 248 , 1080p (1920x1080), fps:25, video:VP9 @801.369k
ID: 271 , 1440p (2560x1440), fps:25, video:VP9 @2249.734k
ID: 313 , 2160p (3840x2160), fps:25, video:VP9 @3696.297k
Matched formats	Combined: no match
Audio: 251 (exact match)
Video: 137 (fallback)

Hawam avatar Jun 16 '25 08:06 Hawam

It looks like matching will stop at line 203 for your case.

https://github.com/meeb/tubesync/blob/f5a71592fc7f40466aeda1bf370529eecf0a84b2/tubesync/sync/matching.py#L144-L212

tcely avatar Jun 16 '25 11:06 tcely

I am facing the same issue. Instead of falling back from AV1 to VP9 the app falls back to AVC1 using v0.15.4

Image

sebthom avatar Jun 26 '25 13:06 sebthom

@sebthom It looks like your matching stopped at line 212.

tcely avatar Jun 26 '25 21:06 tcely

Is this the expected behavior with fallback set to next best but at least HD?

2160p (video:VP9, audio:OPUS) 60FPS


ID: sb3
ID: sb2
ID: sb1
ID: sb0
ID: 139 , audio:MP4A @48.785k / 22,050Hz [ru] low, MISSING POT
ID: 140 , audio:MP4A @129.473k / 44,100Hz [ru] medium
ID: 251 , audio:OPUS @135.536k / 48,000Hz [ru] medium (matched)
ID: 160 , 144p (256x144), fps:30, video:AVC1 @48.287k
ID: 134 , 360p (640x360), fps:30, video:AVC1 @215.804k
ID: 18 , 360p (640x360), fps:30, video:AVC1 @263.477k , audio:MP4A 22,050Hz [ru]
ID: 243 , 360p (640x360), fps:30, video:VP9 @164.572k
ID: 136 , 720p (1280x720), fps:30, video:AVC1 @917.77k
ID: 137 , 1080p (1920x1080), fps:30, video:AVC1 @1871.485k


Combined: no match
Audio: 251 (exact match)
Video: no match

I would have expected to match against the 1080p AVC1 encoded video stream, since it's still HD, but I might be misinterpreting.

mikeweyandt avatar Aug 27 '25 02:08 mikeweyandt

@mikeweyandt

Is your source configured to allow fallback?

https://github.com/meeb/tubesync/blob/d8e3c8003729f9777bb4a3050de01776f3fe2062/tubesync/sync/matching.py#L214-L277

Line 277 should be selecting one of the video formats, if it was.

tcely avatar Aug 27 '25 02:08 tcely

Yeah, it was set to Get next best resolution but at least HD, I'll see if I can get it to fail in a test case tomorrow. Otherwise might've just been misconfigured.

mikeweyandt avatar Aug 27 '25 02:08 mikeweyandt

I'm having trouble getting the dependencies installed via pipenv, are you using a dev container? It's been a variety of errors as I've moved between platforms, so it feels like just something I'm doing or just platform thing. Are you mainly developing on a debian system or something else?

mikeweyandt avatar Aug 31 '25 19:08 mikeweyandt

Personally, I tend to experiment and test ideas by deploying a docker container.

This is a large reason why I added a working editor and added less to the base image even though it isn't strictly required.

The build process is using a Debian system. https://github.com/meeb/tubesync/blob/d8e3c8003729f9777bb4a3050de01776f3fe2062/Dockerfile#L13 https://github.com/meeb/tubesync/blob/d8e3c8003729f9777bb4a3050de01776f3fe2062/Dockerfile#L22

uv is used to run pipenv to ultimately create the requirements.txt file that uv pip uses.

https://github.com/meeb/tubesync/actions/runs/17244405463/job/48930269136#step:8:3386

[!IMPORTANT] Please open your own issue if you want any help with installing dependencies.

tcely avatar Aug 31 '25 19:08 tcely