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
- ps2str to demux the original PSS movie file into a .m2v (video) and .ads (audio) file
- FFmpeg to add subtitles to the .m2v file and re-encode it
- 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!