@remotion/renderer 3.0.9 → 3.0.10

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.
@@ -4,9 +4,10 @@ declare type FfmpegVolumeExpression = {
4
4
  eval: FfmpegEval;
5
5
  value: string;
6
6
  };
7
- export declare const ffmpegVolumeExpression: ({ volume, startInVideo, fps, }: {
7
+ export declare const ffmpegVolumeExpression: ({ volume, startInVideo, fps, trimLeft, }: {
8
8
  volume: AssetVolume;
9
9
  startInVideo: number;
10
+ trimLeft: number;
10
11
  fps: number;
11
12
  }) => FfmpegVolumeExpression;
12
13
  export {};
@@ -12,7 +12,7 @@ const FFMPEG_TIME_VARIABLE = 't';
12
12
  const ffmpegIfOrElse = (condition, then, elseDo) => {
13
13
  return `if(${condition},${then},${elseDo})`;
14
14
  };
15
- const ffmpegIsOneOfFrames = (frames, fps) => {
15
+ const ffmpegIsOneOfFrames = ({ frames, trimLeft, fps, }) => {
16
16
  const consecutiveArrays = [];
17
17
  for (let i = 0; i < frames.length; i++) {
18
18
  const previousFrame = frames[i - 1];
@@ -28,11 +28,11 @@ const ffmpegIsOneOfFrames = (frames, fps) => {
28
28
  const lastFrame = f[f.length - 1];
29
29
  const before = (firstFrame - 0.5) / fps;
30
30
  const after = (lastFrame + 0.5) / fps;
31
- return `between(${FFMPEG_TIME_VARIABLE},${before.toFixed(4)},${after.toFixed(4)})`;
31
+ return `between(${FFMPEG_TIME_VARIABLE},${(before + trimLeft).toFixed(4)},${(after + trimLeft).toFixed(4)})`;
32
32
  })
33
33
  .join('+');
34
34
  };
35
- const ffmpegBuildVolumeExpression = (arr, fps) => {
35
+ const ffmpegBuildVolumeExpression = (arr, delay, fps) => {
36
36
  if (arr.length === 0) {
37
37
  throw new Error('Volume array expression should never have length 0');
38
38
  }
@@ -40,13 +40,13 @@ const ffmpegBuildVolumeExpression = (arr, fps) => {
40
40
  // FFMpeg tends to request volume for frames outside the range
41
41
  // where the audio actually plays.
42
42
  // If this is the case, we just return volume 0 to clip it.
43
- return ffmpegIfOrElse(ffmpegIsOneOfFrames(arr[0][1], fps), String(arr[0][0]), String(0));
43
+ return ffmpegIfOrElse(ffmpegIsOneOfFrames({ frames: arr[0][1], trimLeft: delay, fps }), String(arr[0][0]), String(0));
44
44
  }
45
45
  const [first, ...rest] = arr;
46
46
  const [volume, frames] = first;
47
- return ffmpegIfOrElse(ffmpegIsOneOfFrames(frames, fps), String(volume), ffmpegBuildVolumeExpression(rest, fps));
47
+ return ffmpegIfOrElse(ffmpegIsOneOfFrames({ frames, trimLeft: delay, fps }), String(volume), ffmpegBuildVolumeExpression(rest, delay, fps));
48
48
  };
49
- const ffmpegVolumeExpression = ({ volume, startInVideo, fps, }) => {
49
+ const ffmpegVolumeExpression = ({ volume, startInVideo, fps, trimLeft, }) => {
50
50
  // If it's a static volume, we return it and tell
51
51
  // FFMPEG it only has to evaluate it once
52
52
  if (typeof volume === 'number') {
@@ -60,6 +60,7 @@ const ffmpegVolumeExpression = ({ volume, startInVideo, fps, }) => {
60
60
  volume: volume[0],
61
61
  startInVideo,
62
62
  fps,
63
+ trimLeft,
63
64
  });
64
65
  }
65
66
  // Otherwise, we construct an FFMPEG expression. First step:
@@ -81,7 +82,7 @@ const ffmpegVolumeExpression = ({ volume, startInVideo, fps, }) => {
81
82
  .map((key) => [Number(key), volumeMap[key]])
82
83
  .sort((a, b) => a[1].length - b[1].length);
83
84
  // Construct and tell FFMPEG it has to evaluate expression on each frame
84
- const expression = ffmpegBuildVolumeExpression(volumeArray, fps);
85
+ const expression = ffmpegBuildVolumeExpression(volumeArray, trimLeft, fps);
85
86
  return {
86
87
  eval: 'frame',
87
88
  value: `'${expression}'`,
@@ -28,6 +28,8 @@ const combineVideos = async ({ files, filelistDir, output, onProgress, numberOfF
28
28
  remotion_1.Internals.isAudioCodec(codec) ? null : 'copy',
29
29
  '-c:a',
30
30
  (0, get_audio_codec_name_1.getAudioCodecName)(codec),
31
+ codec === 'h264' ? '-movflags' : null,
32
+ codec === 'h264' ? 'faststart' : null,
31
33
  '-shortest',
32
34
  '-y',
33
35
  output,
File without changes
@@ -0,0 +1 @@
1
+ "use strict";
@@ -57,15 +57,13 @@ const prespawnFfmpeg = async (options) => {
57
57
  // -c:v is the same as -vcodec as -codec:video
58
58
  // and specified the video codec.
59
59
  ['-c:v', encoderName],
60
- ...[
61
- proResProfileName ? ['-profile:v', proResProfileName] : null,
62
- supportsCrf ? ['-crf', String(crf)] : null,
63
- ['-pix_fmt', pixelFormat],
64
- // Without explicitly disabling auto-alt-ref,
65
- // transparent WebM generation doesn't work
66
- pixelFormat === 'yuva420p' ? ['-auto-alt-ref', '0'] : null,
67
- ['-b:v', '1M'],
68
- ],
60
+ proResProfileName ? ['-profile:v', proResProfileName] : null,
61
+ supportsCrf ? ['-crf', String(crf)] : null,
62
+ ['-pix_fmt', pixelFormat],
63
+ // Without explicitly disabling auto-alt-ref,
64
+ // transparent WebM generation doesn't work
65
+ pixelFormat === 'yuva420p' ? ['-auto-alt-ref', '0'] : null,
66
+ ['-b:v', '1M'],
69
67
  '-y',
70
68
  options.outputLocation,
71
69
  ];
@@ -160,6 +160,7 @@ const spawnFfmpeg = async (options) => {
160
160
  pixelFormat === 'yuva420p' ? ['-auto-alt-ref', '0'] : null,
161
161
  ['-b:v', '1M'],
162
162
  ]),
163
+ codec === 'h264' ? ['-movflags', 'faststart'] : null,
163
164
  audioCodecName ? ['-c:a', audioCodecName] : null,
164
165
  // Ignore metadata that may come from remote media
165
166
  ['-map_metadata', '-1'],
@@ -11,6 +11,7 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
11
11
  volume,
12
12
  startInVideo,
13
13
  fps,
14
+ trimLeft,
14
15
  });
15
16
  // Avoid setting filters if possible, as combining them can create noise
16
17
  const chunkLength = durationInFrames / fps;
@@ -37,6 +38,8 @@ const stringifyFfmpegFilter = ({ trimLeft, trimRight, channels, startInVideo, vo
37
38
  .fill((startInVideoSeconds * 1000).toFixed(0))
38
39
  .join('|')}`,
39
40
  // set the volume if needed
41
+ // The timings for volume must include whatever is in atrim, unless the volume
42
+ // filter gets applied before atrim
40
43
  volumeFilter.value === '1'
41
44
  ? null
42
45
  : `volume=${volumeFilter.value}:eval=${volumeFilter.eval}`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.0.9",
3
+ "version": "3.0.10",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -20,10 +20,10 @@
20
20
  "url": "https://github.com/remotion-dev/remotion/issues"
21
21
  },
22
22
  "dependencies": {
23
- "@remotion/bundler": "3.0.9",
23
+ "@remotion/bundler": "3.0.10",
24
24
  "execa": "5.1.1",
25
25
  "puppeteer-core": "13.5.1",
26
- "remotion": "3.0.9",
26
+ "remotion": "3.0.10",
27
27
  "serve-handler": "6.1.3",
28
28
  "source-map": "^0.8.0-beta.0"
29
29
  },
@@ -60,5 +60,5 @@
60
60
  "publishConfig": {
61
61
  "access": "public"
62
62
  },
63
- "gitHead": "46fcf0f5b12f2ba861eac423a2891ef38242ceeb"
63
+ "gitHead": "3ae18de4dd2dda522e37a04c0a5c225f2a94e3a1"
64
64
  }