Skip to content

🎥 Make videos programmatically with React

add a test

JonnyBurger13d72b4a4626
diff --git a/packages/eslint-plugin/src/rules/even-dimensions.ts b/packages/eslint-plugin/src/rules/even-dimensions.ts
index 65648d53e2..897b91becc 100644
--- a/packages/eslint-plugin/src/rules/even-dimensions.ts
+++ b/packages/eslint-plugin/src/rules/even-dimensions.ts
@@ -9,7 +9,7 @@ type Options = [];
type MessageIds = 'EvenDimensions';
const EvenDimensions =
- "Videos rendered in H264/H265 codec do not support dimensions that are not divisible by 2. Make the number even to resolve this warning. Ignore this warning if you don't plan on rendering this video with a H264 or H265 codec.";
+ "Videos rendered in H264/H265 codec do not support dimensions that are not divisible by 2. Remotion will round down your dimensions to satisfy this constraint. Ignore this warning if you don't plan on rendering this video with a H264 or H265 codec.";
export default createRule<Options, MessageIds>({
name: 'even-dimensions',
diff --git a/packages/renderer/src/test/even-dimensions.test.ts b/packages/renderer/src/test/even-dimensions.test.ts
new file mode 100644
index 0000000000..02277fbf23
--- /dev/null
+++ b/packages/renderer/src/test/even-dimensions.test.ts
@@ -0,0 +1,36 @@
+import {expect, test} from 'bun:test';
+import {validateEvenDimensionsWithCodec} from '../validate-even-dimensions-with-codec';
+
+test('should eventually result in even dimensions', () => {
+ const scale = 2.3275862069;
+ const {actualWidth, actualHeight} = validateEvenDimensionsWithCodec({
+ codec: 'h264',
+ width: 464,
+ height: 832,
+ indent: false,
+ logLevel: 'info',
+ scale,
+ wantsImageSequence: false,
+ });
+ expect(actualHeight).toBe(831);
+ expect(actualWidth).toBe(464);
+ expect(Math.round(actualHeight * scale)).toBe(1934);
+ expect(Math.round(actualWidth * scale)).toBe(1080);
+});
+
+test('default case', () => {
+ const scale = 2;
+ const {actualWidth, actualHeight} = validateEvenDimensionsWithCodec({
+ codec: 'h264',
+ width: 464,
+ height: 832,
+ indent: false,
+ logLevel: 'info',
+ scale,
+ wantsImageSequence: false,
+ });
+ expect(actualHeight).toBe(832);
+ expect(actualWidth).toBe(464);
+ expect(Math.round(actualHeight * scale)).toBe(1664);
+ expect(Math.round(actualWidth * scale)).toBe(928);
+});