{"id":27003066,"url":"https://github.com/riad-azz/audio-extract","last_synced_at":"2025-04-04T05:15:12.034Z","repository":{"id":153993927,"uuid":"573066643","full_name":"riad-azz/audio-extract","owner":"riad-azz","description":"audio-extract is a Python library that allows you to extract audio from video files and trim the audio according to your needs.","archived":false,"fork":false,"pushed_at":"2024-09-25T23:44:05.000Z","size":26,"stargazers_count":21,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-04T19:04:13.688Z","etag":null,"topics":["audio","audio-applications","audio-library","extract-audio","extract-audio-from-video","pypi","pypi-package","python","python-ffmpeg","python3","video"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/audio-extract/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riad-azz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-01T16:16:32.000Z","updated_at":"2025-02-02T13:13:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"13441190-0079-4087-86f7-571d8402f7c8","html_url":"https://github.com/riad-azz/audio-extract","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riad-azz%2Faudio-extract","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riad-azz%2Faudio-extract/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riad-azz%2Faudio-extract/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riad-azz%2Faudio-extract/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riad-azz","download_url":"https://codeload.github.com/riad-azz/audio-extract/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247123061,"owners_count":20887261,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","audio-applications","audio-library","extract-audio","extract-audio-from-video","pypi","pypi-package","python","python-ffmpeg","python3","video"],"created_at":"2025-04-04T05:15:11.474Z","updated_at":"2025-04-04T05:15:12.021Z","avatar_url":"https://github.com/riad-azz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Audio Extract\n\naudio-extract is a Python library that allows you to extract audio from video files and trim the audio according to your\nneeds\n\n## Description\n\naudio-extract is a Python library that allows you to extract audio from video files and trim the audio according to your\nneeds. You can use it to create audio clips from movies, podcasts, or any other video source. It supports various audio\nand video formats, such as MP3, WAV, OGG, MP4, AVI, and MKV.\n\n## Installing\n\n- Install from Pypi:\n\n```bash\npip install audio-extract\n```\n\n- Install from GitHub:\n\n```bash\npip install git+https://github.com/riad-azz/audio-extract.git\n```\n\n## Getting Started\n\n### AudioExtract - Info\n\nThe application is pretty straightforward all you need is to import the `extract_audio` function. The function args:\n\n* **`input_path`** : The path to the input (Video/Audio) file.\n\n* **`output_path`**: The path to the extracted audio file. The default value is `./audio.mp3`.\n\n* **`output_format`**: The format of the extracted audio. The default value is `mp3`.\n\n* **`start_time`**: The start time of the output in `HH:MM:SS` or `MM:SS` format. The default value is `00:00:00`.\n\n* **`duration`**: The duration of the extracted audio in seconds _(float)_. The default value is  `None` which means\n  full audio will be extracted if `start_time` is set to `00:00:00`.\n\n* **`overwrite`**: Whether to overwrite the output file if it already exists or not. The default value is `False`.\n\nThe supported file formats:\n\n- Supported audio formats : `WAV, OGG, MP3, AAC, FLAC, M4A, OGA, OPUS`\n\n- Supported video formats : `MP4, MKV, WEBM, FLV, AVI, MOV, WMV, M4V`\n\n### Executing the program\n\n#### Extract full audio:\n\n```python\nfrom audio_extract import extract_audio\n\nextract_audio(input_path=\"./video.mp4\", output_path=\"./audio.mp3\")\n```\n\nThis will create a `mp3` file called `audio.mp3` that contains the full audio of the video file `video.mp4`.\n\n#### Extract sub clip audio:\n\n```python\nfrom audio_extract import extract_audio\n\nextract_audio(input_path=\"./video.mp4\",\n              output_path=\"./audio.mp3\",\n              start_time=\"00:30\",\n              overwrite=True)\n```\n\nThis will create a `mp3` file called `audio.mp3` that starts after the first 30 seconds of the video file `video.mp4`\nand will overwrite `audio.mp3` file if it already exists.\n\n#### Extract sub clip audio with custom duration\n\n```python\nfrom audio_extract import extract_audio\n\nextract_audio(input_path=\"./video.mp4\",\n              output_path=\"./audio.mp3\",\n              start_time=\"00:25\",\n              duration=15.0)\n```\n\nThis will convert video file `video.mp4` to a mp3 file starting from `00:25` to `00:40`\ncalled `audio.mp3` that will have a duration of `00:15`.\n\n#### Trim audio:\n\n```python\nfrom audio_extract import extract_audio\n\nextract_audio(input_path=\"./audio.mp3\",\n              output_path=\"./new_audio.mp3\",\n              start_time=\"00:05\",\n              duration=20.0)\n```\n\nThis will trim the `audio.mp3` file starting from `00:05` to `00:25` to a `mp3` file called `new_audio.mp3` that will\nhave a duration of `00:20`.\n\n## Running Command-Line-Interface\n\n### CLI Arguments\n\nThe following cli arguments are supported:\n\n* **`--input`** or **`-i`** : The path to the input (Video/Audio) file.\n\n* **`--output`** or **`-o`** : The path to the extracted audio file. The default value is `./audio.mp3`.\n\n* **`--format`** or **`-f`** : The format of the extracted audio. The default value is `mp3`.\n\n* **`--start-time`** or **`-st`** : The start time of the output in `HH:MM:SS` or `MM:SS` format. The default value\n  is `00:00:00`.\n\n* **`--duration`** or **`-d`** : The duration of the extracted audio in seconds _(float)_, The default value is `None`\n  which means full audio will be extracted if `start_time` is set to `00:00:00`.\n\n* **`--overwrite`** or **`-ow`** : Whether to overwrite the output file if it already exists or not. The default value\n  is `False`.\n\n### CLI Usage Example:\n\nHere is an example of using the CLI to extract audio:\n\n```bash\naudio-extract --input=\"./video.mp4\" --output=\"./audios/extracted_audio.wav\" --format=\"wav\"\n```\n\nThis command will extract the full audio starting from `video.mp4` to a `wav` file called `extracted_audio.wav` and will\nbe saved to the folder `./audios/`. The folder will be automatically created if it doesn't exist.\n\n## Authors\n\nRiadh Azzoun - [@riad-azz](https://github.com/riad-azz)\n\n## License\n\nThis project is licensed under the [MIT] License - see the LICENSE.md file for details\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friad-azz%2Faudio-extract","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friad-azz%2Faudio-extract","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friad-azz%2Faudio-extract/lists"}