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

Apply offsets in a file distinct from the incorrect subtitle file #45

Open
qgustavor opened this issue Aug 10, 2022 · 0 comments
Open

Comments

@qgustavor
Copy link

qgustavor commented Aug 10, 2022

Example:

  • You got reference_subtitle.ssa incorrect_subtitle.srt and incorrect_chapters.xml,
  • Run alass on those three files and get a correct_chapters.xml files based on the offsets from incorrect_subtitle.srt to reference_subtitle.ssa

Possible command syntax:

  • alass reference_subtitle.ssa incorrect_subtitle.srt correct_chapters.xml --content-source=incorrect_chapters.xml:
    a flag, quite simple but a bit weird because all other arguments are positional
  • alass reference_subtitle.ssa incorrect_subtitle.srt incorrect_chapters.xml correct_chapters.xml:
    4 positional arguments means that the output argument is now the source which the offsets will be applied and the fourth argument is now the output
  • alass reference_subtitle.ssa incorrect_subtitle.srt correct_chapters.xml incorrect_chapters.xml:
    4 positional arguments means that the last argument is now the source which the offsets will be applied

Possible issues and solutions:

  • Adding the Matroska .xml chapter format might be hard or introduce too much complexity. In that case I think that's fine just adding this option and only allowing it to be used on the already accepted formats. Handling chapters would be still possible if I write a .xml to .ass to .xml converter (I think I can write one and publish in CodePen without any problem using ass-parser and DOMParser Edit: here it is).
  • Maintainers might not have time for that. In that case I will try to implement it myself and submit a pull request. I never worked with Rust before, but I think implementing it would require - from what I read in the code - just replacing inc_file in some parts of the code with a reference to the file to be used as input when the extra argument with the override source is inputted.

Edit: I tried implementing it myself and here are the changes I made. I tested this code and it worked, in the other hand the synchronized chapters were offset from the correct timings by up to 30 seconds, so I don't know if I messed up the implementation or if the reference file I used when testing was not ideal.

Edit: I didn't implemented timestamp format conversion in the xml to ass converter and - for some reason - passing a .ass file to alass with a lot of leading zeros - which is what the xml stores - made it return completely wrong timings. I probably need to fix my converter to use the expected timestamp format in ass, but that was weird. I assumed the timestamp parsing just assumed a colon delimited list of integers followed by a float value, thus the leading zeroes would not cause any issue.

qgustavor added a commit to qgustavor/alass that referenced this issue Aug 11, 2022
It uses the third proposed command syntax
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

1 participant