Extract audio
The extract-audio command is designed to detach the audio component from a video file. Whether you're repurposing the audio content of videos for podcasts, transcription, or other audio-centric endeavors, this tool provides a seamless experience.
Features:
- Dual Audio Extraction with
--eqFlag: - When you use the
--eqflag, the command produces two distinct audio files:- A pure audio file extracted directly from the video.
- An enhanced audio file where compression is applied, and the volume is amplified by 10 decibels.
-
This gives users the flexibility to have both the raw and enhanced versions for various applications.
-
Default Output: If an
output_fileisn't specified, the extracted audio will default tooutput.wav. If--eqis used, the enhanced version might have a suffix or different naming to differentiate it from the raw audio. -
Opt-Out of Audio Enhancement: If you only want the raw, unaltered audio without the enhanced version, simply use the
--no-eqflag.
Example Usage:
To extract both raw and enhanced audio from a video named presentation.mp4:
vmh extract-audio presentation.mp4 --eq
For raw audio extraction without any enhancement:
vmh extract-audio presentation.mp4 --no-eq
--help Flag Output:
For a detailed breakdown of the available options and arguments for the extract-audio command:
vmh extract-audio --help
Usage: vmh extract-audio [OPTIONS] VIDEO_FILE [OUTPUT_FILE]
Extracts the audio from a video.
â•─ Arguments ──────────────────────────────────────────────────────────────────╮
│ * video_file PATH [default: None] [required] │
│ output_file [OUTPUT_FILE] [default: output.wav] │
╰──────────────────────────────────────────────────────────────────────────────╯
â•─ Options ────────────────────────────────────────────────────────────────────╮
│ --eq --no-eq Add compression and 10db of extracted audio │
│ [default: eq] │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
API for developers
Extract audio from vÃdeo.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video_file
|
str
|
Video to extract audio |
required |
output_file
|
str
|
Output file path |
required |
eq
|
bool
|
Equalization |
True
|
Returns:
| Type | Description |
|---|---|
Path | tuple[Path, Path]
|
A audio Path |
Source code in videomaker_helper/audio.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |