Monday, June 2, 2025

FFmpeg woes and a good way to automate subtitling ingame movies

Dear Citizens of Monopolis,

it has been too long, hasn't it? All kinds of stuff is keeping me busy, with work and daily life throwing curve balls at me for quite a while. But i didn't forget, working bit by bit on the fan translation.

Today i want to tell you about my journey of trying to automate the translation of the ingame movies. With the recent breakthrough in LLMs i was able to make use of

  1. ps2str to demux the original PSS movie file into a .m2v (video) and .ads (audio) file
  2. FFmpeg to add subtitles to the .m2v file and re-encode it
  3. use ps2str again to mux both the subtitles .m2v and .ads into an PSS file

All of this accomplished in the command line.

At first i had issues with video files encoded using FFmpeg, because while playing the game the movies weren't properly "closing" itself - at the end it just "stuck" in a black screen, unless the player pressed a button. This issue only occurred when i used FFmpeg and not with Vegas Pro 22.

So, with the help of SuperGrok and ChatGPT i looked for solutions on why exactly FFmpeg is causing this issue. In the beginning i took a look at the video metadata of both the original and subtitled .m2v, to see if there are any differences - which were quite a few. Using the LLMs i tried to recreate the encoding settings of the original video, and at the writing of this blogpost i managed to built together this command:


ffmpeg.exe -nostdin -i "00000006_video_0.m2v"
                    -vf subtitles=00000006.MOVIE.srt
                    -c mpeg2video
                    -b:v 6342k
                    -minrate 5700k
                    -maxrate 15000k
                    -bufsize 1835008
                    -s 640x448
                    -r 30000/1001
                    -g 18
                    -bf 2
                    -sc_threshold 1G
                    -pix_fmt yuv420p
                    -profile:v main
                    -level:v main
                    -color_primaries smpte170m
                    -color_trc smpte170m
                    -colorspace smpte170m
                    -intra_matrix 16,17,17,18,18,18,19,19,19,19,20,20,20,20,20,21,21,21,21,21,21,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23,24,24,24,25,24,24,24,25,26,26,26,26,25,27,27,27,27,27,28,28,28,28,30,30,30,31,31,33
                    -video_format ntsc
                    -f mpeg2video "00000006_subtitled.m2v"

Quite long, but i am able to match 95% of the original video metadata. The only thing "missing" (aside from overall bitrate being higher/lower) is the "Format_Settings_Matrix_Data", which i can't seem to match yet.

But, even with an almost identical videofile i still encountered the black screen issue in the game. So, searching even deeper for reasons on what is causing this i came across this forum post: https://forum.doom9.org/showthread.php?t=89434

And i took a closer look at both the original, ffmpeg and Vegas Pro generated files and noticed that both the original and Vegas Pro files have "00 00 01 B7" at the very end of the file:

For some unknown reason, FFmpeg is currently unable to write those bytes at the end of the videofile. This causes Growlanser 6 to not "end" the video and just display a black screen for all eternity.

A bug on the FFmpeg issue tracker already exists for this, and i added some more information on it: https://trac.ffmpeg.org/ticket/10830
Here's hoping that it will be fixed at some point in time. Right now i added a simple workaround that changes the last 4 bytes to exacly what i need:


($fs = [System.IO.File]::OpenWrite($file)).Seek(-4, [System.IO.SeekOrigin]::End) | Out-Null; $fs.Write(([byte[]]@(0x00,0x00,0x01,0xB7)), 0, 4); $fs.Close()

And with that + ps2str i am able to add subtitles in my automation workflow and produce an xDelta patch with it.

I also used SuperGrok to try to decompile a few ELF Functions, but that is a rather slow process.
Not sure how much time i will have this year, but i will try to progress as much as possible. As always, the whole sourcecode of the fan translation can be found on GitHub and help is always appreciated!

Monday, January 8, 2024

Happy (late) new year!

Dear Citizens of Monopolis,

it's been a while! Work and the "end" of Corona caused my time to reach negative values last year. But i still managed to accomplish some goals, such as

