|
6 months ago | |
---|---|---|
internal | 6 months ago | |
pkg/encoder | 6 months ago | |
.gitignore | 6 months ago | |
LICENSE | 11 months ago | |
cmd.go | 6 months ago | |
config.yaml | 11 months ago | |
go.mod | 7 months ago | |
go.sum | 7 months ago | |
readme.md | 6 months ago |
readme.md
movie-Util
This script started out as a simple cli program that wraps Go bindings for FFMPEG but now it exists to do all the old stuff (extract SRT files from MKVs, convert the MKV to MP4, and select audio tracks).
If you wish to upload manipulated media to a linx server check out my linx client
Requirements
This utility requires the user have FFmpeg and FFprobe installed.
If you would like to use handbrake-cli to convert the files instead of ffmpeg please install the handbrake-cli.
Building
You can build the script with Golang installed on your computer just run
go build -o movie-util
Alternatively there will be a binary provided in the releases page
Usage
It is simple to run
movie-util [file.mkv] -l
where [file.mkv] is the mkv file that has subtitles tracks.
The output will be a list of all sub and audio tracks example (note: this used to output in a stupid way, it now currently normalizes tracks from 0 the way ffmpeg expects it)
Lucky Star - Episode 01 - The Girl who Dashes Off.mkv
0 "opus" "jpn" "audio"
1 "opus" "eng" "audio"
0 "ass" "jpn" "(Moe) Full Subs" "subtitle"
1 "ass" "eng" "(Moe) Signs \u0026 Songs" "subtitle"
2 "ass" "jpn" "(Virus 123) Full Subs" "subtitle"
3 "ass" "eng" "(Virus 123) Signs \u0026 Songs" "subtitle"
4 "subrip" "jpn" "(Exiled-Destiny) Full Subs" "subtitle"
5 "subrip" "eng" "(Exiled-Destiny) Signs \u0026 Songs" "subtitle"
6 "ass" "jpn" "(Tsundere) Full Subs" "subtitle"
7 "ass" "eng" "(EpicLittleWeeblet) Full Dubtitles" "subtitle"
movie-util [file.mkv] -et N
where is the track listed above and [file.mkv] is the file to extract from.
Output:
util extract --sub-track 3 Lucky\ Star\ -\ Episode\ 01\ -\ The\ Girl\ who\ Dashes\ Off.mkv
2022/10/12 17:46:05 compiled command: ffmpeg -i Lucky Star - Episode 01 - The Girl who Dashes Off.mkv -map 0:s:3 Lucky Star - Episode 01 - The Girl who Dashes Off.srt -y
This extracts to [FileName.srt] example: 'Lucky Star - Episode 01 - The Girl who Dashes Off.srt'
It is also possible to extract ASS subs from an mkv by running
movie-util <filename> -ebt N -- to extract subs to ASS format
To convert a file from mkv to mp4 with ASS subs embedded into the file you can run
movie-util <filename> -mxt <track-from-above-command>.ass
movie-util [file.mkv]
where [file.mkv] is the files to convert to mp4 codec.
Alternatively, now you can use FFMPEG to convert files to mp4 with the -x
flag
movie-util [file.mkv] -x
will run FFMPEG to convert the file with the following flags set -c:v libx264 -c:a aac
.
This can take multiple filenames as input with the -f
flag
movie-util -f [file.mkv],[file1.mkv],[file2.mkv],[fileN.mkv]
and will convert them sequentially.
movie-util -sa <n> [file.mkv]
where n is the audio track number from the list
command and filename is the name of the file. This will set the audio track to which ever is the one passed to the program however
this creates a copy of the file as I was unable to find a way to change the default audio track without doing it this method. It will create it as [filename-copy.mkv].
movie-util -c [file.srt]
where file.srt
is the srt file you wish to convert to a vtt.