Skip to content

Commit 06d34b4

Browse files
committed
fix: rotation direction is reversed
1 parent 8e2c42e commit 06d34b4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/lazy-teams-throw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@webav/av-cliper': patch
3+
---
4+
5+
fix: rotation direction is reversed

packages/av-cliper/src/mp4-utils/mp4box-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ export function createVFRotater(
233233
const ctx = canvas.getContext('2d')!;
234234

235235
ctx.translate(rotatedWidth / 2, rotatedHeight / 2);
236-
ctx.rotate((normalizedRotation * Math.PI) / 180);
236+
ctx.rotate((-normalizedRotation * Math.PI) / 180);
237237
ctx.translate(-width / 2, -height / 2);
238238

239239
return (vf: VideoFrame | null) => {
@@ -242,7 +242,7 @@ export function createVFRotater(
242242
ctx.drawImage(vf, 0, 0);
243243
const newVF = new VideoFrame(canvas, {
244244
timestamp: vf.timestamp,
245-
duration: vf.duration ?? 0,
245+
duration: vf.duration ?? undefined,
246246
});
247247
vf.close();
248248
return newVF;

0 commit comments

Comments
 (0)