How To Guide: Encoding Cinepak Videos Properly

TrekkiesUnite118

Established Member
So encoding Cinepak Videos can be a bit cumbersome. While Cinepak encoders are a dime a dozen, finding one that will produce something that the Saturn likes while still looking decent is a bit more challenging. AviToSaturn while useable, tends to produce sub-par results, and always garbles the audio requiring you to remux it with FFMPEG. So the best process at this time is to instead use the old Mac tools and go through the official encoding pipeline Sega and other developers used. So here are the steps.

You will need the following:
  • VirtualDub Software on the OS of your choice.
  • A classic Macintosh Environment on OS 7, OS 8, or OS 9. In this guide I'll be using SheepShaver to emulate a Macintosh OS 9 Environment.
  • Sega's Cinepak libraries. (These can be found here: Dezaemon 2 Save Game Manager Vol. 2 and CPK Viewer Source Codes) The tool we want in particular is MovieToSaturn.
  • QuickTime 2.5 and Quicktime 4 or higher.
Setting up your Macintosh Environment (I'm not going to go into much detail here as there's plenty of guides out there for this):
  1. You'll need to get your Macintosh set up with either OS 7, 8, or 9. Make sure it's a Power PC Macintosh as the 68k ones don't support certain functions.
  2. Install Quicktime 4 if it's not already installed. This will allow you to open and play uncompressed AVI files.
  3. Copy the Movie Player application from Quick time 2.5 onto your Macintosh. This is the last free version that allowed you to export/convert videos.
  4. Copy the MovieToSaturn application onto your Macintosh.
  5. Optional - Install the Japanese Language pack (this is useful for translating errors MovieToSaturn can throw.)

Encoding your video:
  1. Obtain a good quality raw video file. - If you have access to higher quality versions of your video file, use them. You want to avoid using the original Saturn files if at all possible as then you'll be compressing something that was already compressed which will give poor results. Garbage in Garbage out basically.
  2. Downscale your video to the desired resolution in VirtualDub. Do any other kinds of editing here. (Adding subtitles, fancy effects, changing Framerate, etc.)
    QCsxSU8.png
    0urtDv4.png
  3. Next you want to set your Audio compression setting to "Direct Stream Copy". Set your Video Compression settings to "Uncompressed".
    4PjJYVL.png
    1. Note: If your raw video is in a more modern codec, uncompressed may result in a frame format that Quick Time can't understand. If this happens try converting your raw file into an older format first. A good way to preserve quality is to use MPEG-1 and set the bit rate to a very high value such as 8000kbps or higher.
  4. Save your Video as an AVI file.
  5. Copy your new video file over to your Macintosh Enviroment.
    1. This step is REQUIRED. If you don't do this and try reading from your PC's mounted drive, you will get audio errors.
  6. Open QuickTime Movie Player and select "Open".
  7. Select the file you wish to encode and select "Convert"
    euiLXlE.png
  8. Click File, and select "Export"
    RVijgMI.png
  9. Make sure "Movie to Quicktime Movie" is selected in the Export drop-down.
    FC2zVeX.png
  10. Click "Options".
  11. Under "Video" click the "Settings" button.
  12. In this window, select "Cinepak" for the codec and "Millions of Colors" for the color depth. (256 Colors is also allowed.)
    gi3bjd2.png
  13. Adjust the quality meter to the desired settings. Medium is a good starting point, though you can usually get away with setting it to Best.
  14. Set the frame rate to your videos Framerate.
  15. Set your desired Key frame interval.
    1. For best results set this to the total number of frames in your video. This will have the encoder decide on it's own when to insert key frames and it generally makes a better decision than you. Only play with this if you find certain spots of your video are getting garbled.
  16. Set the bit Rate to the desired value. The max the Saturn can do is 300KB/s. However you need to take audio into consideration. So play with this to find a desired value. 200-275 seems to be safe from what I've tried. Adjusting this can also help get the size just right if you need to fit into a specific size.
  17. Click "Ok"
  18. Under "Sound" click the "Settings" button.
  19. Select "None" for compressor, and select the desired Rate, Size, and Channels. Both 8-bit, and 16-bit are allowed, as are Stereo and Mono. Common rates on Saturn are 8000, 11025, 16000, 22050, and 32000. Note: If you want to use ADX encoding then you'll need to use the FILM Muxer: GitHub - TrekkiesUnite118/SegaSaturnFilmMuxer: Remuxes Sega Saturn FILM files from Audio and Video sources
    fDUbh2O.png
  20. Click "Ok"
  21. Uncheck "Prepare for Internet Streaming"
  22. Click "Ok".
  23. Type the desired name for your new MOV file, and click "Save".
  24. Your video will now start encoding. This can take some time as Mac OS 7-9 wasn't really a fast OS, and the machines are pretty slow by todays standards.
    ckPvQYD.png
  25. Once the file has been saved, open up MovieToSaturn and select the MOV file you just created.
    g2KpjPS.png
  26. Click "Open"
  27. Click the bottom right button that has the border around it:
    b8cAvHz.png
  28. Wait while it turns your MOV file into a CPK file. When finished you should see a window like this:
    etXiIyR.png
  29. Move your file off of your Mac and back to your original Dev system.

