News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: R-Type Tactics II: PMF > video > video+hardsubs > PMF  (Read 2094 times)

Isourou-san

  • Jr. Member
  • **
  • Posts: 49
    • View Profile
R-Type Tactics II: PMF > video > video+hardsubs > PMF
« on: June 06, 2017, 03:33:20 pm »
Hi everyone,

I have a specific problem in my translation project that is nearly finished (thread is here: http://www.romhacking.net/forum/index.php?topic=20725).

I would like to add English subtitles to a video in RTT2 that is entirely in Japanese. I understand that the process is as described in the title:
1) PMF to AVI+WAV (using GBOOT v2, or MPlayer+Mencoder)
2) Add hardcoded .ass subtitles with Xvid4PSP
3) Convert the WAV to WAV PCM 44.100 kHz, 16 Bit, Stereo 172kb/sec with Sound Recorder or whatever
4) Use UMDstreamcomposer to join subbed AVI+WAV into an .MPS file
5) Convert .MPS file to .PMF file with Gameboot

The thing is that it works... partially. I can start the video ingame and it plays perfectly fine, until it stop unexpectedly. I've been thinking that my file could be imperfect in some way, but then you'd think it wouldn't play at all.

Here is the .ass file for anyone who'd like to try it out:
https://drive.google.com/open?id=0B4LPlU-SKYkWYWhHSVhvcHRucGc

I'm not specifically looking for someone who could make the .PMF for me, but rather a method that enables me to make it myself without errors.

Thanks,
Isourou-san

Mugi

  • Sr. Member
  • ****
  • Posts: 259
  • Personal text
    • View Profile
    • Blacklabel-translations
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #1 on: June 15, 2017, 05:57:44 am »
Since no one else did, I gave this a go.

https://www.youtube.com/watch?v=07wMu_CJ9UQ

the above was archieved by following;

1) demultiplex the original pmf into a h.264 + at3 streams
2) wrap the h.264 into an mkv for easy handling
3) embed .ass subtitles into the h.264 and encode it to raw avi including the subtitles
4) decode .at3 stream into .wav using a hardware decoder running on real psp.
5) encode and multiplex the new raw avi with subtitles + the decoded wav into a .mps using umdstreamcomposer
6) use mps2pmf to add pmf header back into the file.
7) rebuild patched iso with new pmf.

runs fine, though this particular test i encoded using completely overkill settings (avg.4500kbpsVBR) resulting in a pmf file that is roughly 3 times the size of the original.
regardless of the potato quality of my test recording, the outputted pmf with subtitles has no visible loss of quality compared to the original.
In PSP we trust.

Isourou-san

  • Jr. Member
  • **
  • Posts: 49
    • View Profile
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #2 on: June 19, 2017, 03:15:51 pm »
Mugi and I had some very fruitful exchanges via PM and the video's are now translated in-game. This will be another addition to the final release of the RTT2 patch.

Round of applause for Mugi!  :thumbsup:

flame

  • Full Member
  • ***
  • Posts: 120
    • View Profile
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #3 on: December 17, 2017, 02:47:07 pm »
I was trying this and couldn't get it to work.

I got stuck at step 5: encode and multiplex the new raw avi with subtitles + the decoded wav into a .mps using umdstreamcomposer
In umdstreamcomposer I am getting error 0x0100001D. I googled it and found some stuff but not a solution. From what I googled, the problem could be wrong video format.
It could be that I am messing up step 3: embed .ass subtitles into the h.264 and encode it to raw avi including the subtitles
Could I know the name of a recommended program to do this? I tried [XviD4PSP 5] but when I select [Copy] for compression type, it doesn't add the subtitles like it's supposed to (a bug, I guess).

One other possible problem: The video I'm trying has no audio track. So I am just skipping all audio steps and specifying 0 audio tracks in umdstreamcomposer.
----------------
Ok, solved.

What did worked was:
Install FFDShow
    Note: FFDShow has something called VFW codecs which VirtualDub needs to work.
I used WinMEnc, an older encoder program, but most encoders should work. Try H264 or Divx. The subtitle gets applied on this step.
Then VirtualDub to transcode compressed AVI to uncompressed AVI.

Then on to step 5 and umdstreamcomposer.
« Last Edit: December 17, 2017, 05:37:05 pm by flame »

Mugi

  • Sr. Member
  • ****
  • Posts: 259
  • Personal text
    • View Profile
    • Blacklabel-translations
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #4 on: December 20, 2017, 06:18:50 am »
well that should work i suppose, but i highly recommend you to skip the step of compressing the avi and then uncompressing it.
the whole reason why i wrap the raw h.264 stream into an mkv to make it usable with virtualdub is to avoid quality losses by converting the stream.

i have my own custom tools for funky videos (im looking at you crisis core!) but generally mencoder (M) whould work for most games.

what i do is more or less;
m.exe VIDEO.PMF -dumpvideo -dumpfile VIDEO.h264
m.exe -dumpaudio -dumpfile VIDEO.at3 VIDEO.PMF
mer.exe -o VIDEO.mkv  --default-duration 0:30000/1001fps -d 0 -A -S VIDEO.h264 --track-order 0:0

