AIORTC uses the PyAV bindings for H264 decoding. We build the hwaccel
branch (gpu accelerators) of this library from source:
git clone [email protected]:PyAV-Org/PyAV
cd PyAV
git checkout hwaccel
# Installs all dependecies including ffmpeg
source scripts/activate.sh
./scripts/build-deps
make
In your aiortc project you need to replace the h264
with h264_cuvid
when specifying the codec: https://github.com/aiortc/aiortc/blob/01ff209cc38e887edeb05cba1845cf458b31a0ac/src/aiortc/codecs/h264.py#L106
In the sample h264 code parser.py
, it runs h264 decoder on a sample ffmpeg video on both cpu (h264
) and gpu(h264_cuvid
).
*** This forked repo contains the necessary changes for running both encoder and decoder on gpu: https://github.com/erfaneshrati/aiortc
If you faced configure: error: libx264 not found
then the following solves the issue:
sudo apt-get install yasm libvpx libx264