THPConv-Guide: Difference between revisions

From Super Mario Galaxy wiki
Jump to navigation Jump to search
mNo edit summary
(edited style, hope no information was deleted)
Line 1: Line 1:
This guide is created specifically to make THP videos for SMG1. Other games that support THP can have a different THP setup.
This guide is created specifically to make THP videos for SMG1. Other games that support THP may have a different THP setup.


 
== Required Tools ==
<!-- ##### -->
<!-- TOOLS -->
 
<h1>Required Tools</h1>


* FFmpeg ([https://web.archive.org/web/20200901234146/https://ffmpeg.zeranoe.com/builds/win32/static/ Win32 older builds], for Linux you can use your package manager)
* FFmpeg ([https://web.archive.org/web/20200901234146/https://ffmpeg.zeranoe.com/builds/win32/static/ Win32 older builds], for Linux you can use your package manager)
* THPConv.exe (with dsptool.dll, [https://archive.org/details/WiiDevelopmentPackage/ Wii SDK])
* THPConv.exe (with dsptool.dll, [https://archive.org/details/WiiDevelopmentPackage/ Wii SDK])
* [https://github.com/MasterofGalaxies/THPConv Alternative THPConv build] (for Linux users)
* [https://github.com/MasterofGalaxies/THPConv Alternative THPConv build] (for Linux users)
* [https://www.videolan.org/vlc/ VLC Media Player] (to reproduce THP files)
* [https://www.videolan.org/vlc/ VLC Media Player] (to reproduce THP files)
* [https://www.winehq.org/ Wine] (for Linux users)
* [https://www.winehq.org/ Wine] (for Linux users)


<!-- ##### -->
== Steps ==


<!-- STEPS -->
Open a CMD/Terminal in the same place the video you want to convert is and type the following command (Fig. 1):


<h1>Steps</h1>
<code>path\to\ffmpeg.exe -i [input_video] -vf scale="[width]:[height]" -r [fps] [temp_video]</code>


:<p>Open a <b>CMD</b> in the same place the video you want to convert is and type the following command (<b>Fig. 1</b>):</p>
*<code>[input_video]</code> is the video of your choice to convert. Can be any video format.
*<code>[width]</code> is the width the <code>[temp_video]</code> will have. Cannot exceed 672 pixels.
*<code>[height]</code> is the height the <code>[temp_video]</code> will have. There is no limit on this value.
*<code>[fps]</code> are the frames per second the <code>[temp_video]</code> will have. Frame rates can be from 1.0 to 59.94.


<blockquote style="border: none;">
[[File:THPConv-Guide_Fig-1.webp|right|thumb|Fig. 1 - Create temporal video]]


<pre>path\to\ffmpeg.exe -i [input_video] -vf scale="[width]:[height]" -r [fps] [temp_video]</pre>
<blockquote>
All this information is extracted from the Wii SDK docs for THPConv.


</blockquote>
SMG uses 59.94 fps and 640x368 video dimensions for all THP files in the <code>MovieData</code> folder. Use <code>path\to\ffmpeg.exe -i [THP video file]</code> to see it yourself.


*<p><code>[input_video]</code> is the <b>video of your choice to convert</b>. Can be <b>any</b> video format.</p>
If you use different frame rates than 59.94 the video on SMG1 will play slower or faster but not at its "normal" speed.


*<p><code>[width]</code> is the <b>width</b> the <code>[temp_video]</code> will have. <b>Cannot exceed 672 pixels</b>.</p>
You can use different values for the width and height of the video, be sure they follow the rules said above and that the dimensions are a multiple of 16.


*<p><code>[height]</code> is the <b>height</b> the <code>[temp_video]</code> will have. There is <b>no limit</b> on this value.</p>
To get a better video resolution on the final THP video you can use the following flags on the above command <code>-preset veryslow -b:v 21M</code> (file size will increase a lot as <code>-b:v</code> sets the bitrate of the output video). <code>21M</code> was selected because of the bitrates of the OG THP videos on the MovieData folder (you can select any value you want, <code>M</code> means megabyte).
 
</blockquote>
*<p><code>[fps]</code> are the <b>frames per second</b> the <code>[temp_video]</code> will have. <b>Frame rates</b> can be from <b>1.0</b> to <b>59.94</b>.</p>
 
<br>
 
[[File:THPConv-Guide_Fig-1.webp|center|frame|<b>Fig. 1 - Create temp video</b>]]
 
<br>
 
<hr>
 
:<p><b>NOTE 1:</b> All this information is extracted from the <b>Wii SDK docs</b> for <b>THPConv</b>.</p>
 
:<p><b>NOTE 2:</b> SMG uses <b>59.94 fps</b> and <b>640x368 video dimensions</b> for all <b>THP files</b> in the <code>MovieData</code> <b>folder</b>. Use <code>path\to\ffmpeg.exe -i [THP video file]</code> to see it yourself.</p>


:<p><b>NOTE 3:</b> if you use <b>different frame rates</b> than <b>59.94</b> the video on SMG1 will play <b>slower or faster</b> but not at its "normal" speed.</p>
Create a folder named <code>temp</code> in the same place the <code>[temp_video]</code> is and then type the following command (Fig. 2 and 3):


:<p><b>NOTE 4:</b> You can use different values for the <b>width and height</b> of the video, be sure they follow the rules said above and that <b>the dimensions are a multiple of 16</b>.</p>
<code>path\to\ffmpeg.exe -i [temp_video] temp\output%03d.jpg</code>


:<p><b>NOTE 5:</b> To get a <b>better video resolution</b> on the final <b>THP video</b> you can use the following flags on the above command <code>-preset veryslow -b:v 21M</code> (file size will increase a lot as <code>-b:v</code> sets the <b>bitrate</b> of the <b>output video</b>). <code>21M</code> was selected because of the <b>bitrates</b> of the <b>OG THP videos</b> on the <code>MovieData</code> <b>folder</b> (you can select any value you want, <code>M</code> means <b>megabyte</b>).</p>
This will dump all the frames the <code>[temp_video]</code> has into JPG images.


<hr>
[[File:THPConv-Guide Fig-2.webp|right|thumb|Fig. 2 - Create temporal folder]]


<br>
[[File:THPConv-Guide Fig-3.webp|right|thumb|Fig. 3 - Dump temporal video frames into folder]]


:<p>Create a folder <b>named</b> <code>temp</code> in the same place the <code>[temp_video]</code> is and then type the following command (<b>Fig. 2 and 3</b>):</p>
<blockquote>
JPG or JPEG can be used, the only restriction the THPConv docs say is that they need to be in the baseline DCT format (which ffmpeg automatically converts them to with the above command).


<blockquote style="border: none;">
The minimum frames a THP video can have without breaking the game is 21. Tested with <code>PrologueA.thp</code> in Riivolution.


<pre>path\to\ffmpeg.exe -i [temp_video] temp\output%03d.jpg</pre>
Very low width and height values for the THP video (16x16 for example) will allow to show blue rectangles on the screen when reproducing the associated cutscene. Tested it very little so I am unsure if this happens all the time.


To get a video resolution similar to the [temp_video] on your THP video you can use the following flag on the above command <code>-q:v 1</code>
</blockquote>
</blockquote>


:<p>This will dump <b>all the frames</b> the <code>[temp_video]</code> has into <b>JPG images</b>.</p>
Then, to get the audio part of the video execute (Fig. 4):


<br>
<code>path\to\ffmpeg.exe -i [temp_video] -acodec pcm_s16le -ar 32000 [WAV_audio].wav</code>


[[File:THPConv-Guide Fig-2.webp|center|frame|<b>Fig. 2 - Create temp folder</b>]]
*<code>[WAV_audio].wav</code> is the name of the WAV audio file to use with THPConv.


<br>
:This will convert the audio of the <code>[temp_video]</code> in a WAV audio using the pcm_s16le format.


[[File:THPConv-Guide Fig-3.webp|center|frame|<b>Fig. 3 - Dump temp video frames into folder</b>]]
[[File:THPConv-Guide_Fig-4.webp|right|thumb|Fig. 4 - Create WAV audio file]]


<br>
<blockquote>
WAV audios are the only audio input THPConv can process. Specifically non-compressed 16-bit PCM data ones.


<hr>
WAV audios can be Mono or Stereo, they are both supported by THPConv.


:<p><b>NOTE 6:</b> <b>JPG</b> or <b>JPEG</b> can be used, the only restriction the <b>THPConv docs</b> say is that they need to be in the :<b>baseline DCT format</b> (which <b>ffmpeg</b> automatically converts them to with the above command).</p>
The <code>-ar 32000</code> sets the frequency of the WAV audio. 32000 Hz is needed for the audio in SMG1 since different values make the audio sound at a higher or lower pitch.
</blockquote>


:<p><b>NOTE 7:</b> The minimum frames a <b>THP video</b> can have without breaking the game is <b>21</b>. Tested with <code>PrologueA.thp</code> in <b>Riivolution</b>.</p>
Finally, to get the THP converted file we do (Fig. 5):


:<p><b>NOTE 8:</b> Very low <b>width</b> and <b>height</b> values for the <b>THP video</b> (<b>16x16</b> for example) will allow to show :<b>blue rectangles</b> on the screen when reproducing the associated <b>cutscene</b>. Tested it very little so I am unsure if this happens all the time.</p>
<code>path\to\THPConv.exe -j temp\output*.jpg -s [WAV_audio].wav -r 59.94 -d [Output THP].thp -v</code>


:<p><b>NOTE 9:</b> To get a <b>video resolution</b> similar to the <code>[temp_video]</code> on your <b>THP video</b> you can use the following flag on the above command <code>-q:v 1</code>.</p>
[[File:THPConv-Guide_Fig-5.webp|right|thumb|Fig. 5 - Create THP file with THPConv]]


<hr>
<blockquote>
The <code>-j</code> flag is used to select the JPEG sequential frames that are going to be used in the THP video.


<br>
The <code>-s</code> flag is used to select the WAV audio to be used in the THP video (optional).


:<p>Then, to get the <b>audio part</b> of the video execute (<b>Fig. 4</b>):</p>
The <code>-r</code> flag is used to set the frame rate of the THP video. If you want your video to reproduce normally on SMG1 use 59.94 as frame rate. If omitted THPConv will set the frame rate of the THP video to 29.97 fps.


<blockquote style="border: none;">
The <code>-d</code> flag is used to set the THP file creation path and name.


<pre>path\to\ffmpeg.exe -i [temp_video] -acodec pcm_s16le -ar 32000 [WAV_audio].wav</pre>
The <code>-v</code> flag is used to print more info on the CMD when THPConv is converting the JPG frames and WAV audio into a THP video (optional).


To check more info on the commands THPConv has, check its documentation (Wii SDK or [[THPConv | here]]).
</blockquote>
</blockquote>


*<p><code>[WAV_audio].wav</code> is the name of the <b>WAV audio file</b> to use with <b>THPConv</b>.</p>
Now you can replace the THP file with the one you want from your SMG1 dump and test the video on game!
 
:<p>This will convert the <b>audio</b> of the <code>[temp_video]</code> in a <b>WAV audio</b> using the <b>pcm_s16le format</b>.</p>
 
<br>
 
[[File:THPConv-Guide_Fig-4.webp|center|frame|<b>Fig. 4 - Create WAV audio file</b>]]
 
<br>
 
<hr>
 
:<p><b>NOTE 10:</b> <b>WAV audios</b> are the only audio input <b>THPConv</b> can process. Specifically <b>non-compressed 16-bit PCM data</b> ones.</p>


:<p><b>NOTE 11:</b> <b>WAV audios</b> can be <b>Mono</b> or <b>Stereo</b>, they are both supported by <b>THPConv</b>.</p>
<blockquote>
 
You can use VLC Media Player to play/test THP videos as well as FFmpeg to convert THP videos to other video formats (you can't convert to THP with FFmpeg).
:<p><b>NOTE 12:</b> the <code>-ar 32000</code> sets the <b>frequency</b> of the <b>WAV audio</b>. <b>32000 Hz</b> is needed for the audio in SMG1 since different values make the audio sound at a <b>higher or lower pitch</b>.</p>
 
<hr>
 
<br>
 
:<p><b>Finally</b>, to get the <b>THP</b> converted file we do (<b>Fig. 5</b>):</p>
 
<blockquote style="border: none;">
 
<pre>path\to\THPConv.exe -j temp\output*.jpg -s [WAV_audio].wav -r 59.94 -d [Output THP].thp -v</pre>


When testing the THP video on console it is better to not use Riivolution but rather pack the THP into the WBFS file and run said WBFS in a USB Loader. Due to either Riivolution file copying velocity or how inefficient the THP processing algorhythm/video format is (or a combination of both) the video can't be reproduced at its normal speed when being replaced by Riivolution.
</blockquote>
</blockquote>


[[File:THPConv-Guide_Fig-5.webp|center|frame|<b>Fig. 5 - Create THP file with THPConv</b>]]
''Thanks to Lord-Giganticus and EmilyTheDemon for their support during the guide!''
 
<br>
 
<hr>
 
:<p><b>NOTE 13:</b> the <code>-j</code> <b>flag</b> is used to select the <b>JPEG sequential frames</b> that are going to be used in the <b>THP video</b>.</p>
 
:<p><b>NOTE 14:</b> the <code>-s</code> <b>flag</b> is used to select the <b>WAV audio</b> to be used in the <b>THP video</b> (optional).</p>
 
:<p><b>NOTE 15:</b> the <code>-r</code> <b>flag</b> is used to set the <b>frame rate</b> of the <b>THP video</b>. If you want your video to reproduce normally on SMG1 use <b>59.94</b> as <b>frame rate</b>. If omitted <b>THPConv</b> will set the <b>frame rate</b> of the <b>THP video</b> to <b>29.97 fps</b>.</p>
 
:<p><b>NOTE 16:</b> the <code>-d</code> <b>flag</b> is used to set the <b>THP</b> file creation path and name.</p>
 
:<p><b>NOTE 17:</b> the <code>-v</code> <b>flag</b> is used to <b>print more info</b> on the <b>CMD</b> when <b>THPConv</b> is converting the <b>JPG frames</b> and <b>WAV audio</b> into a <b>THP video</b> (optional).</p>
 
:<p><b>NOTE 18:</b> to check more info on the commands <b>THPConv</b> has, check its documentation (<b>Wii SDK</b>).</p>
 
<hr>
 
<br>
 
:<p>Now you can replace the <b>THP file</b> with the one you want from your <b>SMG1 dump</b> and test the video on game!</p>
 
<br>
 
<hr>
 
:<p><b>NOTE 19:</b> You can use <b>VLC Media Player</b> to play/test <b>THP videos</b> as well as <b>FFmpeg</b> to convert <b>THP videos</b> to other <b>video formats</b> (you can't convert to <b>THP</b> with <b>FFmpeg</b>).</p>
 
:<p><b>NOTE 20:</b> When testing the <b>THP video</b> on <b>console</b> it is better to not use <b>Riivolution</b> but rather pack the <b>THP</b> into the <b>WBFS file</b> and run said <b>WBFS</b> in a <b>USB Loader</b>. Due to either <b>Riivolution</b> file copying velocity or how inefficient the <b>THP processing algorhythm/video format</b> is (or a combination of both) the video can't be reproduced at its <b>normal speed</b> when being replaced by <b>Riivolution</b>.</p>
 
<hr>
 
:<p>Thanks to <b>Lord-Giganticus</b> for his guidence and <b>EmilyTheDemon</b> for her enthusiasm. Tutorial based on the [https://luma.aurumsmods.com/wiki/THPConv.exe <b>Luma's Workshop Wiki</b>]
 
<hr>
 
<br>

Revision as of 21:32, 9 May 2024

This guide is created specifically to make THP videos for SMG1. Other games that support THP may have a different THP setup.

Required Tools

Steps

Open a CMD/Terminal in the same place the video you want to convert is and type the following command (Fig. 1):

path\to\ffmpeg.exe -i [input_video] -vf scale="[width]:[height]" -r [fps] [temp_video]

  • [input_video] is the video of your choice to convert. Can be any video format.
  • [width] is the width the [temp_video] will have. Cannot exceed 672 pixels.
  • [height] is the height the [temp_video] will have. There is no limit on this value.
  • [fps] are the frames per second the [temp_video] will have. Frame rates can be from 1.0 to 59.94.
Fig. 1 - Create temporal video

All this information is extracted from the Wii SDK docs for THPConv.

SMG uses 59.94 fps and 640x368 video dimensions for all THP files in the MovieData folder. Use path\to\ffmpeg.exe -i [THP video file] to see it yourself.

If you use different frame rates than 59.94 the video on SMG1 will play slower or faster but not at its "normal" speed.

You can use different values for the width and height of the video, be sure they follow the rules said above and that the dimensions are a multiple of 16.

To get a better video resolution on the final THP video you can use the following flags on the above command -preset veryslow -b:v 21M (file size will increase a lot as -b:v sets the bitrate of the output video). 21M was selected because of the bitrates of the OG THP videos on the MovieData folder (you can select any value you want, M means megabyte).

Create a folder named temp in the same place the [temp_video] is and then type the following command (Fig. 2 and 3):

path\to\ffmpeg.exe -i [temp_video] temp\output%03d.jpg

This will dump all the frames the [temp_video] has into JPG images.

Fig. 2 - Create temporal folder
Fig. 3 - Dump temporal video frames into folder

JPG or JPEG can be used, the only restriction the THPConv docs say is that they need to be in the baseline DCT format (which ffmpeg automatically converts them to with the above command).

The minimum frames a THP video can have without breaking the game is 21. Tested with PrologueA.thp in Riivolution.

Very low width and height values for the THP video (16x16 for example) will allow to show blue rectangles on the screen when reproducing the associated cutscene. Tested it very little so I am unsure if this happens all the time.

To get a video resolution similar to the [temp_video] on your THP video you can use the following flag on the above command -q:v 1

Then, to get the audio part of the video execute (Fig. 4):

path\to\ffmpeg.exe -i [temp_video] -acodec pcm_s16le -ar 32000 [WAV_audio].wav

  • [WAV_audio].wav is the name of the WAV audio file to use with THPConv.
This will convert the audio of the [temp_video] in a WAV audio using the pcm_s16le format.
Fig. 4 - Create WAV audio file

WAV audios are the only audio input THPConv can process. Specifically non-compressed 16-bit PCM data ones.

WAV audios can be Mono or Stereo, they are both supported by THPConv.

The -ar 32000 sets the frequency of the WAV audio. 32000 Hz is needed for the audio in SMG1 since different values make the audio sound at a higher or lower pitch.

Finally, to get the THP converted file we do (Fig. 5):

path\to\THPConv.exe -j temp\output*.jpg -s [WAV_audio].wav -r 59.94 -d [Output THP].thp -v

Fig. 5 - Create THP file with THPConv

The -j flag is used to select the JPEG sequential frames that are going to be used in the THP video.

The -s flag is used to select the WAV audio to be used in the THP video (optional).

The -r flag is used to set the frame rate of the THP video. If you want your video to reproduce normally on SMG1 use 59.94 as frame rate. If omitted THPConv will set the frame rate of the THP video to 29.97 fps.

The -d flag is used to set the THP file creation path and name.

The -v flag is used to print more info on the CMD when THPConv is converting the JPG frames and WAV audio into a THP video (optional).

To check more info on the commands THPConv has, check its documentation (Wii SDK or here).

Now you can replace the THP file with the one you want from your SMG1 dump and test the video on game!

You can use VLC Media Player to play/test THP videos as well as FFmpeg to convert THP videos to other video formats (you can't convert to THP with FFmpeg).

When testing the THP video on console it is better to not use Riivolution but rather pack the THP into the WBFS file and run said WBFS in a USB Loader. Due to either Riivolution file copying velocity or how inefficient the THP processing algorhythm/video format is (or a combination of both) the video can't be reproduced at its normal speed when being replaced by Riivolution.

Thanks to Lord-Giganticus and EmilyTheDemon for their support during the guide!