ffmpegaudiorecord


Nameffmpegaudiorecord JSON
Version 0.11 PyPI version JSON
download
home_pagehttps://github.com/hansalemaos/ffmpegaudiorecord
SummaryStarts recording audio from the specified device using ffmpeg and stops recording after a specified number of seconds of silence
upload_time2023-08-06 17:41:53
maintainer
docs_urlNone
authorJohannes Fischer
requires_python
licenseMIT
keywords ffmpeg audio record
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# 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 

```python
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")
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hansalemaos/ffmpegaudiorecord",
    "name": "ffmpegaudiorecord",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "ffmpeg,audio,record",
    "author": "Johannes Fischer",
    "author_email": "aulasparticularesdealemaosp@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/db/8a/ba98e85e2ea36e6ed87c9ca67bd0f1bd7cb4c1b08f71a279523138b2cf1f/ffmpegaudiorecord-0.11.tar.gz",
    "platform": null,
    "description": "\r\n# Starts recording audio from the specified device using ffmpeg and stops recording after a specified number of seconds of silence\r\n\r\n## pip install ffmpegaudiorecord \r\n\r\n#### Tested against Windows 10 / Python 3.10 / Anaconda \r\n\r\n```python\r\nThe function first checks to see if the ffmpegexe path is in the system path. If not, it adds the path to the system path.\r\n\r\nNext, the function gets the list of available audio devices using the get_all_devices function from the\r\nffmpegdevices module. It then tries to find the audio device that matches the audiodevice argument.\r\nIf no match is found, the function raises an exception.\r\n\r\nThe function then starts a new ffmpeg process to record audio from the specified device.\r\nIt creates a temporary file to store the recorded audio.\r\nThe function then enters a loop that reads the recorded audio from the temporary file and checks for silence.\r\nIf the audio is silent for a specified number of seconds, the function stops recording and returns the recorded\r\naudio as an AudioSegment object. Any silence at the beginning is ignored.\r\n\r\nArgs:\r\n\tffmpegexe: The path to the ffmpeg executable.\r\n\taudiodevice: The ID or name of the audio device to record from.\r\n\tsilent_seconds_stop: The number of seconds of silence after which recording will stop.\r\n\tsilence_threshold: The audio level below which silence is considered to have occurred.\r\n\r\nReturns:\r\n\tThe recorded audio as an AudioSegment object.\r\n\r\n\r\nfrom ffmpegaudiorecord import start_recording\r\naudio_data = start_recording(\r\nffmpegexe = r\"C:\\ffmpeg\\ffmpeg.exe\", audiodevice=1, silent_seconds_stop=3, silence_threshold=-30)\r\naudio_data.export(\"c:\\\\bababababa.wav\")\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Starts recording audio from the specified device using ffmpeg and stops recording after a specified number of seconds of silence",
    "version": "0.11",
    "project_urls": {
        "Homepage": "https://github.com/hansalemaos/ffmpegaudiorecord"
    },
    "split_keywords": [
        "ffmpeg",
        "audio",
        "record"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "05ae12d5556a849832f78c74f420dc4af4402f77946943faa0bc4109cfb3019e",
                "md5": "f21dd6ae1a2eb0fc04540f6ecb484e9f",
                "sha256": "88bb8e62fa8ca319864e81f4eab6bb1515fd83007be5864a9d7045ed687c93ba"
            },
            "downloads": -1,
            "filename": "ffmpegaudiorecord-0.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f21dd6ae1a2eb0fc04540f6ecb484e9f",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7753,
            "upload_time": "2023-08-06T17:41:52",
            "upload_time_iso_8601": "2023-08-06T17:41:52.739296Z",
            "url": "https://files.pythonhosted.org/packages/05/ae/12d5556a849832f78c74f420dc4af4402f77946943faa0bc4109cfb3019e/ffmpegaudiorecord-0.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "db8aba98e85e2ea36e6ed87c9ca67bd0f1bd7cb4c1b08f71a279523138b2cf1f",
                "md5": "949a926b14fc8a03e47258e1ac6e8e56",
                "sha256": "8388ee8353e7b66d2b4aa08b396dfb2116ea27fe6fdb3506e4a26139d2beaf92"
            },
            "downloads": -1,
            "filename": "ffmpegaudiorecord-0.11.tar.gz",
            "has_sig": false,
            "md5_digest": "949a926b14fc8a03e47258e1ac6e8e56",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 5849,
            "upload_time": "2023-08-06T17:41:53",
            "upload_time_iso_8601": "2023-08-06T17:41:53.884962Z",
            "url": "https://files.pythonhosted.org/packages/db/8a/ba98e85e2ea36e6ed87c9ca67bd0f1bd7cb4c1b08f71a279523138b2cf1f/ffmpegaudiorecord-0.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-06 17:41:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hansalemaos",
    "github_project": "ffmpegaudiorecord",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "ffmpegaudiorecord"
}
        
Elapsed time: 0.11669s