{"id":13618191,"url":"https://github.com/TheTaylorLee/docker-transcodeautomation","last_synced_at":"2025-04-14T10:31:16.774Z","repository":{"id":133133937,"uuid":"586355845","full_name":"TheTaylorLee/docker-transcodeautomation","owner":"TheTaylorLee","description":"An automated media transcoding solution.","archived":false,"fork":false,"pushed_at":"2024-10-24T03:14:04.000Z","size":5132,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-24T15:17:15.713Z","etag":null,"topics":["docker","transcode"],"latest_commit_sha":null,"homepage":"","language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheTaylorLee.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":"contributing.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-07T20:53:59.000Z","updated_at":"2024-10-22T02:10:40.000Z","dependencies_parsed_at":"2023-10-02T17:11:26.740Z","dependency_job_id":"8f45abfe-4914-46be-a881-4eb10561e58d","html_url":"https://github.com/TheTaylorLee/docker-transcodeautomation","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheTaylorLee%2Fdocker-transcodeautomation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheTaylorLee%2Fdocker-transcodeautomation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheTaylorLee%2Fdocker-transcodeautomation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheTaylorLee%2Fdocker-transcodeautomation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheTaylorLee","download_url":"https://codeload.github.com/TheTaylorLee/docker-transcodeautomation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248862606,"owners_count":21173838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","transcode"],"created_at":"2024-08-01T20:01:56.002Z","updated_at":"2025-04-14T10:31:11.763Z","avatar_url":"https://github.com/TheTaylorLee.png","language":"PowerShell","readme":"# Docker-TranscodeAutomation\nAn automated media transcoding solution. This solution is completely automated and retains statistics. **By using this container, you assume all risks.** Be careful and begin by testing with a copy of only a few files for transcoding. For a better understanding of this containers function and workflow see this [diagram](https://github.com/TheTaylorLee/docker-transcodeautomation/blob/master/examples/workflowdiagram/Docker-TranscodeAutomation.png).\n\n\u003cdiv\u003e\n  \u003cp align=\"Left\"\u003e\n      \u003ca href=\"https://github.com/TheTaylorLee/docker-transcodeautomation/actions/workflows/prod-alpine-amd64.yml\"\u003e\n      \u003cimg src=\"https://github.com/TheTaylorLee/docker-transcodeautomation/actions/workflows/prod-alpine-amd64.yml/badge.svg\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/TheTaylorLee/docker-transcodeautomation/issues?q=is%3Aopen+is%3Aissue\"\u003e\n      \u003cimg src =\"https://img.shields.io/github/issues-raw/thetaylorlee/docker-transcodeautomation\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/TheTaylorLee/docker-transcodeautomation/blob/master/LICENSE\"\u003e\n\t    \u003cimg src=\"https://img.shields.io/github/license/thetaylorlee/docker-transcodeautomation\"\u003e\n\t  \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n# WARNING\n- UPDATEMETADATA if set to true, does not extend the same protections the normal transcode process does. You should absolutely not use it without backing up files first.\n- If you have any file watching services like plex, jellyfin, or emby, TURN THEM OFF during the UPDATEMETADATA process. File watching can corrupt the files as they are remuxed.\n- You are responsible for the integrity of your media and having a plan to recover.\n\n## Transcoding Process and Options\n- This solution comes with preset transcoding options, but if you wish to use your own options, skip to Option 2.\n- The comment metadata is set to `transcoded`. This ensures even if the database is lost or filename changed, the file will not be transcoded again.\n- If the transcoded file is larger than the original it will be excluded and the source file remuxed to only update metadata while keeping all media, video, and audio streams.\n- This process will only process and transcode media in `*.mp4 \u0026 *.mkv` containers. All other files will be excluded.\n\n### Option 1\n- All transcoded media will have the below parameters applied.\n- All video, audio, and subtitle streams are mapped into transcoded files.\n- Title and Description metadata is removed so that proper metadata is presented in certain 3rd party media servers.\n- CRF quality defaults to 21 for movies and 23 for shows.\n- You can customize the [Constant Rate Factor](https://trac.ffmpeg.org/wiki/Encode/H.265#:~:text=is%20not%20recommended.-,Constant%20Rate%20Factor%20(CRF),-Use%20this%20mode) using the environment variables with option 1. See the environment variables section of the readme.\n```powershell\nffmpeg -i \u003cinput\u003e -map 0:v:0? -map 0:a? -map 0:s? -metadata title=\"\" -metadata description=\"\" -metadata COMMENT=\"transcoded\" -c:v libx265 -crf \u003cenv:variable\u003e -c:a copy -c:s copy -preset veryfast -stats_period 60 \u003coutput\u003e\n```\n\n### Option 2\n- Option 2 allows for customizing the majority of the applied ffmpeg parameters.\n- You can apply the custom options by saving the below command to files in the mapped data volume `/docker-transcodeautomation/data`. Use one file for Shows and another for Movies.\n  - `showscustomoptions.ps1`\n  - `moviescustomoptions.ps1`\n- You may replace the `{Custom Options Here}` text with any custom Options you want to use. Be sure to remove the brackets.\n- All other options must be left alone and the $comment variable must be retained, or the transcode automation process will not work as intended. This is because of the way immutable file indexing is considered.\n- Example Options: `-metadata title=\"\" -metadata description=\"\" -map 0:v:0? -map 0:a? -map 0:s? -c:v libx265 -crf 23 -c:a aac -c:s copy -preset veryfast`\n```powershell\n$comment = (Update-Lastindex -DataSource $datasource).newcomment\nffmpeg -i $video -metadata COMMENT=`\"$comment`\" {Custom Options Here} -stats_period 60 \"$env:FFToolsTarget$video\"\n```\n\n## Deploying the image\n### Compose Example\n```yml\nversion: \"3.8\"\nservices:\n  Docker-TranscodeAutomation:\n    image: ghcr.io/thetaylorlee/docker-transcodeautomation:latest\n    container_name: Docker-TranscodeAutomation\n    environment:\n      - BACKUPPROCESSED=true\n      - BACKUPRETENTION=14\n      - MEDIAMOVIEFOLDERS=/media/test/movies, /media/test/movies02\n      - MEDIASHOWFOLDERS=/media/test/shows\n      - MOVIESCRF=21\n      - SHOWSCRF=23\n    volumes:\n      - /home/user/docker/appdata/docker-transcodeautomation/data:/docker-transcodeautomation/data\n      - /home/user/docker/appdata/docker-transcodeautomation/transcoding:/docker-transcodeautomation/transcoding\n      - /media:/media\n    network_mode: none\n    cap_add:\n      - SYS_NICE # Allows ffmpeg to set cpu affinity and allocate memory\n    restart: unless-stopped\n```\n\n### Environment Variables\n#### Required Variables\nENV Variable |  Description | Example\n---------|---------|---------\nBACKUPPROCESSED | If set to true this will result in transcoded files being backed up for x days | BACKUPPROCESSED=false\nBACKUPRETENTION | Number of days to retain a backup copy of transcoded media | BACKUPRETENTION=14\nMEDIAMOVIEFOLDERS | Top level movie directories. Multiple directories must be seperated by \", \" (Comma and a trailing space) and not be surrounded by quotes. | MEDIAMOVIEFOLDERS=/media/test/movies, /media/test/movies02\nMEDIASHOWFOLDERS | Top level show directories. Multiple directories must be seperated by \", \"  (Comma and a trailing space) and not be surrounded by quotes. | MEDIASHOWFOLDERS=/media/test/shows\n\n\n#### Optional Variables\nENV Variable | Description | Example\n---------|---------|--------\nENDTIMEUTC | End of timeframe that transcoding is allowed in UTC 24 hour format | ENDTIMEUTC=02:00\nMINAGE | Minimum age in hours of a file before it's processed | MINAGE=1.5\nMOVIESCRF | [Constant Rate Factor](https://trac.ffmpeg.org/wiki/Encode/H.265#:~:text=is%20not%20recommended.-,Constant%20Rate%20Factor%20(CRF),-Use%20this%20mode) for configuring trancode quality | MOVIESCRF=21\nPROCDELAY | Time delay in hours between processing files | PROCDELAY=4\nSHOWSCRF | [Constant Rate Factor](https://trac.ffmpeg.org/wiki/Encode/H.265#:~:text=is%20not%20recommended.-,Constant%20Rate%20Factor%20(CRF),-Use%20this%20mode) for configuring trancode quality | SHOWSCRF=23\nSTARTTIMEUTC | Beginning of timeframe that transcoding is allowed in UTC 24 hour format | STARTTIMEUTC=17:00\nUPDATEMETADATA | If true, existing media will have metadata updated only | UPDATEMETADATA=true\n\n#### Variable Notes\n- If setting `BACKUPPROCESSED` to true be careful. This can easily lead to filling up drive free space dependent on media processed during the `BACKUPRETENTION` period.\n- `UPDATEMETADATA` can be used to index existing media. Useful if existing media was previously transcoded. After metadata has been updated remove this variable and restart the container.\n- If `ENDTIMEUTC` is an earlier time than `STARTTIMEUTC`, then it will be treated as next day. For example 18:30 UTC start time with an end time of 03:00 UTC, the end time will stop processing new transcodes the next day for the given UTC Datetime.\n- `PROCDELAY` and `MINAGE` defaults are 4 hours. `PROCDELAY` will respect UTC time windows. It is recommended to maintain a larger processing delay to limit excessive disk reads.\n\n\n### Volumes\n\nDocker Volume | Purpose | Example\n---------|----------|---------\nData | Config Files, Database, Database backups and logs, are stored here | /home/user/docker/appdata/docker-transcodeautomation/data:/docker-transcodeautomation/data\nTranscoding | Transcoding of files occurs here | /home/user/docker/appdata/docker-transcodeautomation/transcoding:/docker-transcodeautomation/transcoding\nMedia | Top volume containing media files | /media:/media\n\n### Builds and Tags\nBuild | Architecture | Maintained\n---------|----------|---------\nAlpine3.14-lts | amd64 | no\nAlpine3.17 | amd64 | yes\nUbuntu22.04-lts | amd64 | no\n\nTags | Description\n---------|----------\n`build`-`Architecture`-develop | Most recent dev image for for any build \u0026 architecture\n`build`-`Architecture`-develop-`version` | Versioned dev image for for any build \u0026 architecture\n`build`-`Architecture`-`version` | Versioned image for any build \u0026 architecture\n[latest](https://github.com/TheTaylorLee/docker-transcodeautomation/pkgs/container/docker-transcodeautomation) | There is no longer a latest docker-transcodeautomation build. Breaking changes have dictated requiring version pinning.\n\n## Using included media functions\n- This image comes with various optional PowerShell functions i've added for retrieving useful info. They are not necessary to use.\n- Use `docker exec -i Docker-TranscodeAutomation /usr/bin/pwsh` to get an interactive shell\n```powershell\n#Media Management Functions\nGet-EmptyFolder        #Gets empty directories that can be cleaned up.\nGet-MissingYear        #Gets media missing the year of release in the name\nGet-NotProcessed       #Get files not yet transcoded\nMove-FileToMediaFolder #Move transcoded files back to media folders. TranscodeAutomation will handle this, but this can be useful to handle failed moves sooner.\n```\n\n## Statistics\n- `/docker-transcodeautomation/data/MediaDB.sqlite` volume file is a sqlite database containing media data and statistics\n- Any sqlite viewer of choice can be leveraged if desired to view this data\n- [Here is an example using Grafana](https://github.com/TheTaylorLee/docker-transcodeautomation/tree/master/examples/grafana)\n\n## Additional Notes\n- If a file is is replaced by another file of the same name, and the old file is deleted, statistics cannot update sooner than (25 hours + PROCDELAY + MINAGE). This ensures statistics are not lost in rare circumstances. Becuase of this the container must run at a minimum that long without restart prior to a replaced files database entry being updated.\n- Docker logs should provide hints to the root of the issue and relevant snippets need to be included in opened issues.\n- If the logs indicate that there are files leftover in the transcoding directory you must remove them. This is a safety feature that ensures failed transcodes don't replace original files.\n- If your media database becomes corrupted, use the backed-up databases to restore a healthy copy.\n  - /docker-transcodeautomation/data/MediaDB.SQLite #database location\n  - /docker-transcodeautomation/data/Backups #BackupsLocation\n- If wanting to add media to an existing watched directory but not actually transcode it; remux it with comment of dta-remuxed.\n  ```bash\n  # replace $oldname and $name with filepaths\n  ffmpeg -hide_banner -loglevel error -stats -i $oldname -map 0:v:0? -map 0:a? -map 0:s? -metadata title=\"\" -metadata description=\"\" -metadata COMMENT=\"dta-remuxed\" -c copy -stats_period 60 $name\n  ```\n","funding_links":[],"categories":["HarmonyOS"],"sub_categories":["Windows Manager"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheTaylorLee%2Fdocker-transcodeautomation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FTheTaylorLee%2Fdocker-transcodeautomation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FTheTaylorLee%2Fdocker-transcodeautomation/lists"}