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.

Pictures never become sound

KnifeLemon93d4cced01ad
diff --git a/src/Filee.Engines/Media/FfmpegConverter.cs b/src/Filee.Engines/Media/FfmpegConverter.cs
index 041e9b95..6e1fb815 100644
--- a/src/Filee.Engines/Media/FfmpegConverter.cs
+++ b/src/Filee.Engines/Media/FfmpegConverter.cs
@@ -68,10 +68,13 @@ public sealed partial class FfmpegConverter(ILogger? logger = null) : IConverter
{
var videos = FormatRegistry.Known.Where(f => f.Category == FormatCategory.Video).Select(f => f.Id).ToList();
var audios = FormatRegistry.Known.Where(f => f.Category == FormatCategory.Audio).Select(f => f.Id);
- var videoTargets = MediaEncoding.VideoTargets.Keys.Concat(MediaEncoding.AudioTargets.Keys).Append("png").ToList();
+ var videoTargets = MediaEncoding.VideoTargets.Keys.Append("png").ToList();
return
[
.. from source in videos from target in videoTargets select new ConversionEdge(source, target),
+ // A picture turned into a video has no sound: picture → video → audio would only make a silent file.
+ .. from source in videos from target in MediaEncoding.AudioTargets.Keys
+ select new ConversionEdge(source, target, NotForImageSources: true),
// "Save every frame": a folder of numbered pictures, only when a preset asks for it (never in another route).
.. from source in videos from target in MediaOptions.FrameTargets select new ConversionEdge(source, target, FrameSequence: true),
// Subtitles out of a video. SRT is the hub to the other subtitle formats (the subtitle engine takes it on),
diff --git a/tests/Filee.Engines.Tests/MediaTests.cs b/tests/Filee.Engines.Tests/MediaTests.cs
index 5aafaf98..2e994cbb 100644
--- a/tests/Filee.Engines.Tests/MediaTests.cs
+++ b/tests/Filee.Engines.Tests/MediaTests.cs
@@ -111,6 +111,17 @@ public class MediaTests(EngineFixture fx) : IClassFixture<EngineFixture>
public void Every_frame_has_no_route_but_its_own(string from, string to) =>
Assert.Null(Planner().Plan(from, to, frames: true));
+ [Theory]
+ [InlineData("jpg", "wav")]
+ [InlineData("png", "mp3")]
+ [InlineData("gif", "flac")]
+ public void A_picture_never_becomes_sound(string from, string to)
+ {
+ // Picture → video → audio would only make a silent file.
+ Assert.Null(Planner().Plan(from, to));
+ Assert.NotNull(Planner().Plan("mp4", to)); // a video still gives its sound
+ }
+
[Fact]
public void A_video_to_jpg_is_still_turned_by_the_image_engine()
{