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.
C# audio-converteravaloniabatch-conversionconvertercsharpdocument-converterdocx-to-pdfdotnetdrag-and-dropfile-conversionfile-converterheic-converterhwphwpximage-converterlinuxmacospdf-convertervideo-converterwindows
Merge origin/main: Live Photos become settings schema 31 after the back faces
KnifeLemon32f605b55980
diff --cc docs/ENGINES.mdindex d5d10ff6,9f630959..dbdb285b--- a/docs/ENGINES.md+++ b/docs/ENGINES.md@@@ -1335,49 -1362,6 +1364,50 @@@ Same-format edges exist too, so "MP4 72read from (IMG_0001.HEIC → `IMG_0001 (2).mov`). A photo without a video fails with "This photo has no videoFilee can read"; why goes to the log.- Not read: vendor formats without this metadata (Huawei's "LIVE_" trailer, for one).+- **Making Live / Motion Photos** (experimental until confirmed on phones; *A video becomes* on a JPG or HEIC preset,- `MediaOptions.LivePhoto`; the presets "Live Photo (iPhone)" and "Motion Photo (Android)", JPG, on no donut, added in- settings schema 31): a short clip of a video becomes a moving photo instead of one still frame.++ `MediaOptions.LivePhoto`; the presets "Live Photo (iPhone)" and "Motion Photo (Android)", JPG, on the back of the++ video donut, added in settings schema 31): a short clip of a video becomes a moving photo instead of one still++ frame.+ - Routes: the live edges (`ConversionEdge.LivePhoto`, every video → JPG and HEIC) are taken only when+ `Preset.MakesLivePhotoOf` the file (an iPhone Live Photo as JPG or HEIC, a Motion Photo as JPG,+ `MediaOptions.LivePhotoTargets`), and then as the whole route (`RoutePlanner.Plan(from, to, livePhoto: true)`); "Save+ every frame" is ignored meanwhile. Other files and targets convert as usual.+ - The clip (`Media/LivePhotoWriter.cs`): *Clip start*, *Clip length* (0.5 to 5 s, 3 by default, shorter when the+ video ends sooner; a start past the end is refused) and *Photo at* (seconds into the clip, 1.5 by default, the last+ frame at most). FFmpeg encodes it at 30 fps, upright (the phone's rotation is applied to the pixels), scaled to at+ most 1440 px on the shorter side (or the preset's maximum height), 8-bit 4:2:0 H.264 (HEVC when the preset asks,+ tagged `hvc1`), the sound as AAC (mono or stereo, 44.1 or 48 kHz) unless the preset removes it. HDR (PQ or HLG) is+ tone-mapped to SDR BT.709 with zscale; an FFmpeg without zscale refuses HDR with a message. The photo is the same+ frame at the video's full size, picked by the same 30 fps timing (`select` on the frame number the clip really has,+ counted from its `stsz`), encoded at the preset's image quality.+ - **iPhone Live Photo**: a JPG (or HEIC) and a MOV with the same name and one content identifier (a new upper-case+ UUID), the pair Photos imports as a Live Photo. The photo carries it in Apple's maker note (Exif `MakerNote`,+ "Apple iOS" big-endian, tag 17, ASCII), HEIC through the HEIC writer's Exif item. The MOV (QuickTime, `qt ` brand)+ gets, as an iPhone writes them: `com.apple.quicktime.content.identifier` in a movie-level `meta` (plain container,+ `mdta` handler, `keys`, `ilst` with a UTF-8 `data` item), and a timed metadata track for the still: track flags 0xF,+ `tref/cdsc` to the video track, a `mhlr/meta` handler, `gmhd`, an alias data reference, a `mebx` sample entry whose+ key 1 is `mdta` + `com.apple.quicktime.still-image-time` typed as a signed 8-bit integer (well-known type 65), one+ 9-byte sample (the item, value -1) of one tick at the movie's timescale, placed by an empty edit at the photo's+ time (`AppleLivePhoto.TagMovie`). FFmpeg leaves the movie header at the end, so only that header is rewritten: the+ sample goes into a small `mdat` where it was, and no chunk offset moves. Not written: the other timed metadata of+ an iPhone (live-photo-info, the still's transform, video orientation) and its camera keys, which Photos does not+ need to pair the files.+ - **Android Motion Photo**: one `NAME.MP.jpg` (the name a Pixel gives them): the JPEG, then the clip as MP4 appended,+ ending the file. Its XMP APP1 (after the JFIF APP0 and an Exif APP1) is laid out as a Pixel's:+ `GCamera:MotionPhoto` 1, `MotionPhotoVersion` 1, `MotionPhotoPresentationTimestampUs` (the photo's time in the+ clip), and a `Container:Directory` of the primary JPEG and the video (`video/mp4`, `MotionPhoto`, its length,+ `Padding` 0); the older `GCamera:MicroVideo` properties (the same length as `MicroVideoOffset`) are written too for+ older Google Photos (`MotionPhoto.WriteAsync`). Samsung's own SEF trailer is not written.+ - Expected to work, to be confirmed on devices: Photos on iPhone, iPad and Mac with both files imported together+ (iCloud Photos, AirDrop of both, Image Capture or Photos on a Mac; a single file sent through a messenger loses the+ pairing), Google Photos on Android, iPhone and the web, and galleries that read Google's Motion Photo XMP (Samsung+ Gallery on recent One UI is likely but untested). Not expected: galleries that only know their maker's own format.+ - Everything is written in the work directory and moved into place at the end, first next to its target under a+ hidden name, then renamed over it: a failed or cancelled run never touches an existing file. The pair keeps one+ name: when the MOV's name is taken (another file, or the video being converted, which is never written over) both+ take the next number (`clip (2).jpg` + `clip (2).mov`); a MOV is only written over together with the photo+ "overwrite" replaces; "skip" skips the pair when the photo exists. Filee's own extraction (above) reads both kinds+ back.- Pictures → MP4/WEBM/MOV go through a full-size PNG from the image engines (HEIC → PNG → MOV): a 5-second still at30 fps, one quality step above the preset (identical frames cost almost nothing; x264 `-tune stillimage`). ThePNG's ICC profile is read (`-flags2 +icc_profiles`), so primaries and transfer are tagged as the photo's (Displaydiff --cc src/Filee.Core/Presets/BuiltInData.csindex 3bdaf92a,8e58a795..4a3c96c0--- a/src/Filee.Core/Presets/BuiltInData.cs+++ b/src/Filee.Core/Presets/BuiltInData.cs@@@ -101,16 -100,6 +101,16 @@@ public static class BuiltInDatnew() { Id = "extract-motion", NameKey = "preset.extract_motion", TargetFormat = "mp4", Media = { ExtractMotionPhoto = true } },];+ /// <summary>+ /// A clip of a video as an iPhone Live Photo (a JPG and a MOV) or an Android Motion Photo (added in settings schema- /// 31), on no donut: users add them in Settings → Toolbar.++ /// 31), on the back of the video donut after "Extract frames".+ /// </summary>+ public static List<Preset> LivePhotoPresets() =>+ [+ new() { Id = "live-photo-iphone", NameKey = "preset.live_photo_iphone", TargetFormat = "jpg", Media = { LivePhoto = LivePhotoKind.Apple } },+ new() { Id = "motion-photo-android", NameKey = "preset.motion_photo_android", TargetFormat = "jpg", Media = { LivePhoto = LivePhotoKind.Android } },+ ];+/// <summary>/// "Compress PDF": pictures at 150 dpi, the rest compressed losslessly (added in settings schema 20). On no default/// donut, the PDF donut is full: users add it in Settings → Toolbar.@@@ -444,6 -446,9 +457,10 @@@Id = "video", NameKey = "profile.video",Extensions = ExtensionsOf(FormatCategory.Video),PresetIds = ["to-mp4", "mp4-720", "mp4-hevc", "to-webm", "to-mov", "to-gif", "to-mp3", "extract-subtitles", "to-mkv", "to-avi"],+ // Every frame as pictures is on no front (a long video gives thousands of files): behind a flip, a drop that- // misses its slice doesn't start it.- BackPresetIds = ["mp4-av1", "to-webp", "extract-frames-png", "extract-frames-jpg", "to-m4a", "to-wav", "to-flac", "zip-all"],++ // misses its slice doesn't start it. Live / Motion Photos of a clip are there too.++ BackPresetIds = ["mp4-av1", "to-webp", "extract-frames-png", "extract-frames-jpg", "live-photo-iphone", "motion-photo-android",++ "to-m4a", "to-wav", "to-flac", "zip-all"],},new(){diff --cc src/Filee.Core/Settings/UserDataStore.csindex 97d006ba,8bfee9b7..83996639--- a/src/Filee.Core/Settings/UserDataStore.cs+++ b/src/Filee.Core/Settings/UserDataStore.cs@@@ -701,28 -708,13 +708,45 @@@ internal static class SettingsMigration}changed |= LearnExtensions(profiles, out _, ["livp"]);}- // v31 (30 is kept for another change): "Live Photo (iPhone)" and "Motion Photo (Android)" (a clip of a video- // as a moving photo), after "Extract Live Photo video" as in a new library, on no donut. Present already- // but saved since by a Filee before 31: that one dropped the option and left a plain JPG preset, so it is- // put back.+ // v30: every donut gets a back face, which Tab (or the mouse wheel) flips the open donut to. A built-in donut+ // gets its default one (with the presets the library still has), a donut the user made none; no front+ // changes. Also at a later schema when a donut has no back face at all, not even an empty one: a Filee+ // before 30 saved the library since and dropped what it didn't know, so the built-in back faces come+ // back. One the user emptied is saved empty and stays so.+ if (from < 30 || profiles.Any(p => p.BackPresetIds is null))+ changed |= AddBackFaces(presets, profiles);++ // v31: "Live Photo (iPhone)" and "Motion Photo (Android)" (a clip of a video as a moving photo), after "Extract++ // Live Photo video" as in a new library, and on the back of the video donut after "Extract frames" when it++ // has room and the user hasn't put them elsewhere on it. Present already but saved since by a Filee before++ // 31: that one dropped the option and left a plain JPG preset, so it is put back.+ if (from < 31)+ {++ if (profiles.FirstOrDefault(p => p.Id == "video") is { BackPresetIds: { } back })++ {++ var missing = BuiltInData.LivePhotoPresets().Select(p => p.Id).Where(id => !back.Contains(id)).ToList();++ if (missing.Count > 0 && back.Count + missing.Count <= ToolbarProfile.MaxSlices)++ {++ var after = back.IndexOf("extract-frames-jpg");++ back.InsertRange(after < 0 ? back.Count(id => id != "zip-all") : after + 1, missing);++ changed = true;++ }++ }+ foreach (var live in BuiltInData.LivePhotoPresets())+ {+ if (presets.FirstOrDefault(p => p.Id == live.Id) is { } existing)+ {+ if (existing.Media.LivePhoto == LivePhotoKind.None && existing.TargetFormat == live.TargetFormat)+ {+ existing.Media.LivePhoto = live.Media.LivePhoto;+ changed = true;+ }+ continue;+ }+ var at = presets.FindLastIndex(p => p.Id is "extract-motion" or "live-photo-iphone" or "extract-frames-jpg");+ presets.Insert(at < 0 ? presets.Count : at + 1, live);+ changed = true;+ }+ }return changed;}diff --cc tests/Filee.App.Tests/RenderTests.csindex b7922614,f742d452..aa297ee3--- a/tests/Filee.App.Tests/RenderTests.cs+++ b/tests/Filee.App.Tests/RenderTests.cs@@@ -1804,49 -1804,7 +1804,49 @@@ public class RenderTestAssert.False(preset.Media.ExtractMotionPhoto);}+ [AvaloniaTheory]+ [InlineData("en")]+ [InlineData("ko")]+ [InlineData("ja")]+ [InlineData("zh-CN")]+ [InlineData("ru")]+ public void Live_photo_options_render_for_jpg_and_heic_and_save_only_there(string language)+ {+ TestServices.EnsureInitialized(language);+ var preset = Filee.Core.Presets.BuiltInData.LivePhotoPresets().First();+ var vm = new PresetEditorViewModel(preset, AppHost.Get<ILocalizer>());+ Assert.True(vm.ShowLivePhotoChoice);+ Assert.True(vm.IsLivePhoto);+ Assert.False(vm.ShowImage);+ Assert.False(vm.ShowSaveEveryFrame);+ Assert.Equal(3, vm.LivePhotoKinds.Count);+ var window = new PresetEditorWindow { DataContext = vm, Height = 980 };+ window.Show();+ Pump();+ Save(window, $"preset-live-photo-{language}.png");+ window.Close();++ // HEIC is an iPhone's: no Motion Photo there.+ vm.Target = vm.Targets.Single(t => t.Value == "heic");+ Assert.Equal(2, vm.LivePhotoKinds.Count);+ Assert.True(vm.IsLivePhoto);+ vm.LivePhotoCodecChoice = vm.LivePhotoCodecs.Single(c => c.Value == Filee.Core.Presets.VideoCodec.Hevc);+ vm.LivePhotoLength = 60;+ Assert.True(vm.Apply());+ Assert.Equal(("heic", Filee.Core.Presets.LivePhotoKind.Apple), (preset.TargetFormat, preset.Media.LivePhoto));+ Assert.Equal(Filee.Core.Presets.VideoCodec.Hevc, preset.Media.VideoCodec);+ Assert.Equal(Filee.Core.Presets.MediaOptions.MaxLivePhotoLength, preset.Media.LivePhotoLength);++ // A kind left behind by a target that can't be one saves nothing.+ var restored = new PresetEditorViewModel(preset, AppHost.Get<ILocalizer>());+ restored.Target = restored.Targets.Single(t => t.Value == "png");+ Assert.False(restored.ShowLivePhotoChoice);+ Assert.True(restored.ShowImage);+ Assert.True(restored.Apply());+ Assert.Equal(Filee.Core.Presets.LivePhotoKind.None, preset.Media.LivePhoto);+ }+- private static void Pump()+ internal static void Pump(){// Let layout, bindings and a few animation frames run.for (var i = 0; i < 40; i++)diff --cc tests/Filee.Core.Tests/UserDataStoreTests.csindex abb64cf6,7089e627..fb78c1dd--- a/tests/Filee.Core.Tests/UserDataStoreTests.cs+++ b/tests/Filee.Core.Tests/UserDataStoreTests.cs@@@ -954,54 -954,6 +954,68 @@@ public class UserDataStoreTestAssert.Single(presets, p => p.Id == "extract-motion");}+ [Fact]- public void Version_29_libraries_get_the_live_photo_presets_after_extract_live_video_on_no_donut()++ public void Version_30_libraries_get_the_live_photo_presets_after_extract_live_video_and_behind_the_video_donut()+ {- // As written with schema 29 (30 is another change's): no Live / Motion Photo presets.++ // As written with schema 30: no Live / Motion Photo presets, and the video donut's back face without them.+ var presets = BuiltInData.CreatePresets();+ presets.RemoveAll(p => p.Id is "live-photo-iphone" or "motion-photo-android");+ var profiles = BuiltInData.CreateProfiles();++ var video = profiles.Single(p => p.Id == "video");++ video.BackPresetIds!.RemoveAll(id => id is "live-photo-iphone" or "motion-photo-android");+- Assert.True(SettingsMigrations.ApplyToLibrary(29, presets, profiles));++ Assert.True(SettingsMigrations.ApplyToLibrary(30, presets, profiles));++ var iphone = presets.Single(p => p.Id == "live-photo-iphone");+ var android = presets.Single(p => p.Id == "motion-photo-android");+ Assert.Equal((LivePhotoKind.Apple, "jpg"), (iphone.Media.LivePhoto, iphone.TargetFormat));+ Assert.Equal((LivePhotoKind.Android, "jpg"), (android.Media.LivePhoto, android.TargetFormat));+ // Where a new library has them, on no donut.+ Assert.Equal(BuiltInData.CreatePresets().Select(p => p.Id), presets.Select(p => p.Id));+ Assert.Equal("extract-motion", presets[presets.IndexOf(iphone) - 1].Id);+ Assert.DoesNotContain(profiles, p => p.PresetIds.Contains("live-photo-iphone") || p.PresetIds.Contains("motion-photo-android"));- Assert.False(SettingsMigrations.ApplyToLibrary(29, presets, profiles)); // once only++ // Behind the video donut as in a new one, after "Extract frames".++ Assert.Equal(BuiltInData.CreateProfiles().Single(p => p.Id == "video").BackPresetIds, video.BackPresetIds);++ Assert.False(SettingsMigrations.ApplyToLibrary(30, presets, profiles)); // once only++++ // A back face the user filled up stays as it is.++ var full = BuiltInData.CreateProfiles();++ var fullBack = full.Single(p => p.Id == "video").BackPresetIds!;++ fullBack.RemoveAll(id => id is "live-photo-iphone" or "motion-photo-android");++ while (fullBack.Count < ToolbarProfile.MaxSlices)++ fullBack.Add("to-mp3");++ var before = fullBack.ToList();++ SettingsMigrations.ApplyToLibrary(30, BuiltInData.CreatePresets(), full);++ Assert.Equal(before, fullBack);++ // Back from an older Filee, which dropped the option it didn't know: the preset makes Live Photos again.+ iphone.Media.LivePhoto = LivePhotoKind.None;+ iphone.Name = "My Live Photo";+ Assert.True(SettingsMigrations.ApplyToLibrary(30, presets, profiles));+ Assert.Equal(LivePhotoKind.Apple, iphone.Media.LivePhoto);+ Assert.Equal("My Live Photo", iphone.Name);+ Assert.Single(presets, p => p.Id == "live-photo-iphone");+ }++ [Fact]+ public void Live_photo_options_survive_saving_and_unknown_kinds_read_as_none()+ {+ var preset = new Preset+ {+ TargetFormat = "heic",+ Media = { LivePhoto = LivePhotoKind.Apple, LivePhotoStart = 2.5, LivePhotoLength = 2, LivePhotoCover = 0.5 },+ };+ var json = System.Text.Json.JsonSerializer.Serialize(preset, FileeJsonContext.Default.Preset);+ Assert.Contains("\"livePhoto\": \"Apple\"", json);+ var read = System.Text.Json.JsonSerializer.Deserialize(json, FileeJsonContext.Default.Preset)!;+ Assert.Equal((LivePhotoKind.Apple, 2.5, 2.0, 0.5),+ (read.Media.LivePhoto, read.Media.LivePhotoStart, read.Media.LivePhotoLength, read.Media.LivePhotoCover));++ // A kind of a newer Filee: still one preset that loads, as a plain conversion.+ var future = System.Text.Json.JsonSerializer.Deserialize(json.Replace("\"Apple\"", "\"Hologram\""), FileeJsonContext.Default.Preset)!;+ Assert.Equal(LivePhotoKind.None, future.Media.LivePhoto);+ }+[Fact]public void Version_15_libraries_get_the_tracing_presets_on_the_images_donut_after_pdf(){