Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor #180

Open
wants to merge 31 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c3ce05a
3.2.14
rottj006 May 16, 2019
496b042
Merge branch 'master' of github.com:jrottenberg/ffmpeg
rottj006 May 18, 2019
cf785ae
Merge branch 'master' of github.com:jrottenberg/ffmpeg
rottj006 Jun 29, 2019
463961c
let's do the push through azure-ci
rottj006 Jun 29, 2019
0a3d121
after update.py
rottj006 Jun 29, 2019
a23a23d
Add webp
rubenrua Jul 3, 2019
0f8e2d6
New Dockerfiles with webp
rubenrua Jul 3, 2019
43b896b
support for our secrets
rottj006 Jul 5, 2019
1a3f0fc
config management
rottj006 Jul 5, 2019
e8ce2c0
refactor
rottj006 Jul 5, 2019
2ace30b
Help for #178
rottj006 Jul 14, 2019
08a2071
KISS
rottj006 Jul 14, 2019
2905ad9
KISS template
rottj006 Jul 14, 2019
e53a41f
after update.py 4.1.4
rottj006 Jul 14, 2019
75fbd70
we were a bit behind...
rottj006 Jul 18, 2019
7e0f955
after ./update.py
rottj006 Jul 18, 2019
a8eb719
4.2
rottj006 Aug 11, 2019
56b1e4f
aligned
rottj006 Aug 12, 2019
2940025
sorting
rottj006 Aug 12, 2019
ef06354
after ./update.py
rottj006 Aug 12, 2019
64b5037
Mirror with valid cert
rottj006 Aug 22, 2019
9e30a5d
after update.py
rottj006 Aug 22, 2019
01c9a88
fix nasm unavailable or outdated for libx265 > 2.6
Aug 27, 2019
ec598ad
update templates and all versions
Aug 28, 2019
20e12d9
4.2.1
rottj006 Sep 7, 2019
dceb3ed
3.2.14
rottj006 May 16, 2019
a6b1640
rewrite the dockerfile generation + vdapu + armv7 + dav1d
Jun 13, 2019
e9f367f
fix extra comma
Jun 18, 2019
7377454
rewrite the dockerfile generation + vdapu + armv7 + dav1d
Jun 13, 2019
1847a96
fix extra comma
Jun 18, 2019
306fb1a
add files
Jun 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ env:
- VERSION=snapshot VARIANT=scratch
- VERSION=snapshot VARIANT=vaapi
- VERSION=snapshot VARIANT=nvidia
- VERSION=4.2 VARIANT=ubuntu
- VERSION=4.2 VARIANT=alpine
- VERSION=4.2 VARIANT=centos
- VERSION=4.2 VARIANT=scratch
- VERSION=4.2 VARIANT=vaapi
- VERSION=4.2 VARIANT=nvidia
- VERSION=4.1 VARIANT=ubuntu
- VERSION=4.1 VARIANT=alpine
- VERSION=4.1 VARIANT=centos
Expand Down
Binary file added .update.py.swp
Binary file not shown.
154 changes: 108 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FFmpeg Docker image
==================
# FFmpeg Docker image


[![Docker Stars](https://img.shields.io/docker/stars/jrottenberg/ffmpeg.svg?style=plastic)](https://registry.hub.docker.com/v2/repositories/jrottenberg/ffmpeg/stars/count/) [![Docker pulls](https://img.shields.io/docker/pulls/jrottenberg/ffmpeg.svg?style=plastic)](https://registry.hub.docker.com/v2/repositories/jrottenberg/ffmpeg/)
[![Travis](https://img.shields.io/travis/jrottenberg/ffmpeg/master.svg?maxAge=300?style=plastic)](https://travis-ci.org/jrottenberg/ffmpeg)
Expand All @@ -12,8 +12,7 @@ You can install the latest build of this image by running `docker pull jrottenbe

This image can be used as a base for an encoding farm.

Ubuntu builds
--------------
## Builds

You can use jrottenberg/ffmpeg or jrottenberg/ffmpeg:3.3
to get the latest build based on ubuntu.
Expand All @@ -24,44 +23,104 @@ You'll find centos based image using `ffmpeg:X.Y-centos` or `ffmpeg:centos` to g
alpine images `ffmpeg:X.Y-alpine` to get the latest.
scratch images `ffmpeg:X.Y-scratch` to get the latest. (Scratch is an experimental image containing only FFmpeg and libraries)

Format is `ffmpeg:MAJOR.MINOR-VARIANT` with MAJOR.MINOR in :
- 2.8
- 3.0
- 3.1
- 3.2
- 3.3
- 3.4
- 4.0
- 4.1
- snapshot

and VARIANT in :
- alpine
- centos
- nvidia
- scratch
- ubuntu
- vaapi


Recent images:

```
vaapi 86mb 2018-08-16
snapshot-centos 95mb 2018-08-16
snapshot-alpine 27mb 2018-08-16
4.0-vaapi 86mb 2018-08-15
4.0-ubuntu 94mb 2018-08-16
4.0-scratch 20mb 2018-08-16
4.0-centos 95mb 2018-08-16
3.4-vaapi 84mb 2018-08-15
3.4-scratch 18mb 2018-08-16
3.4-alpine 24mb 2018-08-16
3.4 92mb 2018-08-16
3.3-scratch 17mb 2018-08-04
3.2-scratch 17mb 2018-08-16
3.2-alpine 24mb 2018-08-16
3.0-scratch 17mb 2018-08-16
3.0-centos 94mb 2018-08-16
2.8-scratch 16mb 2018-08-16
2.8 90mb 2018-08-16
snapshot-vaapi 74mb
snapshot-ubuntu 86mb
snapshot-scratch 20mb
snapshot-nvidia 640mb
snapshot-centos 97mb
snapshot-alpine 35mb
4.1-vaapi 73mb
4.1-ubuntu 85mb
4.1-scratch 20mb
4.1-nvidia 640mb
4.1-centos 97mb
4.1-alpine 34mb
4.0-vaapi 73mb
4.0-ubuntu 83mb
4.0-scratch 20mb
4.0-nvidia 639mb
4.0-centos 97mb
4.0-alpine 34mb
3.4-vaapi 71mb
3.4-ubuntu 83mb
3.4-scratch 18mb
3.4-nvidia 637mb
3.4-centos 97mb
3.4-alpine 32mb
3.4 83mb
3.3-vaapi 71mb
3.3-ubuntu 83mb
3.3-scratch 18mb
3.3-nvidia 637mb
3.3-centos 96mb
3.3-alpine 31mb
3.3 82mb
3.2-vaapi 83mb
3.2-ubuntu 83mb
3.2-scratch 18mb
3.2-nvidia 623mb
3.2-centos 96mb
3.2-alpine 32mb
3.1-vaapi 83mb
3.1-ubuntu 82mb
3.1-scratch 17mb
3.1-nvidia 623mb
3.1-centos 96mb
3.1-alpine 32mb
3.1 81mb
3.0-ubuntu 82mb
3.0-scratch 17mb
3.0-nvidia 623mb
3.0-centos 96mb
3.0-alpine 31mb
2.8-vaapi 82mb
2.8-ubuntu 81mb
2.8-scratch 17mb
2.8-nvidia 622mb
2.8-centos 95mb
2.8-alpine 30mb
```

<details><summary>(How the 'recent images' was generated)</summary>
### How the 'recent images' was generated

```
$ curl --silent https://hub.docker.com/v2/repositories/jrottenberg/ffmpeg/tags/?page_size=500 | jq -cr ".results|sort_by(.name)|reverse[]|.sz=(.full_size/1048576|floor|tostring+\"mb\")|[.name,( (20-(.name|length))*\" \" ),.sz,( (8-(.sz|length))*\" \"),.last_updated[:10]]|@text|gsub(\"[,\\\"\\\]\\\[]\";null)" | grep 2018-08
$ curl --silent https://hub.docker.com/v2/repositories/jrottenberg/ffmpeg/tags/?page_size=500 | jq -cr ".results|sort_by(.name)|reverse[]|.sz=(.full_size/1048576|floor|tostring+\"mb\")|[.name,( (20-(.name|length))*\" \" ),.sz,( (8-(.sz|length))*\" \"),.last_updated[:10]]|@text|gsub(\"[,\\\"\\\]\\\[]\";null)"

# If you want to compare the one you have locally
$ docker images | grep ffmpeg | sort | awk '{print $1 ":" $2 "\t" $7 $8}'
```
</details>

Please use [Github issues](https://github.com/jrottenberg/ffmpeg/issues/new) to report any bug or missing feature.

Test
----
## Test

```
ffmpeg version 3.3.4 Copyright (c) 2000-2017 the FFmpeg developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg
configuration: --disable-debug --disable-doc --disable-ffplay --enable-shared --enable-avresample --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-gpl --enable-libass --enable-libfreetype --enable-libvidstab --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxvid --enable-libx264 --enable-nonfree --enable-openssl --enable-libfdk_aac --enable-postproc --enable-small --enable-version3 --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs=-ldl --prefix=/opt/ffmpeg
libavutil 55. 58.100 / 55. 58.100
libavcodec 57. 89.100 / 57. 89.100
libavformat 57. 71.100 / 57. 71.100
Expand Down Expand Up @@ -90,6 +149,7 @@ ffmpeg version 3.3.4 Copyright (c) 2000-2017 the FFmpeg developers
--enable-libtheora
--enable-libvorbis
--enable-libvpx
--enable-libwebp
--enable-libx265
--enable-libxvid
--enable-libx264
Expand Down Expand Up @@ -126,61 +186,63 @@ Capture output from the container to the host running the command

#### Convert 10bits MKV into a 10Bits MP4
```
docker run -v $PWD:/tmp jrottenberg/ffmpeg:3.4-scratch \
docker run -v $(pwd):$(pwd) -w $(pwd) jrottenberg/ffmpeg:3.4-scratch \
-stats \
-i http://www.jell.yfish.us/media/jellyfish-20-mbps-hd-hevc-10bit.mkv \
-c:v libx265 -pix_fmt yuv420p10 \
-t 5 -f mp4 /tmp/test.mp4
-t 5 -f mp4 test.mp4
```
The image has been compiled with [X265 Multilib](https://x265.readthedocs.io/en/default/api.html#multi-library-interface).
Use the pixel format switch to change the number of bits per pixel by suffixing it with 10 for 10bits or 12 for 12bits.

#### Convert a local GIF into a mp4
#### Convert a local GIF into a mp4

Let's assume ```original.gif``` is located in the current directory :
```
docker run -v $PWD:/temp/ \
docker run -v $(pwd):$(pwd) -w $(pwd)\
jrottenberg/ffmpeg:3.2-scratch -stats \
-i /temp/original.gif \
/temp/original-converted.mp4
-i original.gif \
original-converted.mp4
```

#### Use hardware acceleration enabled build

Thanks to [qmfrederik](https://github.com/qmfrederik) for the vaapi ubuntu based variant
Thanks to [qmfrederik](https://github.com/qmfrederik) for the [vaapi ubuntu based variant](https://github.com/jrottenberg/ffmpeg/pull/106)

jrottenberg/ffmpeg:vaapi or jrottenberg/ffmpeg:vaapi-${VERSION}
jrottenberg/ffmpeg:vaapi or jrottenberg/ffmpeg:${VERSION}-vaapi

- Run the container with the device attached /dev/dri from your host into the container :

`docker run --device /dev/dri:/dev/dri -v $(pwd):/mnt jrottenberg/ffmpeg:vaapi [...]`
`docker run --device /dev/dri:/dev/dri -v $(pwd):$(pwd) -w $(pwd) jrottenberg/ffmpeg:vaapi [...]`
- Have the Intel drivers up and running on your host. You can run `vainfo` (part of vainfo package on Ubuntu) to determine whether your graphics card has been recognized correctly.
- Run ffmpeg with the correct parameters, this is the same as when running [ffmpeg natively](https://trac.ffmpeg.org/wiki/Hardware/VAAPI).


#### Use nvidia hardware acceleration enabled build

Thanks to [ShaulMyplay](https://github.com/ShaulMyplay) for the [nvidia based variant](https://github.com/jrottenberg/ffmpeg/pull/168)

Supports nvenc only on all ffmpeg versions, and hardware decoding and scaling on ffmpeg >= 4.0

- Install nvidia latest drivers on host machine.
- Install [nvidia-docker](https://github.com/NVIDIA/nvidia-docker) on host machine.
- Run container using "--runtime=nvidia" flag and use supported [ffmpeg hwaccel options](https://trac.ffmpeg.org/wiki/HWAccelIntro)
- Run container using "--runtime=nvidia" flag and use supported [ffmpeg hwaccel options](https://trac.ffmpeg.org/wiki/HWAccelIntro)

Hardware encoding only example:
`docker run --runtime=nvidia jrottenberg/ffmpeg:nvidia-2.8 -i INPUT -c:v nvenc_h264 -preset hq OUTPUT`
`docker run --runtime=nvidia jrottenberg/ffmpeg:2.8-nvidia -i INPUT -c:v nvenc_h264 -preset hq OUTPUT`
Full hardware acceleration example:
`docker run --runtime=nvidia jrottenberg/ffmpeg:nvidia-4.1 -hwaccel cuvid -c:v h264_cuvid -i INPUT -vf scale_npp=-1:720 -c:v h264_nvenc -preset slow OUTPUT`
`docker run --runtime=nvidia jrottenberg/ffmpeg:4.1-nvidia -hwaccel cuvid -c:v h264_cuvid -i INPUT -vf scale_npp=-1:720 -c:v h264_nvenc -preset slow OUTPUT`


See what's inside the beast
---------------------------
##### See what's inside the beast

```
docker run -it --entrypoint='bash' jrottenberg/ffmpeg

for i in ogg amr vorbis theora mp3lame opus vpx xvid fdk x264 x265;do echo $i; find /usr/local/ -name *$i*;done
```

Keep up to date
---------------
## Keep up to date

See Dockerfile-env to update a version

Expand All @@ -192,6 +254,7 @@ See Dockerfile-env to update a version
- [LAME_VERSION](http://lame.sourceforge.net/download.php): [GNU Lesser General Public License (LGPL) version 2.1](http://lame.cvs.sourceforge.net/viewvc/lame/lame/LICENSE?revision=1.9)
- [OPUS_VERSION](https://www.opus-codec.org/downloads/): [BSD-style license](https://www.opus-codec.org/license/)
- [VPX_VERSION](https://github.com/webmproject/libvpx/releases): [BSD-style license](https://github.com/webmproject/libvpx/blob/master/LICENSE)
- [WEBP_VERSION](https://storage.googleapis.com/downloads.webmproject.org/releases/webp/index.html): [BSD-style license](https://github.com/webmproject/libvpx/blob/master/LICENSE)
- [XVID_VERSION](https://labs.xvid.com/source/): [GNU General Public Licence (GPL) version 2](http://websvn.xvid.org/cvs/viewvc.cgi/trunk/xvidcore/LICENSE?revision=851)
- [FDKAAC_VERSION](https://github.com/mstorsjo/fdk-aac/releases): [Liberal but not a license of patented technologies](https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE)
- [FREETYPE_VERSION](http://download.savannah.gnu.org/releases/freetype/): [GNU General Public License (GPL) version 2](https://www.freetype.org/license.html)
Expand All @@ -201,8 +264,7 @@ See Dockerfile-env to update a version
- [X265_VERSION](https://bitbucket.org/multicoreware/x265/downloads/):[GNU General Public License (GPL) version 2](https://bitbucket.org/multicoreware/x265/raw/f8ae7afc1f61ed0db3b2f23f5d581706fe6ed677/COPYING)


Contribute
-----------
## Contribute


```
Expand Down
37 changes: 34 additions & 3 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
variables:
- group: videotoolsbuild-dockerhub
- name: DOCKER
value: jrottenberg/ffmpeg

jobs:
- job: Build
pool:
Expand All @@ -23,6 +28,24 @@ jobs:
snapshot_nvidia:
VERSION: snapshot
VARIANT: nvidia
4_2_ubuntu:
VERSION: 4.2
VARIANT: ubuntu
4_2_alpine:
VERSION: 4.2
VARIANT: alpine
4_2_centos:
VERSION: 4.2
VARIANT: centos
4_2_scratch:
VERSION: 4.2
VARIANT: scratch
4_2_vaapi:
VERSION: 4.2
VARIANT: vaapi
4_2_nvidia:
VERSION: 4.2
VARIANT: nvidia
4_1_ubuntu:
VERSION: 4.1
VARIANT: ubuntu
Expand Down Expand Up @@ -168,6 +191,14 @@ jobs:
VERSION: 2.8
VARIANT: nvidia
steps:
- script: |
docker build -t ffmpeg:${VERSION}-${VARIANT} --build-arg MAKEFLAGS="-j$(($(nproc) + 1))" docker-images/${VERSION}/${VARIANT}
docker run --rm ffmpeg:${VERSION}-${VARIANT} -buildconf
- bash: |
docker build -t ${DOCKER}:${VERSION}-${VARIANT} --build-arg MAKEFLAGS="-j$(($(grep -c ^processor /proc/cpuinfo) + 1))" docker-images/${VERSION}/${VARIANT}
docker run --rm ${DOCKER}:${VERSION}-${VARIANT} -buildconf
displayName: Build docker image
- bash: |
docker login --username ${DOCKER_LOGIN} --password ${DOCKER_PASSWORD}
docker push ${DOCKER}:${VERSION}-${VARIANT}
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
displayName: Push docker image
env:
DOCKER_PASSWORD: $(docker.password)
Loading