Base
Audio extraction processor family.
AudioExtractionProcessor()
Bases: BackendSelectableProcessor[Attachment, Attachment], ABC
Family base for extracting audio tracks from video attachments.
This class serves as a unified entry point for audio extraction operations. It automatically routes requests to the most appropriate, available backend implementation based on your system environment.
Why use this base class?
- Portability: Your code will run regardless of which underlying libraries are installed on the host machine.
- Simplicity: No need to handle fallback logic or conditional imports yourself.
- Future-proofing: New backends can be added to the library without requiring changes to your application code.
Usage Example
from gllm_multimodal.media_toolkit.processor.audio_extraction_processor import AudioExtractionProcessor
from gllm_inference.schema import Attachment
# Instantiates the best available backend automatically
processor = AudioExtractionProcessor.build()
attachment = Attachment(url="file:///path/to/video.mp4")
audio_attachment = processor(attachment)
from gllm_multimodal.media_toolkit.processor.audio_extraction_processor import AudioExtractionProcessor
from gllm_inference.schema import Attachment
# Explicitly force the ffmpeg backend
processor = AudioExtractionProcessor.build(backend="ffmpeg")
attachment = Attachment(url="file:///path/to/video.mp4")
audio_attachment = processor(attachment)
from gllm_multimodal.media_toolkit.processor.audio_extraction_processor import AudioExtractionProcessor
from gllm_inference.schema import Attachment
# Explicitly force the moviepy backend
processor = AudioExtractionProcessor.build(backend="moviepy")
attachment = Attachment(url="file:///path/to/video.mp4")
audio_attachment = processor(attachment)