THPConv

From Super Mario Galaxy wiki
Revision as of 17:03, 10 May 2024 by HummingOwl (talk | contribs) (edited page styles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
This page contains content/info from the Revolution SDK. This is to be considered 100% true.

THPConv.exe is a prebuilt Win32 console application that Nintendo provides in the Wii and GCN SDKs. It is used to convert sequential JPEG images into a THP video format (with an option to include audio into it from a WAV audio file) and to include/replace audio of an existent THP video. It needs the dsptool.dll file to work.

There is a similar program called THPConvD.exe included alonside THPConv.exe and according to the Wii SDK docs:

there is no difference in how the two behave. Normally you should use THPConv.exe. THPConvD.exe remains in order to maintain compatibility with past systems.

So you may use either THPConv.exe or THPConvD.exe to make/edit THP files (be sure to have the respective dsptoolD.dll for THPConvD.exe).

Linux users can use Wine to run both programs.

Converting Sequential JPEG files to THP Movie Data

Description

The following describes how to use the THPConv tool to convert Sequential JPEG files to THP movie data:

THPConv.exe -j <*.jpg> -d <outputfile> [-<option> <argument>]

Options description:

Option Argument Description
-j <*.jpg> Specifies the input files (sequential JPEG files). Wildcard characters ("*") can be used. This argument must always be specified.
-d <outputfile> Specifies the output file (THP file). This argument must always be specified.
-s <wavefile><wavefile>...... Specifies the audio file (WAV file) that will be converted to THP audio data. When specifying more than one file for the argument, data is allocated to audio tracks in the order it is specified.
-r <framerate> Specifies the movie's frame rate. Frame rates from 1.0 to 59.94 can be specified. If nothing is specified, the default value (29.97) is used.
-o - THP movie data can internally store offsets to each frame data as a table. If this argument is specified, the THPConv tool will create an offset table in the THP data. If this argument is not specified, the THP movie data, no offset table will be created in the THP movie data.
-non - Specifies the THP video data format. When interlace starts the video data from an odd numbered field, specify -odd. When interlace starts from an even numbered field, specify -even. If this argument is not specified, the THP video data format is automatically set to non-interlaced (-non).
-odd
-even
-v - Turns on Verbose mode.
-h - Displays the option list.

Example

THPConv.exe -j test*.jpg -d output.thp

When this example is executed from a command line, the sequential JPEG files in the current directory (test001.jpg, test002.jpg, test003.jpg, etc.) are converted to THP video data and collected into a single THP movie data file (output.thp). No WAV audio is specified so the THP video will be just video without audio.

  • When converting sequential JPEG files to THP movie data, the names of the specified input files must have the extension ".jpg" or ".jpeg".
  • Unlike the Nintendo GameCube, audio data is output at the set playback frequency (of 48,000 Hz or 32,000 Hz) on the Wii.

Changing THP Audio Data in THP Movie Data

Note that some of the commands options above are the same here (being those -s, -d, -r, -o, -non, -even, -odd, -v, -h).

Description

Below are the instructions for using the THPConv tool to change the THP audio data in THP Movie Data.

THPConv.exe -c <inputfile> -s <wavefile> <wavefile>... -d <outputfile> [-<option> <argument>]

Options Description:

option argument Description
-c <inputfile> Specifies the input file (THP file). This argument must always be specified.
-s <wavefile><wavefile>...... Specifies the replacing sound file (WAV file). When specifying more than one file for the argument, data is allocated to audio tracks in the order it is specified. If a THP file format that does not support multitracks is input, the output file will be in a format that supports multitracks.
-d <outputfile> Specifies the output file (THP file). If this argument is not given, the THPConv tool will overwrite the input file.
-r <framerate> Specifies the movie's frame rate. Frame rates from 1.0 to 59.94 can be specified. If nothing is specified, the default value (29.97) is used.
-o - THP movie data can internally store offsets to each frame data as a table. If this argument is specified, the THPConv tool will create an offset table in the THP data. If this argument is not specified, the THP movie data, no offset table will be created in the THP movie data.
-non - Specifies the THP video data format. When interlace starts the video data from an odd numbered field, specify -odd. When interlace starts from an even numbered field, specify -even. If this argument is not specified, the THP video data format will be automatically set to non-interlaced (-non).
-odd
-even
-trk <track No.><wavefile> If you only want to replace a single audio track dataset, use this option instead of -s. The first argument is the audio track number to replace (0-), the second argument is the sound file (WAV file) that will make the replacement. Using this option invalidates the -r, -o, -non, -odd, and -even options. This option can only be used with the THP file formats that support multitracks.
-v - Turns on Verbose mode.
-h - Displays the option list.
  • When the THPConv tool replaces audio data in existing THP movie data, the old THP audio data is deleted. Once the THP audio data is deleted, it cannot be restored. If no output file is specified when the audio data is replaced, the THPConv tool will overwrite the THP movie data. When replacing the audio data, be sure to create a backup file or to specify an output file; this will prevent accidental deletion of your data.
  • If the replacement WAV file has a longer playback time than the THP movie data, the section of the replacement WAV file that is longer than the THP movie data will not be converted. If the playback time of the THP movie data is longer than the wave file, the remaining section will be silent.
  • If the THP movie data specified as the input data does not contain audio data, this operation will add THP audio data to the specified file.
  • If you want the THP movie data to contain more than one audio track dataset, make sure that the channel counts and playback frequencies for all audio track datasets are the same.
  • Unlike the Nintendo GameCube, audio data on the Wii console is output at a set playback frequency (48,000 Hz or 32,000 Hz).

Compatible file formats for THPConv

Sequential JPEG File Format

Description

The THPConv tool can convert a group of sequential JPEG files having sequence numbers at the end of their filenames (indicating the playback order) to THP movie data. When interleaving audio data in sequential JPEG files, you must either specify the WAV files by using the -s option at the time the sequential JPEG files are converted, or add the WAV files after conversion.

The following restrictions apply to groups of sequential JPEG files that can be handled with the THPConv tool:

  • All JPEG files to be collected into a single THP movie dataset must have the same number of pixels in the horizontal and vertical directions.
  • The group of sequential JPEG files must have sequence numbers (corresponding to frame numbers) appended to the end of their filenames.
  • The number of the JPEG file corresponding to the initial frame of the THP movie data can be any number. However, the numbers of all files thereafter must be sequential.
  • Please add leading zeros to the frame numbers appended to the filenames so that they all match the number of digits in the last frame.

The following restrictions apply to each file in a group of sequential JPEG files:

  • Only the JPEG baseline DCT format is supported.
  • Only sequential encoding is supported.
  • Only supports a sample rate of 4:2:0.
  • The pixel counts in both the horizontal and vertical directions must be a multiple of 16.
  • The maximum pixel count in the horizontal direction is 672 dots. There is no restriction on the pixel count in the vertical direction.

If the sequential JPEG files do not meet these requirements, the THPConv tool will output an error and stop processing.

Example

To create four seconds of THP movie data at 30 FPS from sequential JPEG files, the numbers of the sequential JPEG files (testxxx.jpg) should look like the following:

Frame 1 : test001.jpg
Frame 2 : test002.jpg
Frame 3 : test003.jpg
… :
Frame 51 : test051.jpg
Frame 52 : test052.jpg
… :
Frame 118 : test118.jpg
Frame 119 : test119.jpg
Frame 120 : test120.jpg

WAV file format

Description

The THPConv tool can convert a general WAV file to THP audio data and interleave it with THP movie data. The following restrictions apply to WAV files that can be converted by the THPConv tool:

  • They must be non-compressed 16-bit PCM data.
  • Monaural (one channel) and stereo (two channels) are supported.

If the wav file does not meet these requirements, the THPConv tool will output an error and stop processing.

  • Unlike the Nintendo GameCube, audio data is output at the set playback frequency (of 48,000 Hz or 32,000 Hz) on the Wii.
  • WAV files having a playback frequency other than 48,000Hz or 32,000Hz can be specified in THPConv. When playing THP movie data created with such WAV files, use THPPlayerStrmAX.Even if you created THP movie data specifying wav files with a playback frequency of 48,000Hz or 32,000Hz, if the playback frequency setting on the Wii is different, use THPPlayerStrmAX.
  • If you want the THP movie data to contain more than one audio data set, make sure the channel counts and playback frequencies for all data sets are the same.