@mediabunny/server 1.56.3 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mediabunny/server",
3
3
  "author": "Vanilagy",
4
- "version": "1.56.3",
4
+ "version": "1.57.0",
5
5
  "description": "Adds full video and audio decoder and encoder support to Mediabunny for use in server-side environments (Node, Bun, Deno). Based on NodeAV.",
6
6
  "main": "./dist/bundles/mediabunny-server.cjs",
7
7
  "module": "./dist/bundles/mediabunny-server.mjs",
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "node-av": "^6.0.0",
38
- "@mediabunny/prores": "^1.56.3"
38
+ "@mediabunny/prores": "^1.57.0"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "mediabunny": "^1.45.0"
package/src/index.ts CHANGED
@@ -62,8 +62,8 @@ export let _serverOptions: MediabunnyServerOptions = {};
62
62
 
63
63
  /**
64
64
  * Registers video and audio decoders and encoders for all codecs, using FFmpeg's libavcodec under the hood.
65
- * Additionally, a custom `VideoSample` transformer based on libavfilter is registered to enable resizing, rotation and
66
- * cropping of video frames.
65
+ * Additionally, a custom `VideoSample` transformer based on libavfilter is registered to enable resizing, rotation,
66
+ * flipping and cropping of video frames.
67
67
  *
68
68
  * Make sure to call this function before interacting with Mediabunny.
69
69
  *
@@ -233,7 +233,7 @@ export const transformVideoSample = async (
233
233
  await copyVideoSampleToAvFrame(sample, srcFrame, null);
234
234
  }
235
235
 
236
- // Build the filter chain. Order: square-pixel normalize -> rotate -> crop -> resize-with-fit.
236
+ // Build the filter chain. Order: square-pixel normalize -> rotate -> flip -> crop -> resize-with-fit.
237
237
  const chain: string[] = [];
238
238
 
239
239
  if (sample.squarePixelWidth !== sample.codedWidth || sample.squarePixelHeight !== sample.codedHeight) {
@@ -249,6 +249,10 @@ export const transformVideoSample = async (
249
249
  chain.push('transpose=2');
250
250
  }
251
251
 
252
+ if (description.flip) {
253
+ chain.push('hflip');
254
+ }
255
+
252
256
  chain.push(`crop=${Math.round(description.crop.width)}:${Math.round(description.crop.height)}`
253
257
  + `:${Math.round(description.crop.left)}:${Math.round(description.crop.top)}`);
254
258
 
@@ -304,7 +308,9 @@ export const transformVideoSample = async (
304
308
  return new VideoSample(new AvFrameVideoSampleResource(dstFrame), {
305
309
  timestamp: sample.timestamp,
306
310
  duration: sample.duration,
307
- rotation: 0, // baked in by the filter graph
311
+ // Baked in by the filter graph:
312
+ rotation: 0,
313
+ flip: false,
308
314
  });
309
315
  } finally {
310
316
  graph.free();