Jump to content

Script to extract subs


neik

Recommended Posts

neik

Hello,

 

I have been looking for a script that extracts the internal subs of my files so I can convert them to external SRT if necessary (e.g. sub/idx or pgs).

I found this script (https://pastebin.com/MmKQjjYB) in the web and it works like a charm but if a file for instance has two english subs (one normal and one SDH) the first extracted gets overwritten by the second one.

I would like to keep both so I could have a look at both but do not know how I need to adopt the script.

 

Does anyone have a hint?

Anything is appreciated, thank you!

Link to comment
Share on other sites

PenkethBoy

sorry its a bash script and not my area

 

but a quick look shows it would overwrite any "duplicate" sub language - so needs adjusting to account for duplicates

 

SDH subs are for the hearing impaired so descriptive rather than normal subs 

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...
Mibok

If your media is in mkv, you can try MKVcleaver (it requires MKVtoolnix) it has a gui but you can add multiple files and select the tracks you want to extract, however it doesn't delete te subs from within the source file.

 

Enviado desde mi Inco Aurora II mediante Tapatalk

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
muzicman0

Have you tried CCExtractor?  I use it in a script I posted for recorded TV, and has full access via CLI.  Seems to work great, but I am not sure of it only works on Closed Captions, or if it would work on subs in movies as well.

 

EDIT: I tried extracting subtitles on a Blu-ray rip that I have, and I couldn't make it work, so it looks like it only works on Closed Captions.  Sorry.  

Edited by muzicman0
Link to comment
Share on other sites

neik

did anyone copy this script? the pastebin has been removed. if so, if you post it here, I will adapt it for you.

 

Sorry for the delay, didn't see your post earlier.

 

Please see attached the current script and thank you for your willing to help.

script_subs.txt

Edited by neik
Link to comment
Share on other sites

Sorry for the delay, didn't see your post earlier.

 

Please see attached the current script and thank you for your willing to help.

Thanks!

Link to comment
Share on other sites

  • 3 weeks later...
neik

AH Sorry I downloaded it but got side tracked and forgot. I will look this evening.

@@t1m, were you able to have a look at it yet?

Link to comment
Share on other sites

  • 4 months later...
dovedescent7
On 5/27/2020 at 5:29 AM, neik said:

@@t1m, were you able to have a look at it yet?

I want to attemt to use this, but I'm hoping there is nothing malicious in this code! 

Help? This is EXACTLY what I have been looking for though.

Questions:

1. This script is In Danish or German but I only speak and type in English. Will the language difference affect how it works? 

2. Could someone explain to me, as if I was a child, how I could apply this to my Emby server?

3.Can I create a scheduled task to scan my library daily to extract newly downloaded video's subtitles? 

 

 

Link to comment
Share on other sites

18 minutes ago, dovedescent7 said:

I want to attemt to use this, but I'm hoping there is nothing malicious in this code! 

 

There is not otherwise I wouldnt post it here!

 

18 minutes ago, dovedescent7 said:

1. This script is In Danish or German but I only speak and type in English. Will the language difference affect how it works? 

 

The script is extracting English and German subs (if available) only.
You would need to adapt it to your language.

 

25 minutes ago, dovedescent7 said:

3.Can I create a scheduled task to scan my library daily to extract newly downloaded video's subtitles? 

 

Within Emby idk but you could surely run a cronjob.

 

PS: If you're worried about "your" data then simply create a test setup to learn what the script does...

Link to comment
Share on other sites

  • 2 weeks later...
rbjtech

It's a bit of a hack - but this is what I use as part of my media prep script ...

"C:\Tools\eac3to\eac3to.exe" -demux "%%x"

for %%f in ("\batch\temp\*English*.srt") do copy "%%f" "%%~dx%%~px%%~nx.en.srt"
for %%f in ("\batch\temp\*Force*.srt") do copy "%%f" "%%~dx%%~px%%~nx.forced.en.srt"
for %%f in ("\batch\temp\*Alien*.srt") do copy "%%f" "%%~dx%%~px%%~nx.forced.en.srt"

It basically uses eac3to to demux all the streams, it then copies any .srt files with English in the filename (eac3 named) including SDH etc to the media location.  It does the same with forced subs.

It then deletes the temp demux files.

Nasty, but it works a treat .. 🤪

 

 

Link to comment
Share on other sites

  • 7 months later...
  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...