View all files | ||||
The aim of this project is to provide a simple decoder for video captured by a Raspberry Pi camera. At the time of this writing I only need H264 decoding, since a H264 stream is what the RPi software delivers. Furthermore flexibility to incorporate the decoder in larger python programs in various ways is desirable.
The code might also serve as example for libav and pybind11 usage.
You can do something like this
There are simple demo programs in the examples folder. display_frames.py is probably the one you want to take a look at.
For the example scripts
I tested it on
The suggested way to obtain ffmpeg is through vcpkg. Assuming all the setup including VC integration has been done, we can install the x64 libraries with
We can build the extension module with setuptools almost normally. However cmake is used internally and we have to let it know the search paths to our libs. Hence the additional --cmake-args argument with the toolchain file as per vcpkg instructions.
The -e option installs symlinks to the build directory. Useful for development. Leave it out otherwise.
Alternatively one can build the extension module manually with cmake. From the project directory:
Should be a matter of installing the libav or ffmpeg libraries. On Debian or Ubuntu:
And then running
in the project directory.
For Python 3. Switch to PyBind11. Module renamed from libh264decoder to h264decoder! Support installation via setuptools.
For Python 2.7. Depends on Boost Python. Project/Build file generation with CMake.
The code is published under the Mozilla Public License v. 2.0.