• Rise from your gwave!

Translating Lunar Silver Star Story

Discussion in 'Saturn Dev' started by TrekkiesUnite118, Aug 5, 2013.

  1. Ms. Tea

    Ms. Tea New Member

    I've made a bit more progress, but I'm not there yet.

    I took a look at the AVItoSaturn source code. Unfortunately, it turns out it doesn't actually have a Cinepak encoder at all; it uses the builtin Windows encoder, and just tweaks the packet header to make it look like the Saturn is expecting. That's basically the same as what I do in my own muxer, so it didn't give me much extra information - except that it means the Saturn *can* play back standard Cinepak, so the FFmpeg encoder is probably fixable. :)

    On the advice of someone who has some Cinepak experience, I tried forcing V4 encoding only - and it worked! I also tried V1 encoding only, and that worked too. So I suppose something is buggy about how it divides the frame between V1 and V4 vectors. At least that gives me a bit of a hint as to what's wrong.

    To test, I've been encoding the Sonic Mania intro and replacing the Silver Star Story intro with it. If it plays back without crashing, I count that as a success. The V4-only version looks beautiful, but it takes up an absurdly high bitrate. :) The fact it works at all, though, I'll take as a win, and I'll try to figure out what to do from here.
    AlexTheBlue, FacundoARG and ROS like this.
  2. ROS

    ROS New Member

    I converted some videos to Saturn with varying success including Sonic Mania Intro. Looking forward to whatever you come up with.
  3. Ms. Tea

    Ms. Tea New Member

    What did you use to convert them? AVItoSaturn?
  4. ROS

    ROS New Member

    I experimented with various tools including ffmpeg before running them through AVItoSaturn.

    While helping provide information for another translation project I was able to convert from and back to Saturn with seemingly identical video quality, but lost stereo audio due to AVItoSaturn being restricted to mono. I'm hoping you can help eliminate that issue.
  5. Ms. Tea

    Ms. Tea New Member

    I found the AVItoSaturn encoder's quality to be kinda mediocre, but yeah, it definitely *does* work!

    AVItoSaturn basically wraps the Windows Cinepak encoder with a Sega FILM container muxer. Since my muxer can remux existing Cinepak video with new audio, you can use that to take the output of AVItoSaturn - or original videos! - and replace it with whatever kind of audio you want. For example, I was able to take the original Lunar: SSS video and mux in the 37800Hz mono English audio from the PlayStation version instead of the 16000Hz mono from the Japanese version, and it worked fine. In your case, you could fix the audio from AVItoSaturn by throwing out the audio stream it produced and replace it with the stereo original.
    AlexTheBlue likes this.
  6. ROS

    ROS New Member

    Is your muxer a Windows based tool, how do I compile/use it ?


    Last edited: Apr 1, 2018
  7. Ms. Tea

    Ms. Tea New Member

    It will be, eventually! I'm submitting it as a new muxer to FFmpeg, which is a very popular open source video tool. If it gets accepted, you'll be able to download a copy of it for Windows from somewhere; otherwise, you'd have to apply my patch to the source and compile it yourself, which isn't nearly as convenient. :)
    ROS likes this.
  8. Ms. Tea

    Ms. Tea New Member

    Sorry for the double-post, but another quick update.

    I've been trying out Sega's official "MovieToSaturn" tool from the Saturn SDK, which is for 68k-based Macs. It works fine on PPC Macs and I have a PowerMac with the classic environment installed. I was expecting it to include a Cinepak encoder, but it turns out it doesn't - video is meant to be encoded to Cinepak using Quicktime Pro, and Sega's tool remuxes that into .CPK files. Apple's Cinepak encoder is pretty flexible, and offers various quality settings, which is definitely a leg up on the encoder used by AVItoSaturn!
    AlexTheBlue likes this.
  9. Ms. Tea

    Ms. Tea New Member

    OK, it's been accepted! It will be in the next official release of FFmpeg. You can get nightly builds from this site, which should include it: https://ffmpeg.zeranoe.com/builds/

    Right now, you can't encode new video using FFmpeg, but you can replace audio tracks in existing videos. That includes videos created with AVItoSaturn. Here's what a command to do that looks like. I've broken it up onto multiple lines, so that I can include comments (the part starting with #).

    ffmpeg.exe # this part needs no explanation
    -i yourvideo.cpk # video input
    -i youraudio.wav # audio input
    -map 0:0 # use track 0 of input file 0, e.g. the video track
    -map 1:0 # use track 0 of input file 1, e.g. the audio track
    -c:v copy -copyinkf # copy the video without reencoding, and include non-key frames at the beginning of the video
    -c:a pcm_s16be_planar # audio codec; supported values are pcm_s8_planar for 8-bit PCM, pcm_s16be_planar for 16-bit PCM, and adx for ADX
    -ac 2 # stereo; -ac 1 for mono. Leave this out to keep the channel layout of the original file
    -ar 22050 # audio sampling rate; what you use is up to you but keep in mind the video and audio combined have to be under 300KB/s
    output.cpk # output video file
    AlexTheBlue, Choxie and ROS like this.
  10. ROS

    ROS New Member

    Great news Ms. Tea :)
    This will definitely be useful, Thank You!!!
    AlexTheBlue likes this.
  11. klarth

    klarth New Member

    AlexTheBlue likes this.
  12. FacundoARG

    FacundoARG New Member

    Awesome project :D !!!, If you want, try to contact SaturnAR (I'm almost retied in this seas of asm-codes) I think he could help you with some advice; he helped us to add lyps-sync and even add subtitles to our Policenauts Translation.
    AlexTheBlue likes this.
  13. Fakkor

    Fakkor New Member

    Hey Facundo, long time no see!
    He's already in touch with her. We're gonna work on the Spanish version of this patch!
  14. Ms. Tea

    Ms. Tea New Member

    That's great! Looks like good progress.

    I've been very busy recently, and I'm going to be very busy for the next few weeks - I get married on Tuesday! It turns out that involves a lot of work...? Who knew?
  15. klarth

    klarth New Member

    Congrats! Yeah getting married is definitely a lot more work than you would expect. My wife made a giant binder and todo list because she thought I would forget to do half of it (and i probably would have...).
  16. TrekkiesUnite118

    TrekkiesUnite118 New Member

    It's really awesome to see how far you guys are getting with this. If you need help with anything like video encoding or audio conversion let me know. I was working on the Working Designs audio but I keep getting distracted with real life things myself.

    Also if it would help at all, I do have some older Macintosh machines laying around. The most useful would probably be the Performa 6360. If it would help at all in figuring out how some of those file formats worked I can see if I can get some of that old software running on them and play around with it for you.
    Fakkor likes this.
  17. klarth

    klarth New Member

    1-byte font hack uploaded to my github notes. I have the prototype using a stream mixture of 8-bit data for the ASCII font, and 16-bit data for the control codes. Seems to work fine in Yabause, havent tested yet on real HW. It will crash when talking to some people (a side effect of the existing script being read as a stream is that occasionally a portion of the script will be read in as an invalid control code).

    AlexTheBlue and Choxie like this.
  18. Ms. Tea

    Ms. Tea New Member

    Wow, it's been a long time since I posted huh? I've gotten a few things done since then.

    I finally got around to documenting the SYSTEM.DAT format. It's pretty simple, but it has some key resources in it. In particular, it contains menu graphics, so I had the chance to update these. These are stored in a normal tile format compressed using Sega's standard CMP compression, so they were very easy to update. I've done all the menu graphics - the "buy/sell" icons, the battle graphics, and character names in the status menus.



    I also took the chance to fix a minor oversight in Working Designs's original translation. Some of the character name tiles are positioned a pixel too high compared to the rest of the text, so they look just slightly off. That bugged me. Here's a comparison of the original (top) and fixed (bottom).


    I've also located the strings used in the menus, which is in one of the other segments of SYSTEM.DAT. While there are a few differences, the two Saturn versions are pretty close to each other and also *very* close to the Japanese strings file in the iOS port. The iOS version even still has strings for the Saturn's internal and cart RAM! I used that to put together Unicode transcriptions of the Saturn version's strings files, and I'm going to be putting together English strings files for both soon. The iOS menu strings use a different translation from the PlayStation version, but I can at least use it as a reference while I grab the PS1 menu strings.

    I haven't had a chance to incorporate Klarth's 1-byte hack yet, but I'm planning on doing that soon.

    When I was working with the graphics and the menu strings, I came across some interesting unused stuff - an unused status effect ("cursed"), and unused items. I put it up on TCRF. https://tcrf.net/Lunar:_Silver_Star_Story

    I remember it sounded like you'd found a good way to get the audio converted to 8-bit PCM without the quality going to hell! I need to pick your brain about that sometime.

    Thank you! I'm actually lucky enough to have a PowerMac G5 running Tiger and Classic in the other room; it's able to encode videos pretty fast.
  19. AlexTheBlue

    AlexTheBlue New Member

    I don't generally use forums these days, but I stumbled across one of TrekkiesUnite118's posts elsewhere and he mentioned this thread. I had to reset my password just so I could post and thank you and everyone else working on this! I own both games on Sega CD but playing the Saturn version in English on real hardware was always a dream of mine.
  20. TrekkiesUnite118

    TrekkiesUnite118 New Member

    Unfortunately I recently had Windows 10 destroy my HDD, so I did lose a bit so I might not have the PS1 voice files anymore. However the process of converting is pretty straight forward with Audacity. Import the audio as RAW audio and set the project sample rate to 16000Hz. Next you want to make sure dithering is disabled in the Quality Tab in preferences. With that disabled you want to select the resample option to convert the clip to 16000Hz. Once that's done, you want to export the file as a WAV format file but set the type to Signed 8-bit PCM.

    With that done then you can use the old Rockin-B Wav to Saturn PCM utility to do the final conversions, or if you have your own tool that should work too. You can also just have Audacity export them as a Raw Headerless format and use the settings 8-bit Signed PCM.

    That should give you a clean conversion without the audio getting garbled.
    Last edited: Sep 4, 2018

Share This Page