Skip to main content

staticFile() does not support relative paths

If you got the following error message:

staticFile() does not support relative paths. Instead, pass the name of a file that is inside the public/ folder.
staticFile() does not support relative paths. Instead, pass the name of a file that is inside the public/ folder.

You have tried to pass a relative path to staticFile():

❌ Relative path
tsx
import { staticFile } from "remotion";
staticFile("../public/image.png");
❌ Relative path
tsx
import { staticFile } from "remotion";
staticFile("../public/image.png");
❌ File should not have ./ prefix
tsx
import { staticFile } from "remotion";
staticFile("./image.png");
❌ File should not have ./ prefix
tsx
import { staticFile } from "remotion";
staticFile("./image.png");

Or you tried to pass an absolute path:

❌ File should not use absolute paths
tsx
import { staticFile } from "remotion";
staticFile("/Users/bob/remotion-project/public/image.png");
❌ File should not use absolute paths
tsx
import { staticFile } from "remotion";
staticFile("/Users/bob/remotion-project/public/image.png");

Or you tried to add a public/ fix which is unnecessary:

❌ File should not include the public/ prefix
tsx
import { staticFile } from "remotion";
staticFile("public/image.png");
❌ File should not include the public/ prefix
tsx
import { staticFile } from "remotion";
staticFile("public/image.png");

Instead, pass the name of the file that is inside the public folder directly:

✅ Filename
tsx
import { staticFile } from "remotion";
staticFile("image.png");
✅ Filename
tsx
import { staticFile } from "remotion";
staticFile("image.png");

See also