- Creating a working GitHub Actions workflow/pipeline to automatically create xDelta patches
- Adding pre-xDelta-Patch-creation checks to the pipeline, which automatically checks various Regular Expression patterns on the whole English script
- Cleaning up the whole repository
- Adding some more missing translations

Overall 2023 wasn't a great year for this translation, and i don't know how much time i will be able to invest in 2024. But even a little progress is better than nothing!

One of the great things last year was Ethanol creating a Python tool to dump and rebuild PS2 ISOs, usable through the command line. A version that i am using can be found here:

https://github.com/Risae/Growlanser-6-English-Translation/blob/main/build/03-isotool/isotool.py

This is super useful and might help other people to start reverse engineering PS2 games!

Thanks to the super programmer and creator of the emulator Duckstation, Growlanser 5 and 6 now have a custom made graphics fix

https://github.com/PCSX2/pcsx2/pull/9187

This fix automatically activates once you play any version of Growlanser 5 and 6. Now, As far as i know, the only thing broken in both games is upscaling. Here's hoping that in the future the PCSX2 emulator will also support this. The character models in Growlanser 5 and 6 have a lot of detail that is only visible in higher resolutions.

A lot time and effort has been invested by the PCSX2 community to improve the built-in Debugger, and i have been closely monitoring that (since it makes my life so much easier). The debugger now supports

- Subsequent searches/next scan: https://github.com/PCSX2/pcsx2/pull/10260
- Save addresses and import/export them: https://github.com/PCSX2/pcsx2/pull/10518
- And hopefully soon automatically search for .mdebug and .sndata: https://github.com/PCSX2/pcsx2/pull/10224

Recently 2 fan translations, which i have been following for some time, were finished:

- dotHack Link: https://dothacktranslate.wordpress.com/projects/hacklink-english-fan-translation/
- fate/Extra CCC: https://iwakuraproductions.wordpress.com/2023/12/08/fate-extra-ccc-english-patch-released/

Congratulations to both teams! I hope everybody will be able to enjoy those gems. And i still  hope that the teams will publish their tools - I would love to take a closer look at how fate/Extra CCC managed to handle the xboxhuge script of the game.

The Growlanser 1 translation, done by Poorchief and his team, also seems to be making progress. Here you can find a live-stream of cj iwakura playing the translation:

https://www.youtube.com/live/ZXx38OoNuYc?si=hzRj4CgH0Jz4xBNe

The spirit of fan translations has not died out, and i can't wait to see what the future holds.

Sunday, August 28, 2022

Repository moved over to GitHub and other news

Dear Citizens of Monopolis,

after finally having some breathing room and time to focus on our Growlanser 6 translation i decided to move our Bitbucket repository over to Github. A lot of features, which are available only on Github but not Bitbucket, are very useful and it was time to do the switch. Our new GitHub repository is now available under: https://github.com/Risae/Growlanser-6-English-Translation

A few changes and fixes to the translation have also been implemented in the last few weeks, a lot of those thanks to our Super MIPS Hacker Ethanol! It is still a lot of work to provide a fully functional translation of Growlanser 6, but the end of the tunnel is slowly getting closer. Occasionally we will provide a "snapshot" of the current state of the translation as an xDelta patch on the GitHub repository. If you happen to test this version and find any issues like

- Translation is wrong/typos
- Japanese text has not been translated
- Or just general issues that you experience

please open an issue on our GitHub repository!

Aside from that i have been working on improving the Growlanser 5 and 6 Toolkit. It is now possible to merge a japanese and english script of Growlanser 5 (and 6, probably). But it's not fully functional - in quite a few english GL5 scripts there are more entries present than the original Japanese version, so its not working for all of them. But i'm working on  finding a simple solution to that.

As always, thanks a lot for the support and encouragement from the Growlanser community. With the translation being fully open source everyone can look and check out our translation - and as such we are open to pull requests.

And, on another note related to Growlanser:

