Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
baeab62
Add files via upload
MrHero118 Mar 18, 2024
e36222e
update translarion and credit
AshiVered Mar 18, 2024
a24b934
Merge pull request #406 from MrHero118/integration
Tichau Mar 19, 2024
d76acc8
Merge pull request #407 from AshiVered/integration
Tichau Mar 19, 2024
17d9082
Update readme and changelog with new translations.
Tichau Mar 19, 2024
caf5b9b
Update Portuguese (Portugal) translation
hugok79 Mar 20, 2024
1952c18
Try some cuda stuff
tacheometry Mar 26, 2024
5f7bcad
Add setting for hardware acceleration mode
tacheometry Mar 26, 2024
57b1b79
Use hardware accel setting
tacheometry Mar 26, 2024
b8da1fe
Full CUDA transcoding
tacheometry Mar 27, 2024
811dcfc
Use localization keys
tacheometry Mar 27, 2024
03aeec0
Merge pull request #408 from hugok79/patch-2
Tichau Jul 19, 2024
3b4492e
Serbian Cyrillic and Serbian Latin translations
crnobog69 Aug 13, 2024
4ee1d7a
Add files via upload
oogamiyuta Sep 22, 2024
ce77ea0
Update Resources.ja-jp.resx
oogamiyuta Sep 22, 2024
a6d773a
Czech Translation
AidyTheWeird Sep 27, 2024
a96228f
Add Korean translation
Alanimdeo Sep 30, 2024
0d6c499
Fix typo
Alanimdeo Sep 30, 2024
e7920d8
Update Resources.fa-IR.resx
Mehrdad32 Nov 6, 2024
605bd44
Update zh-TW
NeKoOuO Nov 12, 2024
ea22f9f
Implement gif to img conversion
RTnhN Nov 24, 2024
da82ee8
Update CHANGELOG.md
RTnhN Nov 24, 2024
cff6b14
Update ImageMagick to 14.2
RTnhN Dec 10, 2024
81d7c62
Create Resources.vi-VN.resx
vrykolakas166 Dec 25, 2024
e5cf8fc
Update Resources.vi-VN.resx
vrykolakas166 Dec 25, 2024
c6af411
Add Russian localization
iliamak Jan 23, 2025
3fd3273
Merge pull request #412 from tacheometry/integration
Tichau Feb 14, 2025
688f708
Merge pull request #470 from crnobog69/integration
Tichau Feb 14, 2025
12af1ac
Merge pull request #486 from oogamiyuta/integration
Tichau Feb 14, 2025
d8d7a1f
Merge pull request #487 from AidyTheWeird/integration
Tichau Feb 14, 2025
9328ce1
Merge branch 'integration' of github.com:Alanimdeo/FileConverter into…
Tichau Feb 14, 2025
3dfc3ca
Merge branch 'Alanimdeo-integration' into integration
Tichau Feb 14, 2025
e3be6ec
Merge pull request #499 from Mehrdad32/integration
Tichau Feb 14, 2025
cc7d156
Merge pull request #507 from NeKoOuO/patch-1
Tichau Feb 14, 2025
52e09c0
Merge pull request #534 from vrykolakas166/integration
Tichau Feb 14, 2025
d575909
Merge pull request #544 from iliamak/integration
Tichau Feb 14, 2025
0f8d021
Add: new localizations integration
Tichau Feb 14, 2025
6e0815f
Tech: Update project installer to Wix 5.
Tichau Feb 14, 2025
a435c03
Tech: migrate packages.config to PackageReferences.
Tichau Feb 14, 2025
b65d507
Tech: Update ffmpeg to v7.1 and ImageMagick to v14.4.
Tichau Feb 14, 2025
6a5bdfc
Change: Update readme
Tichau Feb 14, 2025
e214d9f
Improve zh-TW Traditional Chinese translation
PeterDaveHello Feb 14, 2025
6848eb6
Merge branch 'GifToImg' of github.com:RTnhN/FileConverter into RTnhN-…
Tichau Feb 14, 2025
65f35f8
Merge branch 'RTnhN-GifToImg' into integration
Tichau Feb 14, 2025
f61addf
Merge pull request #530 from PeterDaveHelloKitchen/zh-TW
Tichau Feb 14, 2025
cb13a2f
Change: Update readme and ChangeLog
Tichau Feb 14, 2025
d6afefe
Chore: Change software year to 2025.
Tichau Feb 14, 2025
231413d
Fixes: Issue where video where rotated when using the To Mp4 scale 25…
Tichau Feb 17, 2025
bbb5152
Update gitignore
Tichau Feb 17, 2025
892c8cb
Update version number to 2.1.0
Tichau Feb 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,4 @@ FakesAssemblies/

