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

Command option to change font size #41

Closed
phuchptty opened this issue Sep 9, 2022 · 11 comments
Closed

Command option to change font size #41

phuchptty opened this issue Sep 9, 2022 · 11 comments
Labels
enhancement New feature or request

Comments

@phuchptty
Copy link
Contributor

like the title, I hope the feature change font size because the subtitle is still a bit large.

I will try to look into it when I have time

@ToaHartor
Copy link
Owner

Good idea, this can be included in the CLI improvements.

In fact, it's quite easy to do at the first set conversion, by modifying the ASS header in the generation. However, if the ASS already exists, then we will have to modify the default style in the existing ASS.

@phuchptty
Copy link
Contributor Author

I think we can modify it in the engine struct. Bypassing an argument to the engine.
It will override the ASS default setting, I guess

@ToaHartor
Copy link
Owner

ToaHartor commented Sep 9, 2022

Tried to look at it quickly, and all I could find is the modification of the subtitles file, for both FFMPEG and mkvmerge. I guess that's mainly because of the way the mkv format works.
In theory, the subtitles in a mkv file is copied in raw, and there is no tag to override the style inside. As the subtitles aren't burned in the video, it's up to the player to read them. Therefore, it's possible to modify the font style (using a font embedded in the mkv file) and size during the playback. But if we want to impose a font style (with the official font) and the right size, it has to be done directly in the ASS file.

This line in ASS.cs, right after the _fontname is the fontsize. Like the font name, we can add the font size directly at the object creation, and then reuse it in ConvertToAss() and in a new function that would parse an ASS file and modify the line starting with Style: Default,{_fontname},.

@phuchptty
Copy link
Contributor Author

Okay, I see. But we should fix the issue with duplicate subfile (txt and srt) first. After that adding font size is pretty simple.

@ToaHartor ToaHartor added this to the v0.5.0 - CLI improvements milestone Oct 24, 2022
@ToaHartor ToaHartor added the enhancement New feature or request label Oct 24, 2022
@Scighost
Copy link
Contributor

I think the following subtitle styles are more appropriate. There is still a little difference in shadow and text spacing, but it doesn't matter.

Change Fontsize to 12 and MarginV to 14.

- Style: Default,{_fontname},18,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100.0,100.0,0.0,0.0,1,0,0.5,2,10,10,20,1
+ Style: Default,{_fontname},12,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100.0,100.0,0.0,0.0,1,0,0.5,2,14,14,14,1

Comparison:

未标题-1

@phuchptty
Copy link
Contributor Author

Yeah. But there is a problem is when you convert subtitles to ass. It will cache in your subtitles folder, so I'm finding some way to remove it if the font size change

@Scighost
Copy link
Contributor

Yeah. But there is a problem is when you convert subtitles to ass. It will cache in your subtitles folder, so I'm finding some way to remove it if the font size change

Maybe that's your video player's problem.

@ToaHartor
Copy link
Owner

I think he meant that once you already converted the subs in .ass, you can't change the font size (and other things) by the command line. Which would be an improvement.

@Scighost
Copy link
Contributor

I see.
The subtitles in repo GenshinData only have srt and txt file without style. When I use --subs option, the program will convert srt to ass. It's a bad way.
I think the program cannot modify any file in GenshinData folder, and the converted ass files can be saved in a temp folder.

@ToaHartor
Copy link
Owner

ToaHartor commented Oct 25, 2022

Thinking about it, yes that's not really convenient. An idea would be to create a "subs" folder with a folder structure similar to the GenshinData repository. The program could then first check this folder to get the .ass files, then if it doesn't find anything, fallback to the GenshinData folder. If there is any modification to do to the files, it could then directly modify the .ass files in the right folder.

Would it require to have an option in the command line/settings file to indicate the path of it to make it configurable to the user ?

However, a problem I can see is if some subtitles change in the main repository. But that could be avoided by adding an option to force update the subs and therefore rebuild the .ass files.

@Scighost
Copy link
Contributor

Scighost commented Oct 25, 2022

Create subs folder in output folder is a better way, and if user not add --no-cleanup option, delete subs folder at the end. GenshinData doesn't delete any subtitle file since first commit, so it's unnecessary to reserve .ass file.

If user wants to custom one video subtitle style, he needs to modify at least 13 files manually and tediously. A solution is define a optional SubsStyle key in appsetting.json, if the key is null or white space, fallback to the default style.

For example:

"SubsStyle": "Style: Default,{_fontname},12,&H00FFFFFF,&H000000FF,&H00000000,&H00000000,0,0,0,0,100.0,100.0,0.0,0.0,1,0,0.5,2,14,14,14,1"

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

No branches or pull requests

3 participants