mirror of
https://github.com/kkroening/ffmpeg-python.git
synced 2025-08-10 13:10:03 +08:00
Update FFmpeg installation instructions
This commit is contained in:
parent
228b491e50
commit
47f7870b08
31
README.md
31
README.md
@ -81,18 +81,11 @@ Real-world signal graphs can get a heck of a lot more complex, but `ffmpeg-pytho
|
||||
|
||||
## Installation
|
||||
|
||||
Before using ffmpeg-python, you need to have ffmpeg installed and in your PATH environment. You can install ffmpeg through the official website [here](https://ffmpeg.org/download.html). Once you have it installed, make sure the folder ffmpeg is located is set in your environment path. You can check if your environment path is set correctly by opening up a command window and typing this
|
||||
|
||||
```
|
||||
$ ffmpeg
|
||||
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
|
||||
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
|
||||
|
||||
```
|
||||
### Installing `ffmpeg-python`
|
||||
|
||||
The latest version of `ffmpeg-python` can be acquired via a typical pip install:
|
||||
|
||||
```
|
||||
```bash
|
||||
pip install ffmpeg-python
|
||||
```
|
||||
|
||||
@ -102,6 +95,24 @@ git clone git@github.com:kkroening/ffmpeg-python.git
|
||||
pip install -e ./ffmpeg-python
|
||||
```
|
||||
|
||||
> **Note**: `ffmpeg-python` makes no attempt to download/install FFmpeg, as `ffmpeg-python` is merely a pure-Python wrapper - whereas FFmpeg installation is platform-dependent/environment-specific, and is thus the responsibility of the user, as described below.
|
||||
|
||||
### Installing FFmpeg
|
||||
|
||||
Before using `ffmpeg-python`, FFmpeg must be installed and accessible via the `$PATH` environment variable.
|
||||
|
||||
There are a variety of ways to install FFmpeg, such as the [official download links](https://ffmpeg.org/download.html), or using your package manager of choice (e.g. `sudo apt install ffmpeg` on Debian/Ubuntu, `brew install ffmpeg` on OS X, etc.).
|
||||
|
||||
Regardless of how FFmpeg is installed, you can check if your environment path is set correctly by running the `ffmpeg` command from the terminal, in which case the version information should appear, as in the following example (truncated for brevity):
|
||||
|
||||
```
|
||||
$ ffmpeg
|
||||
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
|
||||
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
|
||||
```
|
||||
|
||||
> **Note**: The actual version information displayed here may vary from one system to another; but if a message such as `ffmpeg: command not found` appears instead of the version information, FFmpeg is not properly installed.
|
||||
|
||||
## [Examples](https://github.com/kkroening/ffmpeg-python/tree/master/examples)
|
||||
|
||||
When in doubt, take a look at the [examples](https://github.com/kkroening/ffmpeg-python/tree/master/examples) to see if there's something that's close to whatever you're trying to do.
|
||||
@ -206,7 +217,7 @@ When in doubt, refer to the [existing filters](https://github.com/kkroening/ffmp
|
||||
|
||||
**Why do I get an import/attribute/etc. error from `import ffmpeg`?**
|
||||
|
||||
Make sure you ran `pip install ffmpeg-python` and not `pip install ffmpeg` or `pip install python-ffmpeg`.
|
||||
Make sure you ran `pip install ffmpeg-python` and _**not**_ `pip install ffmpeg` (wrong) or `pip install python-ffmpeg` (also wrong).
|
||||
|
||||
**Why did my audio stream get dropped?**
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
import ffmpeg, time
|
||||
|
||||
#Setup for recording windows desktop to mp4 file
|
||||
process = (
|
||||
ffmpeg
|
||||
.input(format='gdigrab',framerate=30,filename="desktop")
|
||||
.output(crf="0",preset="ultrafast",filename="./output.mp4",c= "libx264" )
|
||||
.overwrite_output()
|
||||
)
|
||||
#Launch video recording
|
||||
process = process.run_async(pipe_stdin=True)
|
||||
|
||||
|
||||
#Let it record for 20 seconds
|
||||
time.sleep(20)
|
||||
|
||||
#Stop video recording
|
||||
process.communicate(str.encode("q")) #Equivalent to send a Q
|
||||
|
||||
# To be sure that the process ends I wait 3 seconds and then terminate de process (wich is more like kill -9)
|
||||
time.sleep(10)
|
||||
process.terminate()
|
Loading…
x
Reference in New Issue
Block a user