remotion-dev/remotion · error · std::io::Error
The codec is not a video codec
Error message
The codec is not a video codec
What it means
Thrown by get_video_metadata when the best video stream's decoder is not an ffmpeg video decoder (context.decoder().video() fails or yields a non-video codec). The metadata path requires a real video codec to read width/height/pixel format.
Source
Thrown at packages/compositor/rust/get_video_metadata.rs:334
};
// Return the video metadata
let metadata = VideoMetadata {
fps,
width: video.width(),
height: video.height(),
durationInSeconds,
codec: video_codec_name,
canPlayInVideoTag,
supportsSeeking,
colorSpace,
audioCodec: audio_codec_name,
audioFileExtension: audio_file_extension,
pixelFormat,
};
Ok(metadata)
} else {
return Err(std::io::Error::new(
ErrorKind::Other,
"The codec is not a video codec",
))?;
}
}
View on GitHub (pinned to 78fe4bb3fd)
Solutions
- Run `ffprobe -show_streams <file>` and check the selected video stream's codec_name and whether ffmpeg can decode it.
- Re-mux/re-encode the file so the primary video stream uses a supported codec.
- Rebuild ffmpeg with the required decoder (e.g. --enable-decoder=hevc).
Example fix
// before const meta = await getVideoMetadata(file); // after (CLI verification) // $ ffprobe -v error -select_streams v:0 -show_entries stream=codec_name -of csv=p=0 file // ensure it prints a real video codec (h264, hevc, vp9, av1), not mjpeg/png
Defensive patterns
Strategy: validation
Validate before calling
// CLI check before metadata call: // $ ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,codec_type -of csv=p=0 <file> // ensure codec_type=video and codec_name is a supported decoder
Type guard
null
Try / catch
match get_video_metadata(path) {
Ok(m) => m,
Err(e) if e.to_string().contains("not a video codec") => fallback_metadata(),
Err(e) => return Err(e),
} Prevention
- Confirm the primary video stream's codec is one ffmpeg can decode.
- Re-encode cover-art-only containers to a real video codec.
- Build ffmpeg with the decoders you need (hevc, av1, vp9).
When it happens
Trigger: The stream selected as 'best video' resolves to a codec context that cannot be opened as a video decoder — e.g. an attached-picture (mjpeg) stream, a data/overlay stream, or a codec unsupported by the linked ffmpeg.
Common situations: Probing a container with an embedded cover-art/album-art stream that ffmpeg ranks as the best video stream; using an ffmpeg build without the codec (e.g. hevc disabled); corrupted codec parameters in the header.
Related errors
- No video stream found in ${file_path}. Is this a video file?
- No audio stream found in '${input_path}'. Ensure the video c
- Not enough planes or linesizes
- Could not find audio stream in ${src}
- No frame found at position {} for source {} (original source
AI-assisted analysis of remotion-dev/remotion@78fe4bb3fd (2026-08-12).
Data as JSON: /api/errors/efa3dbeae4608709.
Report an issue: GitHub.