Skip to content

🎥 Make videos programmatically with React

also applies to H265

Jonny Burgerac70cd1b47c7
diff --git a/packages/eslint-plugin/src/rules/even-dimensions.ts b/packages/eslint-plugin/src/rules/even-dimensions.ts
index 9f7c61071f..26034b3230 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 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 codec.";
+ "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.";
export default createRule<Options, MessageIds>({
name: "even-dimensions",
diff --git a/packages/renderer/src/validate-even-dimensions-with-codec.ts b/packages/renderer/src/validate-even-dimensions-with-codec.ts
index a56fed2cfe..cf0da350f4 100644
--- a/packages/renderer/src/validate-even-dimensions-with-codec.ts
+++ b/packages/renderer/src/validate-even-dimensions-with-codec.ts
@@ -9,13 +9,15 @@ export const validateEvenDimensionsWithCodec = ({
height: number;
codec: Codec;
}) => {
- if (codec !== 'h264-mkv' && codec !== 'h264') {
+ if (codec !== 'h264-mkv' && codec !== 'h264' && codec !== 'h265') {
return;
}
+ const displayName = codec === 'h265' ? 'H265' : 'H264';
+
if (width % 2 !== 0) {
throw new Error(
- `Codec error: You are trying to render a video with a H264 codec that has a width of ${width}px, which is an odd number. The H264 codec does only support dimensions with even numbers. Change the width to ${Math.floor(
+ `Codec error: You are trying to render a video with a ${displayName} codec that has a width of ${width}px, which is an odd number. The ${displayName} codec does only support dimensions with even numbers. Change the width to ${Math.floor(
width - 1
)}px to fix this issue.`
);
@@ -23,7 +25,7 @@ export const validateEvenDimensionsWithCodec = ({
if (height % 2 !== 0) {
throw new Error(
- `Codec error: You are trying to render a video with a H264 codec that has a height of ${height}px, which is an odd number. The H264 codec does only support dimensions with even numbers. Change the height to ${Math.floor(
+ `Codec error: You are trying to render a video with a ${displayName} codec that has a height of ${height}px, which is an odd number. The ${displayName} codec does only support dimensions with even numbers. Change the height to ${Math.floor(
height - 1
)}px to fix this issue.`
);