USM

USM is a video format commonly used by the PS3 and some other consoles. In Persona 5, USM files contain 2D anime cutscenes, pre-rendered 3D cutscenes, and various videos displayed on in-game objects like TV screens, list here: Movie (P5).

Scaleform Tool
In order to be able to create an USM file you need to use Scaleform Tool. It requires an AVI file as input and it needs to match the resolution of the USM found in the game you are modding or else it will glitch.

VGMToolbox
VGMToolbox is a free C# based tool designed for VGM (video game music) collectors and dumpers. However, it also contains tools for extracting and converting USM video to usable files. You can get VGMToolbox here.

To extract USM files in VGMToolbox, go to Misc. Tools > Stream Tools > Video Demultiplexer and select "USM (CRI Movie 2)" in the Format box. Then simply drag and drop your USM files you wish VGMToolbox and they will automatically begin to be extracted. The final result will be two separate file types: M2V (which contains video, but not audio), and ADX (which contains audio, but not video). In some cases, M2V files may appear pixelated, though this can be corrected with FFMpeg. In order to convert ADX to usable audio or combine the video and audio files, you will need the other tools listed below.

ChipAmp (Winamp Plugin)
ChipAmp is a free plugin bundle for the Winamp media player that can play and convert audio files from various game consoles. It is needed to convert the ADX audio files contained within USM files to usable audio. You can get the ChipAmp plugin bundle here. If you do not already have WinAmp installed, you can get that here.

With both Winamp and ChipAmp installed, open your ADX file in Winamp. Go to your Winamp preferences (Options > Preferences or Ctrl+P), scroll down to Plug-Ins > Output, select Nullsoft Disk Writer, and click Configure at the bottom. Set up your export preferences as you wish (make sure to set Output File Type to "Force WAV file"), and click Okay when finished. When finished, click Play in Winamp and your ADX file will be converted to a WAV file.

FFmpeg
FFmpeg is a free suite of libraries and programs for handling video, audio, and other multimedia files and streams. It can depixelate M2V video from USM files, and can also recombine M2V video and WAV audio into a single MKV file. You can get it here.

To recombine M2V video and WAV audio, open Command Prompt and change directory ("cd" followed by a space and the full folder path) to your FFmpeg folder. Hit Enter, then type "cd bin" and hit Enter to navigate to the "bin" folder. Type "ffmpeg -i (filename of the video file in the bin folder).m2v -i (filename of the audio file in the bin folder).wav (file name you want to call the merged video).mkv" and hit Enter. When it's finished, your merged video will be in FFmpeg's bin folder.

CRIDusmDemuxTool
CRIDusmDemuxTool is a command line program that allows USMs from Persona 5 The Royal to be extracted. Audio is extracted fine but the M2V video may appear to be corrupted. If that occurs, convert the M2V to another video format, preferable MP4. You can get it here.

Persona 4 Golden
If necessary, you can collect a more detailed breakdown of metadata with tools like "Metadata2Go".

Stream Index
Pay close attention to the changes between v1.0 and v1.1 in the metadata table above. The stream index of custom USM/WMV files must be configured appropriately to play correctly in-game. Even opening and end credits videos (e.g. p4ctop3, p4ct017) have two audio streams despite the tracks being identical. Be sure to follow this convention to avoid issues.

FFmpeg's documentation on the "Map" command is essential reading for anyone looking to rearrange streams to ensure their custom video plays correctly. You can find this here: https://trac.ffmpeg.org/wiki/Map

Practical Example
As a simple example, let's imagine we want to encode a 1080p MP4 with FFmpeg to work in-game.

ffprobe -v error -show_entries stream=index,codec_name,codec_type "INPUT.mp4"
 * First, identify the streams with ffprobe:

For this example, we can see that the streams of our source file are indexed as follows:

index 0 = aac (audio)

index 1 = h264 (video)

However, v1.1 (REV 2033) USM files should be formatted as follows:

index 0 = wmapro (japanese audio)

index 1 = wmapro (english audio)

index 2 = vc1 (video)

ffmpeg -i "INPUT.mp4" -qscale 1 -vcodec wmv2 -acodec wmav2 -map 0:0 -map 0:0 -map 0:1 "OUTPUT.wmv"
 * To encode our example mp4 to meet these specifications we can use the following command:

As you can see, we've decided to use the wmv2 and wmav2 codecs in this case, instead of vc1/wmapro. In my experience, FFmpeg doesn't handle wmv3/vc1 well and wmv2 will work just fine in P4G so we'll use that. Once we've encoded the WMV, we just need to manually rename the extension to USM and it should work fine in-game.

Resolution
Custom USM/WMV files should match the native resolution of the files you are replacing. Unless you're working with the "low quality" files introduced in v1.1, this will be 1920x1080. Custom files with a resolution greater or less than this will not scale correctly in-game.