Skip to content

armgit / Filee

Public Imported from GitHub
0

Free, open-source file converter. Convert 263 formats offline by drag & drop — images, PDF, Word, Excel, PowerPoint, HWP/HWPX, video, audio, e-books and archives. No upload, no Office needed.

Read CRI USM game videos (.usm) (#485)

cre8ive-marketing9d3cd673ac89
diff --git a/docs/ENGINES.md b/docs/ENGINES.md
index 355148ef..49808b88 100644
--- a/docs/ENGINES.md
+++ b/docs/ENGINES.md
@@ -1374,6 +1374,9 @@ streams without a container: FFmpeg reports them as format `hevc` / `h264` (`Med
encoded, never copied, because their frames carry no timestamps (a copy into MP4 had non-monotonic DTS). A stream
without timing information is read at FFmpeg's default 25 fps, so a camera that recorded at another rate plays faster
or slower; its frames are all kept.
+CRI USM (`.usm`, read only, #485), the video of many games' cutscenes, is read by FFmpeg's `usm` demuxer and goes to
+every video and audio target like the other read-only containers. Encrypted USM files (common in recent games) can't
+be read and fail with FFmpeg's error.
A Video CD's `MPEGAV/AVSEQ01.DAT` (MPEG-1 in a RIFF/CDXA wrapper) counts as MPEG: `.dat` is an extension of that
format, and FFmpeg reads what the file holds, so a `.dat` with no video in it fails instead of making a file.
diff --git a/src/Filee.Core/Formats/FormatRegistry.cs b/src/Filee.Core/Formats/FormatRegistry.cs
index 28ccc18b..dc1ffac1 100644
--- a/src/Filee.Core/Formats/FormatRegistry.cs
+++ b/src/Filee.Core/Formats/FormatRegistry.cs
@@ -221,6 +221,8 @@ public static class FormatRegistry
new("swf", "SWF", FormatCategory.Video, ["swf"], Writable: false),
new("wtv", "WTV", FormatCategory.Video, ["wtv", "dvr-ms", "dvr"], Writable: false),
new("cavs", "CAVS", FormatCategory.Video, ["cavs"], Writable: false),
+ // CRI Middleware's video for game cutscenes (#485): FFmpeg's usm demuxer reads unencrypted ones.
+ new("usm", "USM", FormatCategory.Video, ["usm"], Writable: false),
// Raw H.265 / H.264 streams with no container, as security cameras and VMS software export them (issue #301).
new("h265", "H.265", FormatCategory.Video, ["h265", "265", "hevc"], Writable: false),
new("h264", "H.264", FormatCategory.Video, ["h264", "264"], Writable: false),
diff --git a/src/Filee.Core/Settings/AppSettings.cs b/src/Filee.Core/Settings/AppSettings.cs
index 91859a71..65c287f4 100644
--- a/src/Filee.Core/Settings/AppSettings.cs
+++ b/src/Filee.Core/Settings/AppSettings.cs
@@ -123,7 +123,7 @@ public sealed class DonutSettings
public sealed class AppSettings
{
/// <summary>Current schema version. Increase when the format changes and add a migration.</summary>
- public const int CurrentSchemaVersion = 42;
+ public const int CurrentSchemaVersion = 43;
public int SchemaVersion { get; set; } = CurrentSchemaVersion;
diff --git a/src/Filee.Core/Settings/UserDataStore.cs b/src/Filee.Core/Settings/UserDataStore.cs
index 593fe02b..26880f43 100644
--- a/src/Filee.Core/Settings/UserDataStore.cs
+++ b/src/Filee.Core/Settings/UserDataStore.cs
@@ -836,6 +836,9 @@ internal static class SettingsMigrations
changed = true;
}
}
+ // v43: CRI USM game videos (.usm) learn the video donut; custom claims stay put.
+ if (from < 43)
+ changed |= LearnExtensions(profiles, out _, ["usm"]);
return changed;
}
diff --git a/tests/Filee.Core.Tests/UsmFormatTests.cs b/tests/Filee.Core.Tests/UsmFormatTests.cs
new file mode 100644
index 00000000..93b307c3
--- /dev/null
+++ b/tests/Filee.Core.Tests/UsmFormatTests.cs
@@ -0,0 +1,34 @@
+// CRI USM game videos (#485): a read-only video source on the video donut, learned by existing libraries.
+
+using Filee.Core.Formats;
+using Filee.Core.Presets;
+using Filee.Core.Profiles;
+using Filee.Core.Settings;
+
+namespace Filee.Core.Tests;
+
+public class UsmFormatTests
+{
+ [Fact]
+ public void Usm_is_a_video_filee_reads_but_never_writes()
+ {
+ var usm = FormatRegistry.Detect("cutscene.USM");
+ Assert.NotNull(usm);
+ Assert.Equal(("usm", FormatCategory.Video, false), (usm.Id, usm.Category, usm.Writable));
+ Assert.Equal("video", ProfileSelector.Select(BuiltInData.CreateProfiles(), ["movie01.usm"])?.Id);
+ }
+
+ [Fact]
+ public void Version_42_libraries_learn_usm_once()
+ {
+ var presets = BuiltInData.CreatePresets();
+ var profiles = BuiltInData.CreateProfiles();
+ var video = profiles.Single(p => p.Id == "video");
+ video.Extensions.Remove("usm");
+
+ Assert.True(SettingsMigrations.ApplyToLibrary(42, presets, profiles));
+
+ Assert.Contains("usm", video.Extensions);
+ Assert.False(SettingsMigrations.ApplyToLibrary(42, presets, profiles));
+ }
+}
diff --git a/tests/Filee.Engines.Tests/MediaTests.cs b/tests/Filee.Engines.Tests/MediaTests.cs
index 51fc46e3..6035f1ad 100644
--- a/tests/Filee.Engines.Tests/MediaTests.cs
+++ b/tests/Filee.Engines.Tests/MediaTests.cs
@@ -23,6 +23,16 @@ public sealed class FfmpegCollection;
[Collection(nameof(FfmpegCollection))]
public class MediaTests(EngineFixture fx) : IClassFixture<EngineFixture>
{
+ [Fact]
+ public void Cri_usm_game_videos_go_to_mp4_through_ffmpeg()
+ {
+ // #485: read only, through FFmpeg's usm demuxer; never a step towards something else.
+ var route = fx.Catalog.CreatePlanner().Plan("usm", "mp4");
+ Assert.NotNull(route);
+ Assert.Equal("ffmpeg", Assert.Single(route.Steps).Converter.Id);
+ Assert.Null(fx.Catalog.CreatePlanner().Plan("mp4", "usm"));
+ }
+
private static readonly (string Ffmpeg, string Ffprobe)? Tools = FfmpegConverter.Locate();
private static void SkipUnlessInstalled() =>