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

What is this? #1

Closed
Unknown78 opened this issue Dec 7, 2022 · 9 comments
Closed

What is this? #1

Unknown78 opened this issue Dec 7, 2022 · 9 comments

Comments

@Unknown78
Copy link

Unknown78 commented Dec 7, 2022

What is this? What does it do? How to use it? How do you extract/convert the usm format in the first place?

I'd like to have it back as .mp4 and .srt file, is that possible?

@Devyatyi9
Copy link
Owner

Devyatyi9 commented Dec 10, 2022

@Unknown78 this code is used to read subtitles from usm files and export it. I tried changing the subtitle text inside these files, but it didn't work for all files.
There is also a raw program for converting mp4 to usm along with subtitles, it was written by art-serious, I don’t know if it is registered on github. I added a little to his code, it's a pity that while the usm format cannot be converted to usm.

at least it works exactly for files from honkai impact

@Unknown78
Copy link
Author

Unknown78 commented Dec 11, 2022

@Devyatyi9 If I want to convert any .usm file into .mp4 video and .srt subtitle, just like the old version of honkai impact around some months ago, what should I do?

@Devyatyi9
Copy link
Owner

Devyatyi9 commented Dec 13, 2022

@Unknown78 use VGMToolbox
.adx is sound and .m2v is video
2022-12-13_18-51-42
2022-12-13_18-55-13

And to extract subtitles use this tool from cmd.
Example:
hi3_usm_srt_tool.exe -extractSbt "usm_videos/Story_06.usm"
hi3_usm_srt_tool.exe -extractSbt "usm_videos/Story_06.usm" "srt/Story_06.srt"

although I am not sure that the subtitle timings will be converted correctly for some files

Also, there are mp4 videos before 5.8
https://drive.google.com/file/d/1ij3SBAaGuzoAFYiownkUMXoL8ogYUcKq/

@Unknown78
Copy link
Author

Unknown78 commented Dec 13, 2022

@Devyatyi9

When I'm extracting the .usm file, I got .m2v as video but .hca as sound instead of .adx.
Is that okay?

I could run ffmpeg with this command to combine it just fine though
ffmpeg -i 6.2PV_d8052964b502223025b122ef40c2ca5d_40534656.m2v -i 6.2PV_d8052964b502223025b122ef40c2ca5d_40534641.hca 6.2PV_d8052964b502223025b122ef40c2ca5d_40534656.mp4


And now I have a different problem,
After successfully combined the .m2v and .hca with the command above and extracting the subtitles into .srt.
The extracted .srt file has multiple lines, but only the first line that appears in the video.
Every other line is just not show up, I run on Media Player Classic and also VLC player, and the result is the same.

This is the ffmpeg log:
6.2PV_ffmpeg_log.txt

This is the extracted .srt file:
6.2PV_d8052964b502223025b122ef40c2ca5d_40534656.txt
I upload it as .txt because of GitHub limitation.

@Devyatyi9
Copy link
Owner

Devyatyi9 commented Dec 14, 2022

@Unknown78 .hca is also a CRI audio format, should work.
in the srt file, there is probably an error in some time values. can be edited through the subtitle editor like Aegisub.
it is necessary to compare with the original usm file, although I never wrote the reading template of this format for 010 Editor.
Are there any problems with video and sound?
By the way, I use Daum Potplayer because it supports many formats and codecs.

I had an idea to rewrite this code in another language like C#
although I have already done, together with another person, what it was all done for - to replace English subtitles with Russian ones.
Though only for old cutscenes.

if you want to compare these values manually through a hex editor, then here is a description of @sbt structures in which subtitles are written.
Check start time and end time, it's integer value (uint/sint).
Dbk5PBB
Ok, I already checked it, and the values are the same, strange, maybe the problem is null characters, then you just need to remove them from the srt file, for example, using Notepad++

@Unknown78
Copy link
Author

Unknown78 commented Dec 15, 2022

@Devyatyi9

There are no problem with video or sound at all, just the subtitle that has the problem.

Thanks for recommending me a new player, according to someone's detailed review, it seems that PotPlayer is a good player.
But in my case, the first line won't even shown at all, the subtitle couldn't be loaded.

And I think I found that there is a bug in the hi3_usm_srt_tool.exe program.


Please take a look at this screenshot.
screenshot 1671114811

In your description at USM Video format.txt, it says:

time end = time begin + time end

I would prefer to call it time duration instead of time end twice tough.
so time end = time begin + time duration

But the program extract the time end as time duration only, without adding it up with time begin.
Take a look on the screenshot, next right to ---> is the time duration and not the time end.
The .srt is in incorrect format. And that's why it failed to be load properly.

The program need to be fixed.

P.S. I'm on SEA server if that matters....

@Unknown78
Copy link
Author

Unknown78 commented Dec 30, 2022

@Devyatyi9 How do I get the program to be fixed?

@Devyatyi9
Copy link
Owner

Devyatyi9 commented Jan 2, 2023

@Devyatyi9 How do I get the program to be fixed?

Sorry for the long answer.
I just forgot that someone still needs me on github.
Yes, I need to correct these descriptions, I made them in a hurry just for myself when I was just dealing with this format.
And I think it doesn't matter which server you're playing on, in my opinion the file is the same.

I can try to explain what is needed in order to run it all and change the code. Although I would prefer to rewrite it all into a more popular language so that there are fewer problems.

@Devyatyi9
Copy link
Owner

Devyatyi9 commented Jan 2, 2023

  1. Install VSCode https://code.visualstudio.com/download
  2. Install Haxe https://haxe.org/download/
  3. Install C++ library for Haxe https://lib.haxe.org/p/hxcpp/
  4. You will also need a Visual Studio C++ compiler, or different C++ compiler like MinGW
  5. Haxe extensions for VSCode:
    nadako.vshaxe
    vshaxe.hxcpp-debugger

@Devyatyi9 Devyatyi9 pinned this issue Mar 6, 2023
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

2 participants