Conversion
conversion
¶
Defines the Modal GPU job for video conversion
video_conversion_job(vol_fp, vol_id, to_mp4_kwargs=None)
¶
Convert a video to MP4 inside a Modal GPU container
Encoder
The container probes NVENC and uses the on-device GPU pipeline only
when an encoder is present, falling back to CPU libx264 otherwise.
The data center compute GPUs (A100 / H100 / B200) have no
NVENC, so they convert on CPU
File Transfer
-
The input video is read out of the per-job ephemeral volume into a container-local temp directory
-
The container converts the video and the resulting MP4 is written back into the same volume
-
The job returns the output key so that the local runtime can stream the result out and save it
-
The temp directory is removed once the job finishes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vol_fp
|
str
|
Path of the input video inside the per-job ephemeral volume |
required |
vol_id
|
str
|
ID of the per-job ephemeral volume |
required |
to_mp4_kwargs
|
dict | None
|
Additional arguments for
|
None
|
Returns:
| Type | Description |
|---|---|
str
|
The Path of the converted MP4 inside the per-job ephemeral volume |
Raises:
| Type | Description |
|---|---|
ModalVolumeError
|
If the input or output can't be transferred through the volume |
FFmpegError
|
If any of the FFMPEG commands return a non-zero exit code |
ValueError
|
If the input doesn't exist or an invalid resolution is provided |
MissingFFmpegError
|
If the FFMPEG executable couldn't be located |
MissingFFprobeError
|
If the FFPROBE executable couldn't be located |
RuntimeError
|
If conversion produces no output |