A vtuber seems to have stumbled across Growlanser, and the english translation of the video got more than 150.000 views!

Any advertisement is good advertisement, so here's hoping it will help ignite the flame of curiosity for a new generation of Growlanser fans.

Friday, December 31, 2021

Growlanser 5 & 6 Toolkit and happy new year!

Dear Citizens of Monopolis,

during the translation of Growlanser 6 i tried to gather as much information about the game as possible. Whether it be a simple manual or a game guide, as long as it can help our translators better understanding the World of Growlanser 5/6 then it will be useful.
Since Growlanser 5 was already translated to english, it is also important that we (the GL6 translators) keep consistency with various words that are used in both Growlanser 5 and 6. One example of this would be the character names from Growlanser 5 (since 6 is a direct sequel).
So, a few months ago i started to create "combined" Growlanser 5 Japanese + English script files.
Using those files we are able to quickly search for a japanese word and find its english original english translation.
But this was a lot of manual labor, and i'm not finished at all with the scripts. I definitely need to automate this process and, thanks to my new position at Monopolis Corp., i learned a little bit of Python programming.
So, using my newfound Python skills i started to work on a "Growlanser 5 / 6 Toolkit" and already made a little bit of progress:

https://github.com/Risae/Growlanser-5-6-Toolkit

I'm a complete novice when it comes to programming in general, so i doubt that my code is anything but good looking or efficient.
But i pretty much want to create a tool that is able to do all those things that i can do manually, with little to no manual input, and for anybody to use in the future. The program currently only works in windows (...at least i think it does...) and it includes the following 3rd party applications in order to work "out of the box":

- abcde
- Strawberry Perl Portable (for abcde)
- Python 3.10.1 embed
- quickBMS

Currently the Toolkit is able to

- Automatically convert "raw" Growlanser 5 and 6 Script files (.SCEN/.SCEC/.SDMY/.STXT) into actual script files that can be used by abcde's Atlas (including dumping options)
- Dump the Bytecode of Growlanser 6 Script files

Here are some of the things that i will try to implement in the future:

- Combine 2 dumped scripts into one script (combined GL5 JPN + ENG Script)
- Dump/Reinsertion of a games "GLX_XXXX.DAT" file
- Somehow transfer the character names and other text box information of the Bytecode directly into script file
- Hopefully be able to create a GUI in which you can work on script files, just like the Fate Extra CCC guys have it
- And other stuff that i will maybe find useful

Aside from that lots of stuff has been accomplished this year, with the most notable thing being the creation of a simple buildbot (+ the xDelta patch) and being able to subtitle Growlanser 5 and 6 ingame movies.
There is still a lot of work to do like fixing the VWF Code, translating & editing various scripts and images and adding subs to the movies. But, as far as i can tell, we made good progress.

A big Thank You to everybody that made the Growlanser 6 Translation possible - especially Mako, Ethanol and Haruka!

Enjoy the beginning of the new year, and hopefully one day we will see a remake of Growlanser!

Saturday, October 23, 2021

Buildbot now automatically creates xDelta patches

Dear citizens of Monopolis,

Over last few days i have been searching for ways to automate the Xpert2 ISO dumping and rebuilding process.
This was the only thing i couldn't automate using a CLI, since Xpert2 only supports a GUI.
I asked around a few Discord servers and it doesn't seem like there currently exists a tool that lets you use a command line to dump and rebuild a PS2 ISO.
So, yesterday i found this neat little tool:

https://github.com/npocmaka/batch.scripts/blob/master/hybrids/.net/c/mouse.bat

With this i was able to add mouse movement & clicks to my batch file (which does all of the compiling and stuff).
After a bit of testing everything seems to work flawlessly - After the files are compiled (using quickBMS and abcde) Xpert2 is automatically started and the script interacts with the GUI.
The Buildbot xDelta patch can be found here:

https://bitbucket.org/Risae/growlanser-6-english-translation/downloads/

And here's the updated Buildbot script for anybody interested:

https://pastebin.com/raw/YGbBsbzq