Setting default SRT encoding in app?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
IrishKat
Posts: 4
Joined: Sun Aug 13, 2017 1:42 am

Setting default SRT encoding in app?

Post by IrishKat »

Is there anyway to set a specific encoding as the default for all SRT? I've got upwards of 50 episodes to convert and things would go a lot faster if I didn't have to specify UTF-8 for all of them, one by one. Though all that being said is there anyway to get Handbrake to automatically add the same named SRT file when it's scanning the source?

Thanks
rollin_eng
Veteran User
Posts: 4840
Joined: Wed May 04, 2011 11:06 pm

Re: Setting default SRT encoding in app?

Post by rollin_eng »

Script the CLI.
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Setting default SRT encoding in app?

Post by mduell »

Yea, I'm with rollin here, trivial batch script for the HB CLI.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: Setting default SRT encoding in app?

Post by BradleyS »

It would be nice to automatically detect utf-8 encoded files.
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: Setting default SRT encoding in app?

Post by Woodstock »

It would also be nice if UTF-8 files were always properly tagged as such.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: Setting default SRT encoding in app?

Post by BradleyS »

Indeed. But it's generally not hard to detect these days. Basically parse as utf-8 and if there are any errors during parsing, it's not valid utf-8.
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: Setting default SRT encoding in app?

Post by BradleyS »

Of course this doesn't hold true for some bytes that are valid utf-8 but mean something else in another encoding. But most of the time it works, especially on long text. Would be better than nothing, perhaps.

We could theoretically use something like enca (https://github.com/nijel/enca) to detect other encodings it supports and then iconv (which we already use) to convert to utf-8.
IrishKat
Posts: 4
Joined: Sun Aug 13, 2017 1:42 am

Re: Setting default SRT encoding in app?

Post by IrishKat »

rollin_eng wrote: Sun Aug 13, 2017 7:30 am Script the CLI.
mduell wrote: Sun Aug 13, 2017 7:34 pm Yea, I'm with rollin here, trivial batch script for the HB CLI.
When you say script the CLI... ...? Dipping my toe into the CLI version here. I've always used the GUI version. Can I use the enclosing folder as the source and destination?
Woodstock
Veteran User
Posts: 4614
Joined: Tue Aug 27, 2013 6:39 am

Re: Setting default SRT encoding in app?

Post by Woodstock »

With the CLI, you can put the output anywhere you please. But that means you lose the protections the GUI has to try to prevent things like overwriting the source file with the output file.
IrishKat
Posts: 4
Joined: Sun Aug 13, 2017 1:42 am

Re: Setting default SRT encoding in app?

Post by IrishKat »

Woodstock wrote: Wed Aug 16, 2017 6:56 pm With the CLI, you can put the output anywhere you please. But that means you lose the protections the GUI has to try to prevent things like overwriting the source file with the output file.
If I select a folder instead of a file (will it even allow that?) will it run the command on all the files in it? Sidenote: This is going well -.- I'm still trying to get the CLI to run in Terminal...
mduell
Veteran User
Posts: 8187
Joined: Sat Apr 21, 2007 8:54 pm

Re: Setting default SRT encoding in app?

Post by mduell »

IrishKat wrote: Wed Aug 16, 2017 7:15 pmIf I select a folder instead of a file (will it even allow that?) will it run the command on all the files in it?
No, it takes one file at a time as input. Write a short script to iterate through each file you'd like in the scripting language of your choice.
IrishKat
Posts: 4
Joined: Sun Aug 13, 2017 1:42 am

Re: Setting default SRT encoding in app?

Post by IrishKat »

Considering I don't do any scripting, I think I've already hit the limit on how much effort I'll be putting in vs how much I'll get out of it. Thanks anyway for all your help!
User avatar
BradleyS
Moderator
Posts: 1860
Joined: Thu Aug 09, 2007 12:16 pm

Re: Setting default SRT encoding in app?

Post by BradleyS »

I created a new issue on GitHub to track any progress toward implementing this feature: https://github.com/HandBrake/HandBrake/issues/861
Post Reply