Starts recording audio from the specified device using ffmpeg and stops recording after a specified number of seconds of silence
pip install ffmpegaudiorecord
Tested against Windows 10 / Python 3.10 / Anaconda
The function first checks to see if the ffmpegexe path is in the system path. If not, it adds the path to the system path.
Next, the function gets the list of available audio devices using the get_all_devices function from the
ffmpegdevices module. It then tries to find the audio device that matches the audiodevice argument.
If no match is found, the function raises an exception.
The function then starts a new ffmpeg process to record audio from the specified device.
It creates a temporary file to store the recorded audio.
The function then enters a loop that reads the recorded audio from the temporary file and checks for silence.
If the audio is silent for a specified number of seconds, the function stops recording and returns the recorded
audio as an AudioSegment object. Any silence at the beginning is ignored.
Args:
ffmpegexe: The path to the ffmpeg executable.
audiodevice: The ID or name of the audio device to record from.
silent_seconds_stop: The number of seconds of silence after which recording will stop.
silence_threshold: The audio level below which silence is considered to have occurred.
Returns:
The recorded audio as an AudioSegment object.
from ffmpegaudiorecord import start_recording
audio_data = start_recording(
ffmpegexe = r"C:\ffmpeg\ffmpeg.exe", audiodevice=1, silent_seconds_stop=3, silence_threshold=-30)
audio_data.export("c:\\bababababa.wav")
Metadata
Release files for ffmpegaudiorecord 0.11
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 |
|---|---|---|---|---|
| ffmpegaudiorecord-0.11.tar.gz | 5.8 kB | Without provenance | Details for ffmpegaudiorecord-0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ffmpegaudiorecord-0.11-py3-none-any.whl | Python 3 | none | any | Details for ffmpegaudiorecord-0.11-py3-none-any.whl |
Total release size: 13.6 kB
Release files / ffmpegaudiorecord-0.11.tar.gz
| Download URL | ffmpegaudiorecord-0.11.tar.gz |
|---|---|
| Size | 5.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8388ee8353e7b66d2b4aa08b396dfb2116ea27fe6fdb3506e4a26139d2beaf92
|
|
BLAKE2b-256 checksum How to use checksums |
db8aba98e85e2ea36e6ed87c9ca67bd0f1bd7cb4c1b08f71a279523138b2cf1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Release files / ffmpegaudiorecord-0.11-py3-none-any.whl
| Download URL | ffmpegaudiorecord-0.11-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
88bb8e62fa8ca319864e81f4eab6bb1515fd83007be5864a9d7045ed687c93ba
|
|
BLAKE2b-256 checksum How to use checksums |
05ae12d5556a849832f78c74f420dc4af4402f77946943faa0bc4109cfb3019e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.10
|
Security for ffmpegaudiorecord 0.11
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.