And that's it. You should now have a Saturn compliant Cinepak file in decent quality. You can now try it in your game or try it in MadRoms CPK Viewer application that was included in the Cinepak libraries linked above.


Note: MovieToSaturn can sometimes throw fits and will give you an error. Usually this means there's something it doesn't like about your file. The best I can tell you is to just try exporting it again. I've had it throw a fit on one file, then when I re-exported it with the same settings it was happy with that one.
 
Last edited:
One other thing to add. It seems that one thing Sega and others did to make Animation compress a little better is to slightly boost the contrast, and then turn the sharpness dial up to 11. While at higher resolutions you'll get artifacts from this, at this low of a resolution it actually seems to help the Cinepak encoder do a better job compressing so you don't get as many "dancing pixel" artifacts.
 
So after encoding all the subtitled FMVs for Sakura Wars, I figured I'd see how far I could push the quality in this setup. So here are the results:



The video is encoded with quality set the highest in the Quicktime tools, Video Bitrate capped at 270KB/s, and audio is at 16-bit Mono at 22050Hz. This resulted in a file that was ~290KB/s. The reason I went with this video was because all the crazy anime stuff going on in a lot of the shots seemed like a good test for how well the compression could handle fast moving objects and what not.
 
Hi, anybody help?
I can't, for the life of me, find the movietosaturn inside that hideous Dezaemon 2 .rar because there are 1 thousand files and the windows search can't find it, me neither.

Oh, I've already found the Sega Saturn Cinepak Library Ver 1.20 (ISO+HFS).iso but it's a nightmare of folders.

here is the converter for mac
I tried your file but it can't be installed on my environment, it says it's corrupted.

Edit: I think I figured it out. You have to mount that Sega Saturn iso into your mac environment, then you can copy the Movie to Saturn (second picture attached).

I was trying to navigate through the folders using windows.
 

Attachments

  • Capturar.JPG
    Capturar.JPG
    39.2 KB · Views: 454
  • Capturar2.JPG
    Capturar2.JPG
    32.2 KB · Views: 477
Last edited:
Ok, @TrekkiesUnite118 do you have any tips? MovieToSaturn says the audio and video lenghts are different but this is a lie. I did every step of your guide. I've tried to render the video again in virtualdub with various settings but I always get this error.
It's terrible to be stuck in the last phase after everything I got through lol.
 

Attachments

  • 2020-06-14 18.47.36.jpg
    2020-06-14 18.47.36.jpg
    229.3 KB · Views: 434
  • 2020-06-14 18.47.55.jpg
    2020-06-14 18.47.55.jpg
    296.5 KB · Views: 417
Ok, @TrekkiesUnite118 do you have any tips? MovieToSaturn says the audio and video lenghts are different but this is a lie. I did every step of your guide. I've tried to render the video again in virtualdub with various settings but I always get this error.
It's terrible to be stuck in the last phase after everything I got through lol.


The first error means your audio is going to be desynced. Sometimes it's not actually that bad other times it can be way off. The only way to know is to watch the video and see how it looks.

The second one can sometimes just happen. The only advice I can give is to just keep trying it. Sometimes I've found having the video open in Quicktime will make the error go away.

However:
I've tried to render the video again in virtualdub with various settings but I always get this error.

What do you mean by this? Are you not using the Quicktime Converter? If so then that's not going to work. MovieToSaturn only works with .mov files that are created from Quicktime or older versions of Adobe Premiere. It will not work with files made on modern systems using things like FFMPEG or Virtual Dub.
 
The first error means your audio is going to be desynced. Sometimes it's not actually that bad other times it can be way off. The only way to know is to watch the video and see how it looks.

The second one can sometimes just happen. The only advice I can give is to just keep trying it. Sometimes I've found having the video open in Quicktime will make the error go away.

However:


What do you mean by this? Are you not using the Quicktime Converter? If so then that's not going to work. MovieToSaturn only works with .mov files that are created from Quicktime or older versions of Adobe Premiere. It will not work with files made on modern systems using things like FFMPEG or Virtual Dub.
Thanks, I will try again later with the video opened.
Oh, yes, I use the quicktime to convert the videos. I used virtualdub to save an uncompressed .avi before going trough quicktime 2.5.

