Skip to content

🎥 Make videos programmatically with React

change `setFrameRange` to `setRange` & `getRange`

Shankhadeep Dey04f9ca6f5832
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index 566eb50e70..3a9dcaba79 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -40,7 +40,7 @@ export const parseCommandLine = () => {
Config.Rendering.setConcurrency(parsedCli.concurrency);
}
if (parsedCli.range) {
- Config.Rendering.setFrameRange(parsedCli.range);
+ Config.Rendering.setRange(parsedCli.range);
}
if (parsedCli.png) {
console.warn(
diff --git a/packages/cli/src/render.tsx b/packages/cli/src/render.tsx
index a1f9d8f03a..3f0f4ff3a2 100644
--- a/packages/cli/src/render.tsx
+++ b/packages/cli/src/render.tsx
@@ -34,7 +34,7 @@ export const render = async () => {
const parallelism = Internals.getConcurrency();
const shouldOutputImageSequence = Internals.getShouldOutputImageSequence();
const userCodec = Internals.getOutputCodecOrUndefined();
- const frameRange = Internals.getFrameRange();
+ const frameRange = Internals.getRange();
if (shouldOutputImageSequence && userCodec) {
console.error(
'Detected both --codec and --sequence (formerly --png) flag.'
diff --git a/packages/core/src/config/index.ts b/packages/core/src/config/index.ts
index a10a955959..c3e38103ae 100644
--- a/packages/core/src/config/index.ts
+++ b/packages/core/src/config/index.ts
@@ -13,7 +13,7 @@ import {
import {setOverwriteOutput} from './overwrite';
import {PixelFormat, setPixelFormat} from './pixel-format';
import {setQuality} from './quality';
-import {FrameRange, setFrameRange} from './range';
+import {FrameRange, setRange} from './range';
export const Config = {
Bundling: {
@@ -48,7 +48,7 @@ export const Config = {
* PNG is slower, but supports transparency.
*/
setImageFormat,
- setFrameRange,
+ setRange,
},
Output: {
/**
diff --git a/packages/core/src/config/range.ts b/packages/core/src/config/range.ts
index 502643d586..35070d23bf 100644
--- a/packages/core/src/config/range.ts
+++ b/packages/core/src/config/range.ts
@@ -2,7 +2,7 @@ export type FrameRange = number[] | null;
let range: FrameRange = null;
-export const setFrameRange = (newFrameRange: string | number) => {
+export const setRange = (newFrameRange: string | number) => {
if (typeof newFrameRange === 'number') {
range = [newFrameRange];
}
@@ -31,4 +31,4 @@ export const setFrameRange = (newFrameRange: string | number) => {
}
};
-export const getFrameRange = () => range;
+export const getRange = () => range;
diff --git a/packages/core/src/internals.ts b/packages/core/src/internals.ts
index 6c27047653..d96c042bcf 100644
--- a/packages/core/src/internals.ts
+++ b/packages/core/src/internals.ts
@@ -37,7 +37,7 @@ import {
validateSelectedPixelFormatAndCodecCombination,
} from './config/pixel-format';
import {getQuality} from './config/quality';
-import {getFrameRange} from './config/range';
+import {getRange} from './config/range';
import * as perf from './perf';
import {getCompositionName, getIsEvaluation, getRoot} from './register-root';
import {RemotionRoot} from './RemotionRoot';
@@ -60,7 +60,7 @@ export const Internals = {
getIsEvaluation,
getPixelFormat,
getConcurrency,
- getFrameRange,
+ getRange,
getShouldOverwrite,
getOutputCodecOrUndefined,
getWebpackOverrideFn,
diff --git a/packages/docs/docs/cli.md b/packages/docs/docs/cli.md
index 7403113848..325f53ab19 100644
--- a/packages/docs/docs/cli.md
+++ b/packages/docs/docs/cli.md
@@ -24,7 +24,7 @@ Besides choosing a video and output location with the command line arguments, th
- `--codec`: [`h264` or `h265` or `png` or `vp8` or `vp9`](config#setoutputformat). If you don't supply `--codec`, it will use the H.264 encoder. Available since v1.4.
- `--crf`: [To set Constant Rate Factor (CRF) of the output](config#setcrf). Minimum 0. Use this rate control mode if you want to keep the best quality and care less about the file size. Available since v1.4.
- `--browser-executable`: [Path to a Chrome executable](config#setbrowserexecutable). If not specified and Remotion cannot find one, it will download one during rendering. Available since v1.5.
-- `--range`: [To select frame range](config#setframerange).`--range=1-10` (To select frame from 1 to 10) or <br/>`--range=50` (To select only 50th frame).
+- `--range`: [To select frame range](config#setrange).`--range=1-10` (To select frame from 1 to 10) or <br/>`--range=50` (To select only 50th frame).
:::info
If you don't feel like passing command line flags every time, consider creating a `remotion.config.ts` [config file](config).
diff --git a/packages/docs/docs/config.md b/packages/docs/docs/config.md
index 6be5e607c9..91320e0055 100644
--- a/packages/docs/docs/config.md
+++ b/packages/docs/docs/config.md
@@ -68,17 +68,17 @@ Config.Rendering.setImageFormat('png')
The [command line flag](cli) `--image-format` will take precedence over this option.
-### setFrameRange()
+### setRange()
To render a still frame or a range of frames. Which can be helpful to generate humbnails and stills.
```tsx
-Config.Rendering.setFrameRange(90); //to select only 90th frame
+Config.Rendering.setRange(90); //to select only 90th frame
```
or
```tsx
-Config.Rendering.setFrameRange('10-20'); //To select frames from 10 to 20
+Config.Rendering.setRange('10-20'); //To select frames from 10 to 20
```
### setQuality()