this will take VIDEO.PMF and dumps it into a VIDEO.h264, VIDEO.at3 and wraps a copy of VIDEO.h264 into a VIDEO.mkv

the resulting mkv contains the h264 stream as it is on the pmf, no processing whatsoever, it simply changes the container from pmf to mkv.

if you need the audio, grab a copy of sony's at3 tool (should be easily googleable, i dug it out of fate/extra CCC data back in the day) and convert the at3 to wav.

now you can simply use virtualdub to embed your subtitles (there's plugins that support .srt/.ass etc common formats) and save the video as an uncompressed avi.

at this stage it will have your subtitles and the stream itself is still unchanged as far as the quality goes, the only minor quality loss you suffer this way is the process of making a new MPS out of the uncompressed avi (the loss is negligible if you use proper encode settings.)

edit: it's worth a note that whatever encoder you use, make sure to set the color space correctly, since psp is not using a standard 0-255 sRGB colorspace, but instead its using a 16-232 one.
what this means is that if you encode anything using default settings of practically any codec/encoder/whatever ever, you will end up messing up the pmf, and your new shiny subtitled PMF will be much darker than it's original counterpart.
« Last Edit: December 20, 2017, 06:31:19 am by Mugi »
In PSP we trust.

Pennywise

  • Hero Member
  • *****
  • Posts: 2201
  • I'm curious
    • View Profile
    • Yojimbo's Translations
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #5 on: December 20, 2017, 09:30:27 am »
Correct me if I'm wrong, but isn't it easier to skip all this video editing stuff and just implement softsubs instead?

Mugi

  • Sr. Member
  • ****
  • Posts: 259
  • Personal text
    • View Profile
    • Blacklabel-translations
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #6 on: December 20, 2017, 04:41:33 pm »
if you know how that works and if you have the space for the custom code it needs i guess yes.
there's also the option of simply multiplexing a subtitle stream into an existing pmf (no re-encode needed) but i didnt really look into how to actually take those in use in software.

it's been on my to-do list to learn to make softsubs but since subtitling work hasnt been required much at all on my late projects it's getting pushed back :P
« Last Edit: December 20, 2017, 05:18:06 pm by Mugi »
In PSP we trust.

Pennywise

  • Hero Member
  • *****
  • Posts: 2201
  • I'm curious
    • View Profile
    • Yojimbo's Translations
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #7 on: December 21, 2017, 09:03:04 am »
Well, if anyone ever wants to know how to do it, I've been given the information and code.

https://puu.sh/xMUtl/96c6ce8cd5.rar
https://puu.sh/xMUXo/361c1fecc9.txt

Quote
<Kingcom> here's the assembly side of it. unfortunately it won't be of much help
<Kingcom> what you need to do is...
<Kingcom> -figure out where the text functions, their signature and how to call them
<Kingcom> -figure out the right places for the fmv function calls (check for syscalls related to videos)
<Kingcom> -save the subtitles in an appropriate manner and parse them accordingly

Mugi

  • Sr. Member
  • ****
  • Posts: 259
  • Personal text
    • View Profile
    • Blacklabel-translations
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #8 on: December 21, 2017, 09:19:18 pm »
thanks, i'll definitely put that somewhere in-case i ever have an actual need for it :P
In PSP we trust.

filler

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 813
  • "WINNERS DON'T SELL REPROS"
    • View Profile
    • Filler's Translation Projects
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #9 on: December 21, 2017, 09:25:42 pm »
This is a friendly request to the mods to please move this to an appropriate board. This is a request for assistance, not recruitment of a project member.

Mugi

  • Sr. Member
  • ****
  • Posts: 259
  • Personal text
    • View Profile
    • Blacklabel-translations
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #10 on: December 21, 2017, 09:51:33 pm »
exactly where did anyone recruit anything ?

In PSP we trust.

filler

  • RHDN Patreon Supporter!
  • Hero Member
  • *****
  • Posts: 813
  • "WINNERS DON'T SELL REPROS"
    • View Profile
    • Filler's Translation Projects
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #11 on: December 21, 2017, 10:37:39 pm »
exactly where did anyone recruit anything ?


My point exactly. This board is for recruiting project members. Not soliciting help with features.

Mugi

  • Sr. Member
  • ****
  • Posts: 259
  • Personal text
    • View Profile
    • Blacklabel-translations
Re: R-Type Tactics II: PMF > video > video+hardsubs > PMF
« Reply #12 on: December 21, 2017, 10:54:16 pm »
im not sure i understand you here,

you said this should be moved because it's for assistance, not for recruiting.
and no one recruited anything.

now you're saying it should be moved BECAUSE no one recruited anything,
make up your mind, you're contradicting yourself.

regardless, i dont see the harm of discussing the topic's matter further especially considering that quite a bit of helpful information regarding the actual topic was discussed, which not only helped myself, but will propably help anyone reading the thread too, assuming they are interested of subtitling psp videos.

however if discussing topic's matters in a topic is forbidden, i rest my case, enjoy your discussionless discussion forum :)
In PSP we trust.