You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current system for resolutions and framerates has some flaws. All in helpers.py file.
RESOLUTIONS
The videos which do not have 16:9 aspect ratio are not encoded in the right resolutions.
Example 1: A video that has a resolution of 1280 × 544 is encoded only up to a 480p profile. Should also be in the 720p profile.
Example 2: A video that has a resolution of 544 × 1280 is encoded up to the 480p profile. Should be up to the vertical 720p profile.
The issue is that the algorithm which selects which resolutions should be encoded uses only height. Also, the vertical video detection should be done first: if (target_width/target_height)<1:
Based on this, an appropriate set of rectangles, vertical or horizontal, is selected. 1:1 video will fall into the horizontal category.
The scaling part could be changed from "scale=-2:" + str(target_height) + ",fps=fps=" + str(target_fps),
to something like "scale=w=" + str(target_width) + ":h=" + str(target_height) + ":force_original_aspect_ratio=decrease,fps=fps=" + str(target_fps),
This inserts whatever aspect ratio to defined rectangles keeping the original aspect ratio intact.
Horizontal rectangle examples :
256 ×144
448 × 252
640 × 360
960 × 540
1280 × 720
1920 × 1080
3840 × 2160
7680 × 4320
And their 90° rotated variants for videos that are vertical. I think that 480p is not quite suitable, because it does not have an integer width for 16:9 video, 240p as well.
FRAMERATE
Videos with fractional framerate are encoded as 60fps or 30fps.
This can be blamed: # adjust the target frame rate if the input is fractional target_fps = src_framerate if isinstance(src_framerate, int) else math.ceil(src_framerate)
I do not see any reason for this. Video should be presented in the same framerate as original or it can be halved (60 fps to 30 fps). FFmpeg fps filter can just use fractional input. In case halving of ~50-60fps is needed, for ~25-30fps versions, division by 2 is possible. "scale=-2:" + str(target_height) + ",fps=fps=" + str(source_fps),
or for halving "scale=-2:" + str(target_height) + ",fps=fps=" + str(source_fps/2),
I am willing to help with this but there is documentation missing so this is what I was able to deduce from the helpers.py file.
The text was updated successfully, but these errors were encountered:
Hi @ssteo , you're making an incorrect assumption here, that either there's a fix for this or otherwise the project is no longer maintained. Well, the project is definitely being maintained!
There have been fixes (and some of them contributed even by @multiflexi that opened this one) but there's definitely room for improvement here.
Did you notice some strange behaviour? Feel free to share more details
Thanks, I'm also encountering issues where some videos which are 1080p but when uploaded to mediacms the available transcoded resolution is only up to 720 somehow.
The current system for resolutions and framerates has some flaws. All in helpers.py file.
RESOLUTIONS
The videos which do not have 16:9 aspect ratio are not encoded in the right resolutions.
Example 1: A video that has a resolution of 1280 × 544 is encoded only up to a 480p profile. Should also be in the 720p profile.
Example 2: A video that has a resolution of 544 × 1280 is encoded up to the 480p profile. Should be up to the vertical 720p profile.
The issue is that the algorithm which selects which resolutions should be encoded uses only height. Also, the vertical video detection should be done first:
if (target_width/target_height)<1:
Based on this, an appropriate set of rectangles, vertical or horizontal, is selected. 1:1 video will fall into the horizontal category.
The scaling part could be changed from
"scale=-2:" + str(target_height) + ",fps=fps=" + str(target_fps),
to something like
"scale=w=" + str(target_width) + ":h=" + str(target_height) + ":force_original_aspect_ratio=decrease,fps=fps=" + str(target_fps),
This inserts whatever aspect ratio to defined rectangles keeping the original aspect ratio intact.
Horizontal rectangle examples :
And their 90° rotated variants for videos that are vertical. I think that 480p is not quite suitable, because it does not have an integer width for 16:9 video, 240p as well.
FRAMERATE
Videos with fractional framerate are encoded as 60fps or 30fps.
This can be blamed:
# adjust the target frame rate if the input is fractional target_fps = src_framerate if isinstance(src_framerate, int) else math.ceil(src_framerate)
I do not see any reason for this. Video should be presented in the same framerate as original or it can be halved (60 fps to 30 fps). FFmpeg fps filter can just use fractional input. In case halving of ~50-60fps is needed, for ~25-30fps versions, division by 2 is possible.
"scale=-2:" + str(target_height) + ",fps=fps=" + str(source_fps),
or for halving
"scale=-2:" + str(target_height) + ",fps=fps=" + str(source_fps/2),
I am willing to help with this but there is documentation missing so this is what I was able to deduce from the helpers.py file.
The text was updated successfully, but these errors were encountered: