- for (const resolution of resolutions) {
- if (configResolutions[resolution + 'p'] === true && videoFileResolution > resolution) {
- resolutionsEnabled.push(resolution)
- }
+ for (const resolution of availableResolutions) {
+ // Resolution not enabled
+ if (configResolutions[resolution + 'p'] !== true) continue
+ // Too big resolution for input file
+ if (input < resolution) continue
+ // We only want lower resolutions than input file
+ if (strictLower && input === resolution) continue
+
+ resolutionsEnabled.add(resolution)
+ }
+
+ if (includeInput) {
+ resolutionsEnabled.add(input)