Description
This library uses ffmpeg to extract an audio track from a video file. The audio can also be separated by chapter, if the chapters are annotated in the video.
Installation
$ pip3 install video2audio
The ffmpeg and ffprobe commands must be available on your system (and PATH).
Usage
from video2audio import AVFile
f = AVFile('/path/to/some/movie.mkv')
# Extract the entire audio track as a single mp3:
f.extract_audio('/path/to/some/audio_only.mp3', chapter=None)
# Extract the second, entire audio track as a single mp3:
f.extract_audio('/path/to/some/audio_only_second_stream.mp3', chapter=None, stream=1)
# Extract each chapter to a separate mp3 file:
f.extract_all_chapters_audio('/path/to/chapter/outputs/')
# Extract each chapter to a separate mp3 file, manually naming them:
f.extract_all_chapters_audio(
'/path/to/chapter/outputs/',
output_filenames=['ch1_title.mp3', 'ch2_title.mp3', 'ch3_title.mp3']
)
# Extract only chapter number 12 (or 13, using 1-indexing):
chapter_list = f.get_chapters()
f.extract_audio('single_chapter.mp3', chapter=chapter_list[12])
CLI
Extract the second audio track using the command line tool:
$ video2audio -t 1 /path/to/some/movie.mkv /path/to/chapter/outputs/
video2audio -h will explain the other options.
TODO
- Add tests
- Check for injection / missing escapes in subprocess
Metadata
Release files for video2audio 2023.1.14
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| video2audio-2023.1.14.tar.gz | 5.8 kB | Without provenance | Details for video2audio-2023.1.14.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| video2audio-2023.1.14-py3-none-any.whl | Python 3 | none | any | Details for video2audio-2023.1.14-py3-none-any.whl |
Total release size: 13.3 kB
Release files / video2audio-2023.1.14.tar.gz
| Download URL | video2audio-2023.1.14.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
85a6a01efd9471fc108c9552ea2cf2ef63c043d3d27e2ba65cdcc62ae72eb463
|
|
BLAKE2b-256 checksum How to use checksums |
95b251e66ab63b8575d2f212a6cc732ff575500e22f857444d96267833a5a163
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Release files / video2audio-2023.1.14-py3-none-any.whl
| Download URL | video2audio-2023.1.14-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d04ee172d7658f429befe2160c26cff700b79db7e5622c61524af66c91aea9cc
|
|
BLAKE2b-256 checksum How to use checksums |
925b8995469d45d78548a331d622f91b1beb9d69d4b1dca0f2623fcb7e7873b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.6
|
Security for video2audio 2023.1.14
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.