Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure resolution is divisible by 2 after scaling #4507

Merged
merged 2 commits into from Mar 2, 2024

Conversation

future-figs
Copy link
Contributor

I had an issue where some video files would not play with the renderer's max resolution set to 640x480. It turned out that the scale filter had calculated an output resolution with an odd number of pixels for the height, which caused libx264 to crash.

This PR adds a black 1-pixel pad in either axis if needed, with the output centered. This makes the resolution divisible by 2 along both axes. It only applies to one usage of the scale filter because the others either get their output resolutions from the renderer's max resolution (instead of calculating some oddball res), or already have even-number padding implemented (using convertToModX). So, now all cases should be accounted for.

One bit of inconsistency is that multiples of 2 are enforced, instead of multiples of 4 as in the existing code with convertToModX. If multiples of 4 are required for some reason, then this should be edited to make it so.

@SubJunk
Copy link
Member

SubJunk commented Feb 29, 2024

@future-figs thanks for this, yes please make it mod4 because some players can't play some mod2 resolutions. Panasonic TVs being one of them

@future-figs
Copy link
Contributor Author

Thanks for explaining, changed to multiples of 4.

@SubJunk SubJunk merged commit 6d94f58 into UniversalMediaServer:main Mar 2, 2024
9 of 10 checks passed
@SubJunk
Copy link
Member

SubJunk commented Mar 2, 2024

Thanks!

sf666 added a commit to ik666/UniversalMediaServer that referenced this pull request Mar 4, 2024
* v14_ums: (24 commits)
  fix HttpExchangeServletRequest Servlet implementation
  fix HttpExchangeServletRequest Servlet implementation fix ServerSentEvents implementation
  Ensure resolution is divisible by 2 after scaling (UniversalMediaServer#4507)
  Bump JRE from 17.0.9 to 17.0.10 (UniversalMediaServer#4509)
  log resource finding
  Bump @types/react from 18.2.55 to 18.2.59 in /react-client (UniversalMediaServer#4505)
  Bump @types/node from 18.19.17 to 18.19.18 in /react-client (UniversalMediaServer#4502)
  Bump eslint from 8.56.0 to 8.57.0 in /react-client (UniversalMediaServer#4503)
  Bump org.codehaus.mojo:exec-maven-plugin from 3.1.1 to 3.2.0 (UniversalMediaServer#4504)
  remove old paypal link
  remove old paypal link
  remove old paypal link
  log more on MediaScanner
  Bump MediaInfo to 24.01.1 and FFmpeg to 2024-02-22 (UniversalMediaServer#4500)
  loading overlay
  Bump the npm_and_yarn group across 1 directories with 1 update (UniversalMediaServer#4498)
  Removed broken PayPal link, replace with link to our donate page
  Fix Open Collective link
  Removed PayPal, added Open Collective
  Bump @testing-library/react from 14.1.2 to 14.2.1 in /react-client (UniversalMediaServer#4488)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants