From 049bc826199c0e5cc23868b5a0d4ffd0fbc9cb66 Mon Sep 17 00:00:00 2001 From: thelamer Date: Sun, 22 Sep 2019 16:40:52 -0700 Subject: [PATCH] updating cli branch with docs and bumping version --- .github/FUNDING.yml | 1 + Dockerfile | 3 +- Jenkinsfile | 87 ++++++++++++++------------ README.md | 140 ++++++++++++++++++++++++++++++++++++++---- jenkins-vars.yml | 10 +-- readme-vars.yml | 140 ++++++++++++++++++++++++++++++++++++++---- root/ffmpegwrapper.sh | 45 ++++++-------- 7 files changed, 331 insertions(+), 95 deletions(-) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..7972213 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +open_collective: linuxserver diff --git a/Dockerfile b/Dockerfile index daef222..1f04ecf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,8 @@ LABEL maintainer="thelamer" # hardware env ENV \ LIBVA_DRIVERS_PATH="/usr/lib/x86_64-linux-gnu/dri" \ - NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" + NVIDIA_DRIVER_CAPABILITIES="compute,video,utility" \ + NVIDIA_VISIBLE_DEVICES="all" RUN \ echo "**** install runtime ****" && \ diff --git a/Jenkinsfile b/Jenkinsfile index 05e5396..1ee505b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -17,7 +17,7 @@ pipeline { DOCKERHUB_IMAGE = 'linuxserver/ffmpeg' DEV_DOCKERHUB_IMAGE = 'lsiodev/ffmpeg' PR_DOCKERHUB_IMAGE = 'lspipepr/ffmpeg' - DIST_IMAGE = 'alpine' + DIST_IMAGE = 'ubuntu' MULTIARCH='true' CI='false' } @@ -28,7 +28,7 @@ pipeline { script{ env.EXIT_STATUS = '' env.LS_RELEASE = sh( - script: '''docker run --rm alexeiled/skopeo sh -c 'skopeo inspect docker://docker.io/'${DOCKERHUB_IMAGE}':cli 2>/dev/null' | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\-ls' || : ''', + script: '''docker run --rm alexeiled/skopeo sh -c 'skopeo inspect docker://docker.io/'${DOCKERHUB_IMAGE}':latest 2>/dev/null' | jq -r '.Labels.build_version' | awk '{print $3}' | grep '\\-ls' || : ''', returnStdout: true).trim() env.LS_RELEASE_NOTES = sh( script: '''cat readme-vars.yml | awk -F \\" '/date: "[0-9][0-9].[0-9][0-9].[0-9][0-9]:/ {print $4;exit;}' | sed -E ':a;N;$!ba;s/\\r{0,1}\\n/\\\\n/g' ''', @@ -50,6 +50,14 @@ pipeline { echo none fi''', returnStdout: true).trim() + env.FUNDING_TAG = sh( + script: '''#!/bin/bash + if [ -e ./.github/FUNDING.yml ] ; then + cat ./.github/FUNDING.yml | md5sum | cut -c1-8 + else + echo none + fi''', + returnStdout: true).trim() } script{ env.LS_RELEASE_NUMBER = sh( @@ -97,7 +105,7 @@ pipeline { steps{ script{ env.EXT_RELEASE = sh( - script: ''' echo 4.2-cli ''', + script: ''' echo 4.2.1-cli ''', returnStdout: true).trim() env.RELEASE_LINK = 'custom_command' } @@ -113,10 +121,10 @@ pipeline { } } } - // If this is a cli build use live docker endpoints + // If this is a master build use live docker endpoints stage("Set ENV live build"){ when { - branch "cli" + branch "master" environment name: 'CHANGE_ID', value: '' } steps { @@ -134,7 +142,7 @@ pipeline { // If this is a dev build use dev docker endpoints stage("Set ENV dev build"){ when { - not {branch "cli"} + not {branch "master"} environment name: 'CHANGE_ID', value: '' } steps { @@ -201,7 +209,7 @@ pipeline { // Use helper containers to render templated files stage('Update-Templates') { when { - branch "cli" + branch "master" environment name: 'CHANGE_ID', value: '' expression { env.CONTAINER_NAME != null @@ -212,20 +220,23 @@ pipeline { set -e TEMPDIR=$(mktemp -d) docker pull linuxserver/jenkins-builder:latest - docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=cli -v ${TEMPDIR}:/ansible/jenkins linuxserver/jenkins-builder:latest + docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/jenkins linuxserver/jenkins-builder:latest docker pull linuxserver/doc-builder:latest - docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=cli -v ${TEMPDIR}:/ansible/readme linuxserver/doc-builder:latest + docker run --rm -e CONTAINER_NAME=${CONTAINER_NAME} -e GITHUB_BRANCH=master -v ${TEMPDIR}:/ansible/readme linuxserver/doc-builder:latest if [ "$(md5sum ${TEMPDIR}/${LS_REPO}/Jenkinsfile | awk '{ print $1 }')" != "$(md5sum Jenkinsfile | awk '{ print $1 }')" ] || \ [ "$(md5sum ${TEMPDIR}/${CONTAINER_NAME}/README.md | awk '{ print $1 }')" != "$(md5sum README.md | awk '{ print $1 }')" ] || \ - [ "$(cat ${TEMPDIR}/${LS_REPO}/LICENSE | md5sum | cut -c1-8)" != "${LICENSE_TAG}" ]; then + [ "$(cat ${TEMPDIR}/${LS_REPO}/LICENSE | md5sum | cut -c1-8)" != "${LICENSE_TAG}" ] || \ + [ "$(cat ${TEMPDIR}/${LS_REPO}/.github/FUNDING.yml | md5sum | cut -c1-8)" != "${FUNDING_TAG}" ]; then mkdir -p ${TEMPDIR}/repo git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/repo/${LS_REPO} - git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git checkout -f cli + git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git checkout -f master cp ${TEMPDIR}/${CONTAINER_NAME}/README.md ${TEMPDIR}/repo/${LS_REPO}/ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/Jenkinsfile ${TEMPDIR}/repo/${LS_REPO}/ cp ${TEMPDIR}/docker-${CONTAINER_NAME}/LICENSE ${TEMPDIR}/repo/${LS_REPO}/ + mkdir -p ${TEMPDIR}/repo/${LS_REPO}/.github + cp ${TEMPDIR}/docker-${CONTAINER_NAME}/.github/FUNDING.yml ${TEMPDIR}/repo/${LS_REPO}/.github/FUNDING.yml cd ${TEMPDIR}/repo/${LS_REPO}/ - git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git add Jenkinsfile README.md LICENSE + git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git add Jenkinsfile README.md LICENSE ./.github/FUNDING.yml git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git commit -m 'Bot Updating Templated Files' git --git-dir ${TEMPDIR}/repo/${LS_REPO}/.git push https://LinuxServer-CI:${GITHUB_TOKEN}@github.com/${LS_USER}/${LS_REPO}.git --all echo "true" > /tmp/${COMMIT_SHA}-${BUILD_NUMBER} @@ -252,7 +263,7 @@ pipeline { // Exit the build if the Templated files were just updated stage('Template-exit') { when { - branch "cli" + branch "master" environment name: 'CHANGE_ID', value: '' environment name: 'FILES_UPDATED', value: 'true' expression { @@ -351,7 +362,7 @@ pipeline { // Take the image we just built and dump package versions for comparison stage('Update-packages') { when { - branch "cli" + branch "master" environment name: 'CHANGE_ID', value: '' environment name: 'EXIT_STATUS', value: '' } @@ -379,7 +390,7 @@ pipeline { echo "Package tag sha from current packages in buit container is ${NEW_PACKAGE_TAG} comparing to old ${PACKAGE_TAG} from github" if [ "${NEW_PACKAGE_TAG}" != "${PACKAGE_TAG}" ]; then git clone https://github.com/${LS_USER}/${LS_REPO}.git ${TEMPDIR}/${LS_REPO} - git --git-dir ${TEMPDIR}/${LS_REPO}/.git checkout -f cli + git --git-dir ${TEMPDIR}/${LS_REPO}/.git checkout -f master cp ${TEMPDIR}/package_versions.txt ${TEMPDIR}/${LS_REPO}/ cd ${TEMPDIR}/${LS_REPO}/ wait @@ -403,7 +414,7 @@ pipeline { // Exit the build if the package file was just updated stage('PACKAGE-exit') { when { - branch "cli" + branch "master" environment name: 'CHANGE_ID', value: '' environment name: 'PACKAGE_UPDATED', value: 'true' environment name: 'EXIT_STATUS', value: '' @@ -417,7 +428,7 @@ pipeline { // Exit the build if this is just a package check and there are no changes to push stage('PACKAGECHECK-exit') { when { - branch "cli" + branch "master" environment name: 'CHANGE_ID', value: '' environment name: 'PACKAGE_UPDATED', value: 'false' environment name: 'EXIT_STATUS', value: '' @@ -502,12 +513,12 @@ pipeline { sh '''#! /bin/bash echo $DOCKERPASS | docker login -u $DOCKERUSER --password-stdin ''' - sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:cli" - sh "docker push ${IMAGE}:cli" + sh "docker tag ${IMAGE}:${META_TAG} ${IMAGE}:latest" + sh "docker push ${IMAGE}:latest" sh "docker push ${IMAGE}:${META_TAG}" sh '''docker rmi \ ${IMAGE}:${META_TAG} \ - ${IMAGE}:cli || :''' + ${IMAGE}:latest || :''' } } @@ -537,32 +548,32 @@ pipeline { docker tag lsiodev/buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm32v7-${META_TAG} docker tag lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} ${IMAGE}:arm64v8-${META_TAG} fi''' - sh "docker tag ${IMAGE}:amd64-${META_TAG} ${IMAGE}:amd64-cli" - sh "docker tag ${IMAGE}:arm32v7-${META_TAG} ${IMAGE}:arm32v7-cli" - sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ${IMAGE}:arm64v8-cli" + sh "docker tag ${IMAGE}:amd64-${META_TAG} ${IMAGE}:amd64-latest" + sh "docker tag ${IMAGE}:arm32v7-${META_TAG} ${IMAGE}:arm32v7-latest" + sh "docker tag ${IMAGE}:arm64v8-${META_TAG} ${IMAGE}:arm64v8-latest" sh "docker push ${IMAGE}:amd64-${META_TAG}" sh "docker push ${IMAGE}:arm32v7-${META_TAG}" sh "docker push ${IMAGE}:arm64v8-${META_TAG}" - sh "docker push ${IMAGE}:amd64-cli" - sh "docker push ${IMAGE}:arm32v7-cli" - sh "docker push ${IMAGE}:arm64v8-cli" - sh "docker manifest push --purge ${IMAGE}:cli || :" - sh "docker manifest create ${IMAGE}:cli ${IMAGE}:amd64-cli ${IMAGE}:arm32v7-cli ${IMAGE}:arm64v8-cli" - sh "docker manifest annotate ${IMAGE}:cli ${IMAGE}:arm32v7-cli --os linux --arch arm" - sh "docker manifest annotate ${IMAGE}:cli ${IMAGE}:arm64v8-cli --os linux --arch arm64 --variant v8" + sh "docker push ${IMAGE}:amd64-latest" + sh "docker push ${IMAGE}:arm32v7-latest" + sh "docker push ${IMAGE}:arm64v8-latest" + sh "docker manifest push --purge ${IMAGE}:latest || :" + sh "docker manifest create ${IMAGE}:latest ${IMAGE}:amd64-latest ${IMAGE}:arm32v7-latest ${IMAGE}:arm64v8-latest" + sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm32v7-latest --os linux --arch arm" + sh "docker manifest annotate ${IMAGE}:latest ${IMAGE}:arm64v8-latest --os linux --arch arm64 --variant v8" sh "docker manifest push --purge ${IMAGE}:${META_TAG} || :" sh "docker manifest create ${IMAGE}:${META_TAG} ${IMAGE}:amd64-${META_TAG} ${IMAGE}:arm32v7-${META_TAG} ${IMAGE}:arm64v8-${META_TAG}" sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm32v7-${META_TAG} --os linux --arch arm" sh "docker manifest annotate ${IMAGE}:${META_TAG} ${IMAGE}:arm64v8-${META_TAG} --os linux --arch arm64 --variant v8" - sh "docker manifest push --purge ${IMAGE}:cli" + sh "docker manifest push --purge ${IMAGE}:latest" sh "docker manifest push --purge ${IMAGE}:${META_TAG}" sh '''docker rmi \ ${IMAGE}:amd64-${META_TAG} \ - ${IMAGE}:amd64-cli \ + ${IMAGE}:amd64-latest \ ${IMAGE}:arm32v7-${META_TAG} \ - ${IMAGE}:arm32v7-cli \ + ${IMAGE}:arm32v7-latest \ ${IMAGE}:arm64v8-${META_TAG} \ - ${IMAGE}:arm64v8-cli \ + ${IMAGE}:arm64v8-latest \ lsiodev/buildcache:arm32v7-${COMMIT_SHA}-${BUILD_NUMBER} \ lsiodev/buildcache:arm64v8-${COMMIT_SHA}-${BUILD_NUMBER} || :''' } @@ -571,7 +582,7 @@ pipeline { // If this is a public release tag it in the LS Github stage('Github-Tag-Push-Release') { when { - branch "cli" + branch "master" expression { env.LS_RELEASE != env.EXT_RELEASE_CLEAN + '-ls' + env.LS_TAG_NUMBER } @@ -583,17 +594,17 @@ pipeline { sh '''curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/git/tags \ -d '{"tag":"'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\ "object": "'${COMMIT_SHA}'",\ - "message": "Tagging Release '${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}' to cli",\ + "message": "Tagging Release '${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}' to master",\ "type": "commit",\ "tagger": {"name": "LinuxServer Jenkins","email": "jenkins@linuxserver.io","date": "'${GITHUB_DATE}'"}}' ''' echo "Pushing New release for Tag" sh '''#! /bin/bash echo "Updating to ${EXT_RELEASE_CLEAN}" > releasebody.json echo '{"tag_name":"'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\ - "target_commitish": "cli",\ + "target_commitish": "master",\ "name": "'${EXT_RELEASE_CLEAN}'-ls'${LS_TAG_NUMBER}'",\ "body": "**LinuxServer Changes:**\\n\\n'${LS_RELEASE_NOTES}'\\n**Remote Changes:**\\n\\n' > start - printf '","draft": false,"prerelease": true}' >> releasebody.json + printf '","draft": false,"prerelease": false}' >> releasebody.json paste -d'\\0' start releasebody.json > releasebody.json.done curl -H "Authorization: token ${GITHUB_TOKEN}" -X POST https://api.github.com/repos/${LS_USER}/${LS_REPO}/releases -d @releasebody.json.done''' } diff --git a/README.md b/README.md index 9a6fbf5..f221b21 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,127 @@ -[linuxserverurl]: https://linuxserver.io -[forumurl]: https://forum.linuxserver.io -[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png?v=4&s=4000)][linuxserverurl] -## Contact information:- -| Type | Address/Details | -| :---: | --- | -| Discord | [Discord](https://discord.gg/YWrKVTn) | -| Forum | [Linuserver.io forum][forumurl] | -  -  -THIS README IS A PLACEHOLDER WHILE DEVELOPING THIS CLI BRANCH. THIS IS NOT READY FOR PUBLIC CONSUMPTION YET. -The following line is only in this repo for loop testing: -- { date: "01.01.50:", desc: "I am the release message for this internal branch." } +[![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)](https://linuxserver.io) + +[![Blog](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Blog)](https://blog.linuxserver.io "all the things you can do with our containers including How-To guides, opinions and much more!") +[![Discord](https://img.shields.io/discord/354974912613449730.svg?style=flat-square&color=E68523&label=Discord&logo=discord&logoColor=FFFFFF)](https://discord.gg/YWrKVTn "realtime support / chat with the community and the team.") +[![Discourse](https://img.shields.io/discourse/https/discourse.linuxserver.io/topics.svg?style=flat-square&color=E68523&logo=discourse&logoColor=FFFFFF)](https://discourse.linuxserver.io "post on our community forum.") +[![Fleet](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Fleet)](https://fleet.linuxserver.io "an online web interface which displays all of our maintained images.") +[![Podcast](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Podcast)](https://anchor.fm/linuxserverio "on hiatus. Coming back soon (late 2018).") +[![Open Collective](https://img.shields.io/opencollective/all/linuxserver.svg?style=flat-square&color=E68523&label=Open%20Collective%20Supporters)](https://opencollective.com/linuxserver "please consider helping us by either donating or contributing to our budget") + +The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring :- + + * regular and timely application updates + * easy user mappings (PGID, PUID) + * custom base image with s6 overlay + * weekly base OS updates with common layers across the entire LinuxServer.io ecosystem to minimise space usage, down time and bandwidth + * regular security updates + +Find us at: +* [Blog](https://blog.linuxserver.io) - all the things you can do with our containers including How-To guides, opinions and much more! +* [Discord](https://discord.gg/YWrKVTn) - realtime support / chat with the community and the team. +* [Discourse](https://discourse.linuxserver.io) - post on our community forum. +* [Fleet](https://fleet.linuxserver.io) - an online web interface which displays all of our maintained images. +* [Podcast](https://anchor.fm/linuxserverio) - on hiatus. Coming back soon (late 2018). +* [Open Collective](https://opencollective.com/linuxserver) - please consider helping us by either donating or contributing to our budget + +# [linuxserver/ffmpeg](https://github.com/linuxserver/docker-ffmpeg) +[![GitHub Release](https://img.shields.io/github/release/linuxserver/docker-ffmpeg.svg?style=flat-square&color=E68523)](https://github.com/linuxserver/docker-ffmpeg/releases) +[![MicroBadger Layers](https://img.shields.io/microbadger/layers/linuxserver/ffmpeg.svg?style=flat-square&color=E68523)](https://microbadger.com/images/linuxserver/ffmpeg "Get your own version badge on microbadger.com") +[![MicroBadger Size](https://img.shields.io/microbadger/image-size/linuxserver/ffmpeg.svg?style=flat-square&color=E68523)](https://microbadger.com/images/linuxserver/ffmpeg "Get your own version badge on microbadger.com") +[![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/ffmpeg.svg?style=flat-square&color=E68523)](https://hub.docker.com/r/linuxserver/ffmpeg) +[![Docker Stars](https://img.shields.io/docker/stars/linuxserver/ffmpeg.svg?style=flat-square&color=E68523)](https://hub.docker.com/r/linuxserver/ffmpeg) +[![Build Status](https://ci.linuxserver.io/view/all/job/Docker-Pipeline-Builders/job/docker-ffmpeg/job/master/badge/icon?style=flat-square)](https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-ffmpeg/job/master/) + +[FFmpeg](https://ffmpeg.org) - A complete, cross-platform solution to record, convert and stream audio and video. + + +[![ffmpeg](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/ffmpeg.png)](https://ffmpeg.org) + +## Supported Architectures + +Our images support multiple architectures such as `x86-64`, `arm64` and `armhf`. We utilise the docker manifest for multi-platform awareness. More information is available from docker [here](https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md#manifest-list) and our announcement [here](https://blog.linuxserver.io/2019/02/21/the-lsio-pipeline-project/). + +Simply pulling `linuxserver/ffmpeg` should retrieve the correct image for your arch, but you can also pull specific arch images via tags. + +The architectures supported by this image are: + +| Architecture | Tag | +| :----: | --- | +| x86-64 | amd64-latest | +| arm64 | arm64v8-latest | +| armhf | arm32v7-latest | + +## Usage + +Unlike most of our container library this image is meant to be run ephemerally from the command line parsing user input for a custom FFmpeg command. You will need to understand some Docker basics to use this image and be familiar with how to construct an FFmpeg command. In the commands below we will be bind mounting our current working directory from the CLI to /config, the assumption is that input.mkv is in your current working directory. + +If an input file is detected we will run FFmpeg as that user/group so the output file will match it's permissions. +The image supports Hardware acceleration on x86 pay close attention to the variables for the examples below. + +### Basic Transcode + +``` +docker run --rm -it \ + -v $(pwd):/config \ + linuxserver/ffmpeg \ + -i /config/input.mkv \ + -c:v libx264 \ + -b:v 4M \ + -vf scale=1280:720 \ + -c:a copy \ + /config/output.mkv +``` + +### Hardware accelerated (VAAPI) + +``` +docker run --rm -it \ + --device=/dev/dri:/dev/dri \ + -v $(pwd):/config \ + linuxserver/ffmpeg \ + -vaapi_device /dev/dri/renderD128 \ + -i /config/input.mkv \ + -c:v h264_vaapi \ + -b:v 4M \ + -vf 'format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=720' \ + -c:a copy \ + /config/output.mkv +``` + +### Nvidia Hardware accelerated + +``` +docker run --rm -it \ + --runtime=nvidia \ + -v $(pwd):/config \ + linuxserver/ffmpeg \ + -hwaccel nvdec \ + -i /config/input.mkv \ + -c:v h264_nvenc \ + -b:v 4M \ + –vf scale_npp=1280:720 \ + -c:a copy \ + /config/output.mkv +``` + +## Building locally + +If you want to make local modifications to these images for development purposes or just to customize the logic: +``` +git clone https://github.com/linuxserver/docker-ffmpeg.git +cd docker-ffmpeg +docker build \ + --no-cache \ + --pull \ + -t linuxserver/ffmpeg:latest . +``` + +The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static` +``` +docker run --rm --privileged multiarch/qemu-user-static:register --reset +``` + +Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`. + +## Versions + +* **01.08.19:** - Initial release. diff --git a/jenkins-vars.yml b/jenkins-vars.yml index 8188d21..3e4b84f 100644 --- a/jenkins-vars.yml +++ b/jenkins-vars.yml @@ -3,10 +3,10 @@ # jenkins variables project_name: docker-ffmpeg external_type: na -custom_version_command: "echo 4.2-cli" -release_type: prerelease -release_tag: cli -ls_branch: cli +custom_version_command: "echo 4.2.1-cli" +release_type: stable +release_tag: latest +ls_branch: master repo_vars: - BUILD_VERSION_ARG = 'FFMPEG_VERSION' - LS_USER = 'linuxserver' @@ -15,6 +15,6 @@ repo_vars: - DOCKERHUB_IMAGE = 'linuxserver/ffmpeg' - DEV_DOCKERHUB_IMAGE = 'lsiodev/ffmpeg' - PR_DOCKERHUB_IMAGE = 'lspipepr/ffmpeg' - - DIST_IMAGE = 'alpine' + - DIST_IMAGE = 'ubuntu' - MULTIARCH='true' - CI='false' diff --git a/readme-vars.yml b/readme-vars.yml index 9de3d1b..c2be15d 100644 --- a/readme-vars.yml +++ b/readme-vars.yml @@ -4,17 +4,131 @@ project_name: ffmpeg full_custom_readme: | {% raw -%} - [linuxserverurl]: https://linuxserver.io - [forumurl]: https://forum.linuxserver.io - [![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png?v=4&s=4000)][linuxserverurl] - ## Contact information:- - | Type | Address/Details | - | :---: | --- | - | Discord | [Discord](https://discord.gg/YWrKVTn) | - | Forum | [Linuserver.io forum][forumurl] | -   -   - THIS README IS A PLACEHOLDER WHILE DEVELOPING THIS CLI BRANCH. THIS IS NOT READY FOR PUBLIC CONSUMPTION YET. - The following line is only in this repo for loop testing: - - { date: "01.01.50:", desc: "I am the release message for this internal branch." } + [![linuxserver.io](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/linuxserver_medium.png)](https://linuxserver.io) + + [![Blog](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Blog)](https://blog.linuxserver.io "all the things you can do with our containers including How-To guides, opinions and much more!") + [![Discord](https://img.shields.io/discord/354974912613449730.svg?style=flat-square&color=E68523&label=Discord&logo=discord&logoColor=FFFFFF)](https://discord.gg/YWrKVTn "realtime support / chat with the community and the team.") + [![Discourse](https://img.shields.io/discourse/https/discourse.linuxserver.io/topics.svg?style=flat-square&color=E68523&logo=discourse&logoColor=FFFFFF)](https://discourse.linuxserver.io "post on our community forum.") + [![Fleet](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Fleet)](https://fleet.linuxserver.io "an online web interface which displays all of our maintained images.") + [![Podcast](https://img.shields.io/static/v1.svg?style=flat-square&color=E68523&label=linuxserver.io&message=Podcast)](https://anchor.fm/linuxserverio "on hiatus. Coming back soon (late 2018).") + [![Open Collective](https://img.shields.io/opencollective/all/linuxserver.svg?style=flat-square&color=E68523&label=Open%20Collective%20Supporters)](https://opencollective.com/linuxserver "please consider helping us by either donating or contributing to our budget") + + The [LinuxServer.io](https://linuxserver.io) team brings you another container release featuring :- + + * regular and timely application updates + * easy user mappings (PGID, PUID) + * custom base image with s6 overlay + * weekly base OS updates with common layers across the entire LinuxServer.io ecosystem to minimise space usage, down time and bandwidth + * regular security updates + + Find us at: + * [Blog](https://blog.linuxserver.io) - all the things you can do with our containers including How-To guides, opinions and much more! + * [Discord](https://discord.gg/YWrKVTn) - realtime support / chat with the community and the team. + * [Discourse](https://discourse.linuxserver.io) - post on our community forum. + * [Fleet](https://fleet.linuxserver.io) - an online web interface which displays all of our maintained images. + * [Podcast](https://anchor.fm/linuxserverio) - on hiatus. Coming back soon (late 2018). + * [Open Collective](https://opencollective.com/linuxserver) - please consider helping us by either donating or contributing to our budget + + # [linuxserver/ffmpeg](https://github.com/linuxserver/docker-ffmpeg) + [![GitHub Release](https://img.shields.io/github/release/linuxserver/docker-ffmpeg.svg?style=flat-square&color=E68523)](https://github.com/linuxserver/docker-ffmpeg/releases) + [![MicroBadger Layers](https://img.shields.io/microbadger/layers/linuxserver/ffmpeg.svg?style=flat-square&color=E68523)](https://microbadger.com/images/linuxserver/ffmpeg "Get your own version badge on microbadger.com") + [![MicroBadger Size](https://img.shields.io/microbadger/image-size/linuxserver/ffmpeg.svg?style=flat-square&color=E68523)](https://microbadger.com/images/linuxserver/ffmpeg "Get your own version badge on microbadger.com") + [![Docker Pulls](https://img.shields.io/docker/pulls/linuxserver/ffmpeg.svg?style=flat-square&color=E68523)](https://hub.docker.com/r/linuxserver/ffmpeg) + [![Docker Stars](https://img.shields.io/docker/stars/linuxserver/ffmpeg.svg?style=flat-square&color=E68523)](https://hub.docker.com/r/linuxserver/ffmpeg) + [![Build Status](https://ci.linuxserver.io/view/all/job/Docker-Pipeline-Builders/job/docker-ffmpeg/job/master/badge/icon?style=flat-square)](https://ci.linuxserver.io/job/Docker-Pipeline-Builders/job/docker-ffmpeg/job/master/) + + [FFmpeg](https://ffmpeg.org) - A complete, cross-platform solution to record, convert and stream audio and video. + + + [![ffmpeg](https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/ffmpeg.png)](https://ffmpeg.org) + + ## Supported Architectures + + Our images support multiple architectures such as `x86-64`, `arm64` and `armhf`. We utilise the docker manifest for multi-platform awareness. More information is available from docker [here](https://github.com/docker/distribution/blob/master/docs/spec/manifest-v2-2.md#manifest-list) and our announcement [here](https://blog.linuxserver.io/2019/02/21/the-lsio-pipeline-project/). + + Simply pulling `linuxserver/ffmpeg` should retrieve the correct image for your arch, but you can also pull specific arch images via tags. + + The architectures supported by this image are: + + | Architecture | Tag | + | :----: | --- | + | x86-64 | amd64-latest | + | arm64 | arm64v8-latest | + | armhf | arm32v7-latest | + + ## Usage + + Unlike most of our container library this image is meant to be run ephemerally from the command line parsing user input for a custom FFmpeg command. You will need to understand some Docker basics to use this image and be familiar with how to construct an FFmpeg command. In the commands below we will be bind mounting our current working directory from the CLI to /config, the assumption is that input.mkv is in your current working directory. + + If an input file is detected we will run FFmpeg as that user/group so the output file will match it's permissions. + The image supports Hardware acceleration on x86 pay close attention to the variables for the examples below. + + ### Basic Transcode + + ``` + docker run --rm -it \ + -v $(pwd):/config \ + linuxserver/ffmpeg \ + -i /config/input.mkv \ + -c:v libx264 \ + -b:v 4M \ + -vf scale=1280:720 \ + -c:a copy \ + /config/output.mkv + ``` + + ### Hardware accelerated (VAAPI) + + ``` + docker run --rm -it \ + --device=/dev/dri:/dev/dri \ + -v $(pwd):/config \ + linuxserver/ffmpeg \ + -vaapi_device /dev/dri/renderD128 \ + -i /config/input.mkv \ + -c:v h264_vaapi \ + -b:v 4M \ + -vf 'format=nv12|vaapi,hwupload,scale_vaapi=w=1280:h=720' \ + -c:a copy \ + /config/output.mkv + ``` + + ### Nvidia Hardware accelerated + + ``` + docker run --rm -it \ + --runtime=nvidia \ + -v $(pwd):/config \ + linuxserver/ffmpeg \ + -hwaccel nvdec \ + -i /config/input.mkv \ + -c:v h264_nvenc \ + -b:v 4M \ + –vf scale_npp=1280:720 \ + -c:a copy \ + /config/output.mkv + ``` + + ## Building locally + + If you want to make local modifications to these images for development purposes or just to customize the logic: + ``` + git clone https://github.com/linuxserver/docker-ffmpeg.git + cd docker-ffmpeg + docker build \ + --no-cache \ + --pull \ + -t linuxserver/ffmpeg:latest . + ``` + + The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static` + ``` + docker run --rm --privileged multiarch/qemu-user-static:register --reset + ``` + + Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`. + + ## Versions + + * **01.08.19:** - Initial release. {%- endraw %} diff --git a/root/ffmpegwrapper.sh b/root/ffmpegwrapper.sh index 3909129..f58f969 100755 --- a/root/ffmpegwrapper.sh +++ b/root/ffmpegwrapper.sh @@ -36,34 +36,29 @@ do done ## hardware support ## -# check for the existence of a video device -if [ -e /dev/dri ]; then - VIDEO_GID=$(stat -c '%g' /dev/dri/* | grep -v '^0$' | head -n 1) - # just add abc to root if stuff in dri is root owned - if [ -z "${VIDEO_GID}" ]; then - usermod -a -G root abc - run_ffmpeg +FILES=$(find /dev/dri -type c -print 2>/dev/null) +for i in $FILES +do + VIDEO_GID=$(stat -c '%g' "$i") + if id -G abc | grep -qw "$VIDEO_GID"; then + touch /groupadd + else + if [ ! "${VIDEO_GID}" == '0' ]; then + VIDEO_NAME=$(getent group "${VIDEO_GID}" | awk -F: '{print $1}') + if [ -z "${VIDEO_NAME}" ]; then + VIDEO_NAME="video$(head /dev/urandom | tr -dc 'a-zA-Z0-9' | head -c8)" + groupadd "$VIDEO_NAME" + groupmod -g "$VIDEO_GID" "$VIDEO_NAME" + fi + usermod -a -G "$VIDEO_NAME" abc + touch /groupadd + fi fi -else - run_ffmpeg +done +if [ -n "${FILES}" ] && [ ! -f "/groupadd" ]; then + usermod -a -G root abc fi -# check if this GID matches the current abc user -ABCGID=$(getent group abc | awk -F: '{print $3}') -if [ "${ABCGID}" == "${VIDEO_GID}" ]; then - run_ffmpeg -fi - -# check if the GID is taken and swap to 65533 -CURRENT=$(getent group ${VIDEO_GID} | awk -F: '{print $1}') -if [ -z "${CURRENT}" ] || [ "${CURRENT}" == 'video' ]; then - groupmod -g ${VIDEO_GID} video - usermod -a -G video abc -else - groupmod -g 65533 ${CURRENT} - groupmod -g ${VIDEO_GID} video - usermod -a -G video abc -fi run_ffmpeg