- Notifications
You must be signed in to change notification settings - Fork7
This is a C++ based FFmpeg Encoder/Decoder for Python 3.6+ & numpy 1.19+. Both Linux & Win versions are provided. Theoretically you do not need to install FFmpeg for using this library.
License
cainmagi/FFmpeg-Encoder-Decoder-for-Python
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a mpegCoder adapted from FFmpeg & Python-c-api. Using it you could get access to processing video easily. Just use it as a common module in python like this.
importmpegCoder
Branch | Description |
---|---|
master 🔗 | The source project ofmpegCoder , Windows version. |
master-linux 🔗 | The source project ofmpegCoder , Linux version. |
example-client-check 🔗 | A testing project of the online video stream demuxing. |
example-client-player 🔗 | A testing project of the simple online video stream player. |
The following instructions are used for building the project on Windows with Visual Studio 2019.
Clone the
master
branch which only contains the codes ofmpegCoder
:git clone --single-branch -b master-linux https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python.git
Install the pre-requisite packages. The following script could be used by ubuntu or debian. If users are using other Linux distribution, they should install
gcc
andg++
by themselves.chmod +rwx ./apt-requirements.sh./apt-requirements.sh
We strongly suggest that users should also install the python dependencies (optional):
python -m pip install -r requirements.txt
Get the shared version of the Linux FFMpeg. We support three different approaches for this step:
Build the shared libs of FFMpeg from the source codes by yourself. We providea compiling script 📃 in the deps branch. You could download and build it by the following commands:
mkdir -p /appschmod +rwx /appscurl -O https://raw.githubusercontent.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/deps/install-ffmpeg-5_0.shchmod +rwx install-ffmpeg-5_0.sh./install-ffmpeg-5_0.sh --all --nvcuda
After running this script, the FFMpeg with most of the dependencies would be complied along with the shared libraries. Then you could replace the FFMpeg path in the
setup.py
byFFMPEG_DIR='/apps/build/ffmpeg-5.0'
Download the pre-built dependencies. These dependencies are built by myself. You could download the archivehere 📦. The files need to be extracted to
./dependencies
:cd FFmpeg-Encoder-Decoder-for-Pythonmkdir -p dependencieswget -O- https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/releases/download/deps-3.2.0/dep-linux-ffmpeg_5_0.tar.xz| tar xJ -C"./dependencies"
The dependencies could be also downloaded by the automatic script, you just need to run
python webtools.py
This script requires users to install
urllib3
. Thetqdm
is also recommended to be installed.
Build
mpegCoder
by running the following script. The built file would be stored in./build
. If you has not fetched the dependencies in the step 2, running thesetup.py
may trigger an event for fetching the online dependencies.python setup.py build
Rename the built module as
mpegCoder.so
, then you could import it in the same directory. If you have built FFMpeg by our script, you do not need any other dependencies when importing the libs. However, if not, you may need to downloadthe lib dependencies 📦 and add thelib
folder to yourLD_LIBRARY_PATH
:mkdir -p /apps/ffmpeg-5.0cd /apps/ffmpeg-5.0wget -O- https://github.com/cainmagi/FFmpeg-Encoder-Decoder-for-Python/releases/download/deps-3.2.0/so-linux-ffmpeg_5_0.tar.xz| tar xJ -C"."echo"export LD_LIBRARY_PATH=/apps/ffmpeg-5.0/lib:\$LD_LIBRARY_PATH">>~/.bashrcexport LD_LIBRARY_PATH=/apps/ffmpeg-5.0/lib:$LD_LIBRARY_PATH
Running
mpegCoder
requiresGLIBC>=2.29
. This requirement is not satisfied in some cases. However, if you have built FFMpeg by our script, the requirement would be fulfilled (i.e. you could skip this step). If users are using our pre-built dependencies, users may need to solve this problem byln -sf /apps/ffmpeg-5.0/lib-fix/libm-2.31.so /lib/x86_64-linux-gnu/libm.so.6
Has been moved to📑 CHANGELOG.md
Current FFMpeg version is5.0
.
Dependency | Version |
---|---|
libavcodec | 59.18.100.0 |
libavformat | 59.16.100.0 |
libavutil | 57.17.100.0 |
libswresample | 4.3.100.0 |
libswscale | 6.4.100.0 |
About
This is a C++ based FFmpeg Encoder/Decoder for Python 3.6+ & numpy 1.19+. Both Linux & Win versions are provided. Theoretically you do not need to install FFmpeg for using this library.
Topics
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.