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

Automated Subtitle SRT Encoding To MKV #203

Open
leuchtrakete666 opened this issue Dec 31, 2021 · 6 comments
Open

Automated Subtitle SRT Encoding To MKV #203

leuchtrakete666 opened this issue Dec 31, 2021 · 6 comments

Comments

@leuchtrakete666
Copy link

leuchtrakete666 commented Dec 31, 2021

i have the subtitles in the same folder as the mkv file. the format is srt. i want to encode the subtitles in a new mkv file. this should be done with a new profile. all is set perfect, but the subtitles are not recognized.

subtitles are in the same folder as the mkv file. they are named like {moviename}.de.srt. but in the handbrake tab subtitles they dont show up. of course it works when i import them manually via the add subtitle tab, but i have many mkv with srt subtitle files and i want the subtitles with the video in one mkv container. my goal would be to do this all automatically with the docker. the subtitle files are all named exactly like the mkv, except for the extension.

is there a way to achieve this?

EDIT: maybe with AUTOMATED_CONVERSION_HANDBRAKE_CUSTOM_ARGS srt-file ${filename%.*}.de.srt
but whats the variable for the actual filename?

thanks for the support.

@leuchtrakete666
Copy link
Author

leuchtrakete666 commented Jan 3, 2022

i found in the autoconverter service that the videofile variable is $video. but --srt-file "${video%.*}.de.srt" don't work.

i have almost no experience in scripting. i found that the variable for the custom argument is $AC_HANDBRAKE_CUSTOM_ARGS. please help me to achieve this. so the string from above will be handed over with this variable. but like i said it don't work. the variable itself is correct.

i tried like this:

$ video=test.mkv
$ echo "${video%.*}.de.srt"
$ test.de.srt

when i look at the logs i find this error:

ERROR: Could not open the SRT subtitle file '${video%.*}.de.srt'

ERROR: Failure to initialise thread 'SRT Subtitle Decoder'

thanks

@leuchtrakete666
Copy link
Author

there is no solution for my problem?

too sad.

@jlesage
Copy link
Owner

jlesage commented Feb 23, 2022

Usually HandBrake deals with subtitles embedded into the video container. I'm not sure how to do it with external files. You can try to play with the HandBrake CLI to see if you can achieve what you want by running manual commands. Once we know how to do it with the CLI, we can evaluate if this can be done automatically.

@leuchtrakete666
Copy link
Author

should work with the cli. i have no time now to play with this. maybe tomorrow i will try.

--srt-file <string>  SubRip SRT filename(s), separated by commas.
--srt-codeset <string>
                     Character codeset(s) that the SRT file(s) are
                     encoded as, separated by commas.
                     If not specified, 'latin1' is assumed.
                     Command 'iconv -l' provides a list of valid codesets.
--srt-offset <string> Offset (in milliseconds) to apply to the SRT
                     file(s), separated by commas. If not specified,
                     zero is assumed. Offsets may be negative.
--srt-lang <string> SRT track language as an ISO 639-2 code
                     (e.g. fre, eng, spa, dut, et cetera)
                     If not specified, then 'und' is used.
                     Separate by commas.
--srt-default[=number]
                     Flag the selected SRT as the default subtitle
                     to be displayed during playback.
                     Setting no default means no subtitle will be
                     automatically displayed. If 'number' is omitted,
                     the first SRT is the default.
                     'number' is a 1-based index into the 'srt-file' list
--srt-burn[=number]   "Burn" the selected SRT subtitle into
                     the video track.
                     If 'number' is omitted, the first SRT is burned.
                     'number' is a 1-based index into the 'srt-file' list
--ssa-file <string>   SubStationAlpha SSA filename(s), separated by
                     commas.
--ssa-offset <string> Offset (in milliseconds) to apply to the SSA
                     file(s), separated by commas. If not specified,
                     zero is assumed. Offsets may be negative.
--ssa-lang <string>   SSA track language as an ISO 639-2 code
                     (e.g. fre, eng, spa, dut, et cetera)
                     If not specified, then 'und' is used.
                     Separate by commas.
--ssa-default[=number]
                     Flag the selected SSA as the default subtitle
                     to be displayed during playback.
                     Setting no default means no subtitle will be
                     automatically displayed. If 'number' is omitted,
                     the first SSA is the default.
                     'number' is a 1-based index into the 'ssa-file' list
--ssa-burn[=number]   "Burn" the selected SSA subtitle into
                     the video track.
                     If 'number' is omitted, the first SSA is burned.
                     'number' is a 1-based index into the 'ssa-file' list                           

@Kleinja
Copy link

Kleinja commented Dec 5, 2022

Any updates on this by chance? I would love to see the functionality to upload the external SRT file when running automatically. I have been trying to keep my library using embedded subs only, and it would be nice to have this done automatically. In my situation, the folder that contains the video file will also contain the SRT file. Not sure how easy it would be for Handbrake to scan the folder and if there are any SRT files, import them automatically.

@mkjustuk
Copy link

Bringing this one back, but I have the same scenario/requeset - have the .SRT file in the same folder as the video file added as a 'soft' subtitle track when encoding, so that the .SRT file is then no longer required post-processing.

Did anyone get any further with this? Happy to spend some time on figuring the CLI aspect if that's still unknown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants