In Memoriam of Riff
- Posted by mariteaux on April 7th, 2020 filed in Modding
- Comment now »
Slight detour off the somnol.net site stuff (which I’ll be continuing on after breakfast). Woke up to someone in MiloHax asking how to get custom videos working in GH2, and no one quite seemed to know. Now, I know I read something on ScoreHero about it a while back, but when I went to go find the thread, it turns out it was utter garbage. (Total Video Converter? Are you on spray paint?)
Thankfully, video is video, and we’ve come a long way. I’ve managed to get custom videos working the 2020 way, using just two tools, ffmpeg and PSS Plex. (Any PSS multiplexer of your choice will work though–Scott says he’s never gotten PSS Plex to work, and ps2str is always an option if you can find it.)
So you have your video. MP4 or something, most likely. You’ll need to separate the video and audio and reencode both. With the former, you’ll need it in MPEG-2 format, in a YUV420p colorspace in 640×448, at least for NTSC. I’m not sure bitrate truly matters, but the tutorial used 8mbps, so that’s what I used too:
ffmpeg.exe -i "allofthis.mp4" -c:v mpeg2video -b:v 8000k -c:a none -vf scale=640:448 -pix_fmt yuv420p -minrate 8000k -maxrate 8000k "allofthis.m2v"
For the audio, you’ll need to reencode it as 48khz PCM. (Other sample rates will cause audio desync and pitch issues. Listen only if you dare.) You can’t just copy the audio stream from the sample file–PSS Plex caught me out on it, saying it was likely a compressed audio stream in a WAV wrapper. Bastard was right, so it gets a reencode.
ffmpeg.exe -i "allofthis.mp4" -f wav -acodec pcm_s16le -ar 48000 -flags +bitexact "allofthis.wav"
There’s another thing that’s really important here, and that’s the -flags +bitexact
option. You see, by default, ffmpeg will attempt to brand your files with an encoder string. People say a WAV file can’t take metadata, but they can. More accurately, most programs that read WAVs don’t expect metadata and will glitch if you feed them a file with additional metadata chunks. XingMP3 is a prime example of this; if your input WAV has any metadata, you’ll get obnoxious databurst sounds at the end of the output MP3.
PSS Plex will choke on this too, saying it’s not a valid WAV file. Thus, -flags +bitexact
is needed to suppress the encoder branding and produce a valid WAV file as far as PSS Plex is concerned.
Now that you’ve gotten your WAV and M2V separated, it’s time to multiplex. Get PSS Plex out (you can get it in my big pack of GH2 tools), enjoy that lovely faux-OS X Tiger styling, and select the Multiplex option. Feed it your M2V and WAV, simple as, and start it. Assuming you’ve used the commands correctly, it’ll output a PSS file you can simply replace one of the game’s videos with.
I’ve been meaning to replace the videos on my disc anyway for a little while, so this was a fun way to take care of that. I unfortunately have no way to test if all of these little hacks work on hardware, so for all I know, what I’m doing could be totally unbootable. I’ll cross that bridge when I get there though.