jrottenberg / ffmpeg

Docker build for FFmpeg on Ubuntu / Alpine / Centos / Scratch / nvidia / vaapi
https://hub.docker.com/r/jrottenberg/ffmpeg/
Apache License 2.0
1.42k stars 455 forks source link

Instructions on building docker container with additional FFMPEG codecs enabled? #275

Closed vade closed 3 years ago

vade commented 3 years ago

Hello

Firstly, thank you. This repo and work is really helpful and well put together. Kudos!

I have a few edge cases where I require a specific version of FFMPEG - 4.1, as well as a non standard codec enabled (Vidvox HAP), alongside Nvidia encoder support.

HAP is not enabled by default in the normal FFMPEG build scripts (and thus not in your awesome docker containers), so im curious how to build a an almost exact match container which compiles FFMPEG with an additional enable flag for HAP.

Apologies if this is self evident, I took a look around and didn't see anything obvious to my eye.

Thanks again,

vade commented 3 years ago

Ah, derp - your dockerfile itself does the build. Ill experiment with this and report back if I have issues. Apologies for the noise!

jrottenberg commented 3 years ago

Ah that's great, happy to help ;-)

Basically the Dockerfile should give you everything you need to reproduce a specific build/variant.

vade commented 3 years ago

Thanks! I was able to build the HAP variant perfectly. One question I haven't fully figured out with multi stage docker files - If I wanted to keep the Nvidia environment as is in the container, how do I edit the docker build to not remove those from the build?

Thank you again!

jrottenberg commented 3 years ago

Skip https://github.com/jrottenberg/ffmpeg/blob/master/docker-images/4.3/nvidia1804/Dockerfile#L589 and below. That will give you a big image, but will all the headers you need.

vade commented 3 years ago

Thanks! I actually was able to doing some weird hackery using your Dockerfile as a basis to meet a few requirements I needed:

CuDNN 8.0.5 / Cuda 11.1 for Ampere support FFMPEG 4.1 w HWAccel and HAP codec Pytorch 1.8

https://github.com/Synopsis/ffmpeg/blob/master/docker-images/4.1/nvidia2012Pytorch/Dockerfile

I couldn't get 4.1 compiled against a 11.1 Cuda / NV headers and Ubuntu 20.12 base - so I kept your devel/release split and mealy copied some things over into a different release base image which met my criteria.

I had to do some weird workarounds to get FFMPEG linked to the Cuda 10.2 folder but keep Cuda 11.1 installed as main, and not over-write system libraries.

I appreciate you taking the time to respond - and if you happen to have any more I'd be curious your take on this approach. Im fairly new to Docker all things considered. Thanks again!