Update: Managed to make it work and replaced it in the iso but the movie did not play on the emulator. Maybe I messed up the settings somehow. Will try again later. Thanks.

Update 2: Success!
I'm trying to replace Megaman X4's videos with subbed undub ones. The problem is: the game is super picky with the file size. My video was larger than the original so the game wouldn't play it but after some adjustments it played fine.
Too bad I won't be able to make ones with better image quality tho.

Thanks for the help @TrekkiesUnite118
 
Last edited:
How are you replacing the files in the ISO? If you rebuild it properly file size shouldn't be an issue.
Maybe this is the problem? I use an old software (winiso v5.3 on windows XP VM). I just delete the old file and import the new one.
I don't know the best way to do this tbh.

Edit: Also, I have 2 problems now. The video has a tearing when converting to .cpk (attachment) and at the first 0,5 second there is an audio static/corruption no matter what I do. The audio issue comes after converting to .mov. The video after converting to .cpk.

Update: solved the screen tearing issue. It was due to a wrong vertical resolution on the source video. The audio issue persists. :(
 

Attachments

  • Capturar.JPG
    Capturar.JPG
    89 KB · Views: 435
  • OP.zip
    13 MB · Views: 336
Last edited:
Your audio is at 22255Hz which I don't know how you got to be honest. You want 22050Hz. Also check that your source video isn't screwed up in some way. Check that the audio and video are properly synced, there's not an abrupt cut in the audio, etc.

Finally what is the final bit rate of the video? If it's over 300KB/s you're going to have playback problems.
 
Your audio is at 22255Hz which I don't know how you got to be honest. You want 22050Hz. Also check that your source video isn't screwed up in some way. Check that the audio and video are properly synced, there's not an abrupt cut in the audio, etc.

Finally what is the final bit rate of the video? If it's over 300KB/s you're going to have playback problems.
The audio and video are synched, yes. The source is fine, I ripped they from ps1, saturn and youtube to test. About the bit rate, I always check the box to limit at 300 kb/s.
The audio was acquired from the original sega saturn video, converted to wave using acpk2avi and muxed using virtual dub.
I don't know why it's at 22255 since I didn't change the original one. I will try again converting to 22050.

Update: no game. I even took a random video from later parts, converted from cpk to avi and then back to cpk. The issue persists. I think it's something with my mac environment. Later this week I will uninstall everything and install again. Thanks for the help.
 
Last edited:
Limiting to 300kb/s in quicktime is too high. That's for just the video feed, you need to remember the audio is going to eat into that as well. You need to look at the number MovieToSaturn gives you when it's done. That's the true bitrate of your video. If it's over 300kb/s the audio issues you're getting are probably related to that.

Keep in mind also that 300KB/s is the theoretical maximum of the disc drive. You want to be a little below that. The I've found 290KB/s or lower is generally safe.
 
Oh yes, understood. My last try was at 276 kb/s total. I didn't have the time to reinstall sheepshaver yet, maybe I will later today.
 
New post for new information.
I didn't solve my problem with the audio. Tried another laptop, formatted mine (it was needing it anyway). Adobe Premiere wouldn't install due to network not working on my sheepshaver etc. I almost gave up.

So, I've discovered you can encode the videos using Windows 10 and you only need Mac for MovietoSaturn.
Using Quicktime Pro (mine is 7), save the video as .avi, select the cinepak codec (it doesn't show up if you save as .mov), do your configurations and simply load this .avi directly into MovietoSaturn to convert it to .cpk. Now I have the english opening with japanese music in Megaman X4 and will proceed to subtitle all the japanese cutscenes.
Quicktime:
mkIYOXe.png


MovietoSaturn:
N0s74FN.png


Result:
 
Hey there! I feel you on the Cinepak encoding struggle. Really appreciate the guide you've shared, especially the focus on using official encoding tools. SheepShaver tip sounds solid! Best of luck with it!
 
Hey there, fellow Cinepak lover! I totally get the struggle with encoding Cinepak videos - it's a bit of a headache, right? I see you put together a pretty comprehensive guide here (nice job, by the way) and I appreciate the focus on using official encoding pipeline tools. I've personally struggled with garbled audio a lot in the past, so your mention of the specific Sega libraries is a lifesaver. Getting good encoding results makes such a difference for the Saturn, and the SheepShaver tip seems like it'll set things up smoothly. And just a small note: I found that using Movavi worked wonders for me in processing videos for other purposes, though I know it wasn't specifically designed for Cinepak. Best of luck with your Saturn project, keep up the great work!
 
Last edited:
Back
Top