Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sunrise2575/AutoAVS
Automated Audio, Video, Subtitle Tool (ffmpeg 벌크 인코딩 툴)
https://github.com/sunrise2575/AutoAVS
audio bulk encoding ffmpeg golang h265-hevc opus transcoding video vp9
Last synced: about 2 months ago
JSON representation
Automated Audio, Video, Subtitle Tool (ffmpeg 벌크 인코딩 툴)
- Host: GitHub
- URL: https://github.com/sunrise2575/AutoAVS
- Owner: sunrise2575
- Archived: true
- Created: 2019-02-26T12:01:57.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-20T07:14:40.000Z (over 2 years ago)
- Last Synced: 2024-08-02T20:45:19.452Z (5 months ago)
- Topics: audio, bulk, encoding, ffmpeg, golang, h265-hevc, opus, transcoding, video, vp9
- Language: Go
- Homepage:
- Size: 6.3 MB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This repository is no longer maintained.
Use https://github.com/sunrise2575/dist-ffmpeg instead. Thanks.
# AutoAVS
The automated audio, video, subtitle tool. Currently audio and video is supported.
## When to use this program?
- Transcode hundreds of video/audio file **seamlessly** in a computer as the manner of **bulk processing**
- Just hit Enter button, and your computer can't be idle before finishing jobs
- Select single stream from multiple streams **automatically**, transcode/copy each stream, and merge into single file
- Supports **user query** for general usage conditions (note: `query_*.json`)
- movie, drama, anime, music, ... whatever you want to transcode
## Requirements
### Basic requirements
- golang (for program compile)
- `ffmpeg`, `ffprobe`
- Note: I developed and tested in `ffmpeg 3.4.8-0ubuntu0.2 built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)` version
- (Optional) Linux
- I haven't tested on Windows environment, but if you replace `ghw.PCI` package to another way, you can utilize my program.
### (Optional, but recommended) requirements for using GPU
- This program can utilize `ffmpeg`'s NVENC support, so you can use your NVIDIA GPU for transcoding
- You can see the list of NVENC devices here: https://developer.nvidia.com/video-encode-decode-gpu-support-matrix
- You can see that older GPUs can't support much codecs.
- This program doesn't use NVDEC for supporting various codecs without errors, i.e. decode on CPU → encode on GPU)
- Note: NVDEC supports few codecs like H264, HEVC, VP8, VP9, AV1, ...
- NVIDIA graphics driver (you should see the result of `nvidia-smi` command)
- NVIDIA **NVENC limitation unlock** patch: https://github.com/keylase/nvidia-patch
- That website's `Max # of concurrent sessions` is a kind of NVIDIA's fraud. It is implemented as GPU driver, so it is a software lock.
- GPU can have capability to running multiple encoding/decoding session over this software limit. This limit can be unlocked by this patch
- If you can't/don't patch, you can't run multiple session **even you have multiple GPUs**
## How to use
1. Write down the query in `*.json` file. Your all video/audio files under the selected directory will be processed by this query. The default `query_*.json` files are included in this package. The query is designed like:
```
{
// "input" section
"input": {
// the program scans following files
"extension": ["mp3", "mkv", "mp4", ...]
},// "output" section
"output": {
"stream": [
// "stream" is an array, and the order decides output media stream
// For example,
// "stream": input query = [{"codec_type":"audio", ...}, {"codec_type":"video", ...}]
// -> file's output stream order = ["audio", "video"]
{
// "codec_type" is "video", "audio", and "subtitle"
"codec_type": "video",
// This example means that:
// The 1st stream will be video// You can omit "select_prefer" and "select_priority"
// Which means that you choose 0-th video stream whatever it is// You can write "copy_if" here
"copy_if": {
// in this section, you can write regex JSON compare query
"codec_name": "^(hevc)$",
"pix_fmt": "^(yuv420p)$"
},// This stream's example section means that:
// If "codec_name" is "hevc"
// and "pix_fmt" is "yuv420p",
// then the program just copies this stream.
// Otherwise this stream should be transcoded// ffmpeg transcoding parameter
"ffmpeg_parameter": {
"c": "hevc_nvenc",
"pix_fmt": "yuv420p",
"profile": "main",
"level": "auto",
"preset": "hq",
"qp": "25"
// This example section means that:
// ffmpeg ... -c:v hevc_nvenc -pix_fmt:v yuv420p -profile:v main -level:v auto -preset:v hq -qp:v 25 ...
},"temp_file_extension": "mkv" // temp file extension before merging
},
{
// "codec_type" is "video", "audio", and "subtitle"
"codec_type": "audio",
// This example means that:
// The 2nd stream will be audio"select_prefer": {
// in this section, you can write regex JSON compare query
// regex is combined golang-optional regex and perl regex"channels": 2,
"tags": {
"language": "^(eng|und)$",
"title": "(?i)^(?!.*comment).*$"
// note: (?i) is golang-style regex, means insensitive
// for additional options like global, multiline, ... you should use golang-style regex
// note: ^(?!.*comment).*$ is perl-style regex (i.e. lookahead)
// for core regex, you should use perl-style regex
}
},// "select_priority" is
"select_priority": ["tags.title", "tags.language"], // select_prioritty// This stream's example section means that:
// If "channels" is 2
// and "language" is "eng" or "und"
// and "title" is not including "comment", the program prefers to choose.
// Especially the program gives most priority for "tags.title",
// second priority for "tags.language"
// and other JSON fields are equally same priority
// Basically, choose only 1 stream for this "codec_type" from entire audio stream candidates,
// therefore the highest ranked stream is selected// you can omit "copy_if" section
// Which means that that:
// All kinds of audio stream should be transcoded// ffmpeg transcoding parameter
"ffmpeg_parameter": {
"c": "libopus"
// What this example section means is that:
// ffmpeg ... -c:a libopus ...
},"temp_file_extension": "mka" // temp file extension before merging
}
],// final output extension
// If the number of requested stream in query is just one,
// and its "temp_file_extension" and this "extension" is same,
// then the merging process is skipped, because its behavior is just useless file copying.
"extension": "mp4"
}
}
```Note: `"codec_type"`, `"select_prefer"` and `"copy_if"` compares its value to the result of following command:
```bash
ffprobe -v quiet -print_format json -show_streams
```2. Run the program by following command, sit back and watch
(Note: This program recursively found video files under the root folder designated by `-root` flag.)
```bash
go run . -config -root -worker
```## Note
- This program has been developed for my personal usage. Please be generous for little failure. (But I personally think the program is quite reliable.) You can submit some pull request for fixing bugs and helping me.
- Also, you can fork my repostory, but please notify me when not using this program in personal way (e.g. commercial use, integrate to open source module, ...).
## TODO
- Subtitle extraction and conversion (SRT, SAMI, VTT, ...)