fix odd numbers
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m7s
All checks were successful
Build Images and Deploy / Update-PROD-Stack (push) Successful in 1m7s
This commit is contained in:
3
app.py
3
app.py
@@ -128,7 +128,8 @@ def process_video():
|
|||||||
scale_percentage = data.get('scale_percentage', 100)
|
scale_percentage = data.get('scale_percentage', 100)
|
||||||
if scale_percentage != 100:
|
if scale_percentage != 100:
|
||||||
# Scale based on percentage - ffmpeg will apply this after crop
|
# Scale based on percentage - ffmpeg will apply this after crop
|
||||||
scale_filter = f"scale=iw*{scale_percentage/100}:ih*{scale_percentage/100}"
|
# Force dimensions divisible by 2 for H.264 compatibility
|
||||||
|
scale_filter = f"scale=trunc(iw*{scale_percentage/100}/2)*2:trunc(ih*{scale_percentage/100}/2)*2"
|
||||||
filters.append(scale_filter)
|
filters.append(scale_filter)
|
||||||
|
|
||||||
# Apply filters if any
|
# Apply filters if any
|
||||||
|
|||||||
@@ -845,8 +845,9 @@
|
|||||||
const cropWidth = parseInt(document.getElementById('crop-width').value) || videoInfo.width;
|
const cropWidth = parseInt(document.getElementById('crop-width').value) || videoInfo.width;
|
||||||
const cropHeight = parseInt(document.getElementById('crop-height').value) || videoInfo.height;
|
const cropHeight = parseInt(document.getElementById('crop-height').value) || videoInfo.height;
|
||||||
|
|
||||||
const outputWidth = Math.round((cropWidth * scalePercentage) / 100);
|
// Round to nearest even number for H.264 compatibility
|
||||||
const outputHeight = Math.round((cropHeight * scalePercentage) / 100);
|
const outputWidth = Math.round((cropWidth * scalePercentage) / 100 / 2) * 2;
|
||||||
|
const outputHeight = Math.round((cropHeight * scalePercentage) / 100 / 2) * 2;
|
||||||
|
|
||||||
outputResolution.textContent = `${outputWidth}x${outputHeight}`;
|
outputResolution.textContent = `${outputWidth}x${outputHeight}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user