For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /get-started.md).
Python class
GeneratedMediaStore
GeneratedMediaStore
class max.serve.media.GeneratedMediaStore(root_dir, *, max_storage_bytes=536870912)
Bases: object
Stores generated media files for later download via HTTP.
Creating a store sets up the per-category media directories and the cache accounting that backs eviction.
-
Parameters:
-
- root_dir (Path) – The root directory under which the per-category media subdirectories are created.
- max_storage_bytes (int) – The maximum total size of stored assets, in bytes, defaulting to 512 MiB. Older assets are evicted to make room for new ones.
-
Raises:
-
ValueError – If
max_storage_bytesis not greater than zero.
encode_video_content()
encode_video_content(content, frames_per_second)
Encode raw in-memory frames into an MP4 byte payload.
-
Parameters:
-
- content (OutputVideoContent)
- frames_per_second (int)
-
Return type:
get_audio()
get_audio(audio_id)
Return a stored audio asset by id if it still exists on disk.
-
Parameters:
-
audio_id (str)
-
Return type:
-
StoredMediaAsset | None
get_image()
get_image(image_id)
Return a stored image asset by id if it still exists on disk.
-
Parameters:
-
image_id (str)
-
Return type:
-
StoredMediaAsset | None
get_video()
get_video(video_id)
Return a stored video asset by id if it still exists on disk.
-
Parameters:
-
video_id (str)
-
Return type:
-
StoredMediaAsset | None
save_audio_content()
async save_audio_content(content)
Encode a raw waveform to WAV bytes and persist the result.
-
Raises:
-
ValueError – If the content carries no raw samples, or names a container this store cannot write.
-
Parameters:
-
content (OutputAudioContent)
-
Return type:
save_image_content()
async save_image_content(content)
Persist inline image content to disk and register it in the cache.
-
Parameters:
-
content (OutputImageContent)
-
Return type:
save_video_content()
async save_video_content(content, frames_per_second)
Encode raw video frames to MP4 bytes and persist the result.
-
Parameters:
-
- content (OutputVideoContent)
- frames_per_second (int)
-
Return type: