FFmpeg build with CUDA support for Ubuntu (especially for Google Colab) with pre-built required binaries.
Important: You have to change the runtime type and use GPU hardware accelerator. If you have not done it, check it below:
- Clone the repository
# You need to prepend a `!` to execute a shell command in Goole Colab or Jupyter
!git clone https://github.com/fritolays/colab-ffmpeg-cuda.git
- Copy all the pre-built binaries from
./colab-ffmpeg-cuda/bin/
to/usr/bin/
(Recommended)
!cp -r ./colab-ffmpeg-cuda/bin/. /usr/bin/
- Check the installed
ffmpeg
version
!ffmpeg -version
# Congratulations, ffmpeg with cuda support is installed!
If you are having trouble with the pre-built binaries, buid the binaries from scratch (It may take more than half an hour)
!chmod +x ./colab-ffmpeg-cuda/build
!./colab-ffmpeg-cuda/build --build
There you go, ffmpeg with the required binaries should be installed to /usr/bin
.
- Go to
Runtime
on top-left options
- Then go to
Change runtime type
- Set
Hardware accelerator
type toGPU