# Ignore the installer signing commands file
Installer/Installer.sign
Certificate/*
27 changes: 0 additions & 27 deletions Application/FileConverter/App.config

This file was deleted.

6 changes: 3 additions & 3 deletions Application/FileConverter/Application.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// <copyright file="Application.xaml.cs" company="AAllard">License: http://www.gnu.org/licenses/gpl.html GPL version 3.</copyright>

/* File Converter - This program allow you to convert file format to another.
Copyright (C) 2024 Adrien Allard
Copyright (C) 2025 Adrien Allard
email: [email protected]

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -38,8 +38,8 @@ public partial class Application : System.Windows.Application
private static readonly Version Version = new Version()
{
Major = 2,
Minor = 0,
Patch = 2,
Minor = 1,
Patch = 0,
};

private bool needToRunConversionThread;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ public static ConversionJob Create(ConversionPreset conversionPreset, string inp
return new ConversionJob_ImageMagick(conversionPreset, inputFilePath);
}

if (Helpers.GetExtensionCategory(inputFileExtension) == Helpers.InputCategoryNames.Image ||
Helpers.GetExtensionCategory(inputFileExtension) == Helpers.InputCategoryNames.Document)
if (conversionPreset.OutputType == OutputType.Jpg ||
conversionPreset.OutputType == OutputType.Png ||
conversionPreset.OutputType == OutputType.Webp)
{
return new ConversionJob_ImageMagick(conversionPreset, inputFilePath);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,23 @@ private static string ComputeAudioChannelArgs(ConversionPreset conversionPreset)
return channelArgs;
}

private static string ComputeTransformArgs(ConversionPreset conversionPreset)
private static string ComputeTransformArgs(ConversionPreset conversionPreset, Helpers.HardwareAccelerationMode hwAccel = Helpers.HardwareAccelerationMode.Off)
{
float scaleFactor = conversionPreset.GetSettingsValue<float>(ConversionPreset.ConversionSettingKeys.VideoScale);
string scaleArgs = string.Empty;

if (conversionPreset.OutputType == OutputType.Mkv || conversionPreset.OutputType == OutputType.Mp4)
{
// This presets use h264 codec, the size of the video need to be divisible by 2.
scaleArgs = string.Format("scale=trunc(iw*{0}/2)*2:trunc(ih*{0}/2)*2", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture));
switch (hwAccel)
{
case Helpers.HardwareAccelerationMode.CUDA:
scaleArgs = string.Format("scale_cuda=trunc(iw*{0}/2)*2:trunc(ih*{0}/2)*2:format=yuv420p", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture));
break;
default:
scaleArgs = string.Format("scale=trunc(iw*{0}/2)*2:trunc(ih*{0}/2)*2", scaleFactor.ToString("#.##", CultureInfo.InvariantCulture));
break;
}
}
else if (Math.Abs(scaleFactor - 1f) >= 0.005f)
{
Expand Down Expand Up @@ -96,7 +104,7 @@ private static string ComputeTransformArgs(ConversionPreset conversionPreset)
transformArgs += rotationArgs;
}

if (conversionPreset.OutputType == OutputType.Mkv || conversionPreset.OutputType == OutputType.Mp4)
if (hwAccel == Helpers.HardwareAccelerationMode.Off && (conversionPreset.OutputType == OutputType.Mkv || conversionPreset.OutputType == OutputType.Mp4))
{
// http://trac.ffmpeg.org/wiki/Encode/H.264#Encodingfordumbplayers
// YUV planar color space with 4:2:0 chroma subsampling
Expand Down
32 changes: 23 additions & 9 deletions Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ namespace FileConverter.ConversionJobs
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Text.RegularExpressions;

using FileConverter.Controls;

using System.Text.RegularExpressions;
using CommunityToolkit.Mvvm.DependencyInjection;
using FileConverter.Controls;
using FileConverter.Services;

public partial class ConversionJob_FFMPEG : ConversionJob
{
private readonly Regex durationRegex = new Regex(@"Duration:\s*([0-9][0-9]):([0-9][0-9]):([0-9][0-9])\.([0-9][0-9]),.*bitrate:\s*([0-9]+) kb\/s");
Expand All @@ -23,6 +24,8 @@ public partial class ConversionJob_FFMPEG : ConversionJob

private readonly List<FFMpegPass> ffmpegArgumentStringByPass = new List<FFMpegPass>();

ISettingsService settingsService = Ioc.Default.GetRequiredService<ISettingsService>();

public ConversionJob_FFMPEG() : base()
{
}
Expand Down Expand Up @@ -255,7 +258,9 @@ protected virtual void FillFFMpegArgumentsList()
VideoEncodingSpeed videoEncodingSpeed = this.ConversionPreset.GetSettingsValue<VideoEncodingSpeed>(ConversionPreset.ConversionSettingKeys.VideoEncodingSpeed);
int audioEncodingBitrate = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);

string transformArgs = ConversionJob_FFMPEG.ComputeTransformArgs(this.ConversionPreset);
Helpers.HardwareAccelerationMode hwAccel = settingsService.Settings.HardwareAccelerationMode;

string transformArgs = ConversionJob_FFMPEG.ComputeTransformArgs(this.ConversionPreset, hwAccel);
string videoFilteringArgs = ConversionJob_FFMPEG.Encapsulate("-vf", transformArgs);

string audioArgs = "-an";
Expand All @@ -264,14 +269,23 @@ protected virtual void FillFFMpegArgumentsList()
audioArgs = $"-c:a aac -qscale:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)}";
}

string videoCodec = "libx264";
string hwAccelArg = "";
if (hwAccel == Helpers.HardwareAccelerationMode.CUDA)
{
videoCodec = "h264_nvenc";
hwAccelArg = "-hwaccel cuda -hwaccel_output_format cuda";
}

string encoderArgs = string.Format(
"-c:v libx264 -preset {0} -crf {1} {2} {3}",
this.H264EncodingSpeedToPreset(videoEncodingSpeed),
"-c:v {0} -preset {1} -crf {2} {3} {4}",
videoCodec,
this.H264EncodingSpeedToPreset(videoEncodingSpeed),
this.H264QualityToCRF(videoEncodingQuality),
audioArgs,
audioArgs,
videoFilteringArgs);

string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);
string arguments = string.Format("-n -stats {3} -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs, hwAccelArg);

this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ protected override void Convert()
readSettings.Format = MagickFormat.Dng;
break;

case ".gif":
// Get the first frame of the gif for conversion.
// Maybe in the future make this user selectable.
readSettings.FrameIndex = 0;
break;

default:
break;
}
Expand Down Expand Up @@ -175,8 +181,8 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false)
bool clampSizeToPowerOf2 = this.ConversionPreset.GetSettingsValue<bool>(ConversionPreset.ConversionSettingKeys.ImageClampSizePowerOf2);
if (clampSizeToPowerOf2)
{
int referenceSize = System.Math.Min(image.Width, image.Height);
int size = 2;
uint referenceSize = System.Math.Min(image.Width, image.Height);
uint size = 2;
while (size * 2 <= referenceSize)
{
size *= 2;
Expand All @@ -190,11 +196,11 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false)

if (this.ConversionPreset.IsRelevantSetting(ConversionPreset.ConversionSettingKeys.ImageMaximumSize))
{
int maximumSize = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.ImageMaximumSize);
uint maximumSize = this.ConversionPreset.GetSettingsValue<uint>(ConversionPreset.ConversionSettingKeys.ImageMaximumSize);
if (maximumSize > 0)
{
int width = System.Math.Min(image.Width, maximumSize);
int height = System.Math.Min(image.Height, maximumSize);
uint width = System.Math.Min(image.Width, maximumSize);
uint height = System.Math.Min(image.Height, maximumSize);

Debug.Log($"Clamp size to maximum size of {width}x{width} (from {image.Width}x{image.Height} to {width}x{height}).");

Expand All @@ -211,7 +217,7 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false)
break;

case OutputType.Jpg:
image.Quality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.ImageQuality);
image.Quality = this.ConversionPreset.GetSettingsValue<uint>(ConversionPreset.ConversionSettingKeys.ImageQuality);
break;

case OutputType.Pdf:
Expand All @@ -220,7 +226,7 @@ private void ConvertImage(MagickImage image, bool ignoreScale = false)
break;

case OutputType.Webp:
image.Quality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.ImageQuality);
image.Quality = this.ConversionPreset.GetSettingsValue<uint>(ConversionPreset.ConversionSettingKeys.ImageQuality);
break;

default:
Expand Down
Loading