Skip to content

Commit

Permalink
File Converter release v1.2.2 (#17)
Browse files Browse the repository at this point in the history
* Fixed an issue where scale was corrupted when switching application language (github issue #5)

* Update ffmpeg to version 3.2.2

* Fixed issue where file metadata were not copied when converting to aac format (github issue #15).

* Fixed: Issue where specific culture where ignored

* Add Portuguese translation

* Change copyright date to 2017

* Change in-app web links to https

* Download FileConverter upgrade with https

* Update changelog and readme

* Change version number to 1.2.2
  • Loading branch information
Tichau authored Feb 16, 2017
1 parent e5e1c78 commit d610f08
Show file tree
Hide file tree
Showing 20 changed files with 632 additions and 47 deletions.
4 changes: 2 additions & 2 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) 2016 Adrien Allard
Copyright (C) 2017 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 @@ -32,7 +32,7 @@ public partial class Application : System.Windows.Application
{
Major = 1,
Minor = 2,
Patch = 1,
Patch = 2,
};

private readonly List<ConversionJob> conversionJobs = new List<ConversionJob>();
Expand Down
26 changes: 14 additions & 12 deletions Application/FileConverter/ConversionJobs/ConversionJob_FFMPEG.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ protected override void Initialize()
protected virtual void FillFFMpegArgumentsList()
{
// This option are necessary to be able to read metadata on Windows. src: http://jonhall.info/how_to/create_id3_tags_using_ffmpeg
const string metadataArgs = "-id3v2_version 3 -write_id3v1 1";
const string mp3MetadataArgs = "-id3v2_version 3 -write_id3v1 1";
// AAC have no standard tag system, use ApeV2 (that are compatible). src: http://eolindel.free.fr/foobar/tags.shtml
const string aacMetadataArgs = "-write_apetag 1";

switch (this.ConversionPreset.OutputType)
{
Expand All @@ -84,7 +86,7 @@ protected virtual void FillFFMpegArgumentsList()

// https://trac.ffmpeg.org/wiki/Encode/AAC
int audioEncodingBitrate = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
string encoderArgs = $"-c:a aac -q:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)} {channelArgs} {metadataArgs}";
string encoderArgs = $"-c:a aac -q:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)} {channelArgs} {aacMetadataArgs}";

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

Expand All @@ -109,7 +111,7 @@ protected virtual void FillFFMpegArgumentsList()

// Compute final arguments.
string videoFilteringArgs = ConversionJob_FFMPEG.Encapsulate("-vf", transformArgs);
string encoderArgs = $"-c:v mpeg4 -vtag xvid -qscale:v {this.MPEG4QualityToQualityIndex(videoEncodingQuality)} {audioArgs} {videoFilteringArgs} {metadataArgs}";
string encoderArgs = $"-c:v mpeg4 -vtag xvid -qscale:v {this.MPEG4QualityToQualityIndex(videoEncodingQuality)} {audioArgs} {videoFilteringArgs} {mp3MetadataArgs}";
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);

this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
Expand All @@ -122,7 +124,7 @@ protected virtual void FillFFMpegArgumentsList()
string channelArgs = ConversionJob_FFMPEG.ComputeAudioChannelArgs(this.ConversionPreset);

// http://taer-naguur.blogspot.fr/2013/11/flac-audio-encoding-with-ffmpeg.html
string encoderArgs = $"-compression_level 12 {channelArgs} {metadataArgs}";
string encoderArgs = $"-compression_level 12 {channelArgs}";
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);

this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
Expand Down Expand Up @@ -201,11 +203,11 @@ protected virtual void FillFFMpegArgumentsList()
switch (encodingMode)
{
case EncodingMode.Mp3VBR:
encoderArgs = $"-codec:a libmp3lame -q:a {this.MP3VBRBitrateToQualityIndex(encodingQuality)} {channelArgs} {metadataArgs}";
encoderArgs = $"-codec:a libmp3lame -q:a {this.MP3VBRBitrateToQualityIndex(encodingQuality)} {channelArgs} {mp3MetadataArgs}";
break;

case EncodingMode.Mp3CBR:
encoderArgs = $"-codec:a libmp3lame -b:a {encodingQuality}k {channelArgs} {metadataArgs}";
encoderArgs = $"-codec:a libmp3lame -b:a {encodingQuality}k {channelArgs} {mp3MetadataArgs}";
break;

default:
Expand Down Expand Up @@ -234,7 +236,7 @@ protected virtual void FillFFMpegArgumentsList()
string audioArgs = "-an";
if (this.ConversionPreset.GetSettingsValue<bool>(ConversionPreset.ConversionSettingKeys.EnableAudio))
{
audioArgs = $"-c:a aac -qscale:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)} {metadataArgs}";
audioArgs = $"-c:a aac -qscale:a {this.AACBitrateToQualityIndex(audioEncodingBitrate)}";
}

string encoderArgs = string.Format(
Expand All @@ -256,7 +258,7 @@ protected virtual void FillFFMpegArgumentsList()
string channelArgs = ConversionJob_FFMPEG.ComputeAudioChannelArgs(this.ConversionPreset);

int encodingQuality = this.ConversionPreset.GetSettingsValue<int>(ConversionPreset.ConversionSettingKeys.AudioBitrate);
string encoderArgs = $"-vn -codec:a libvorbis -qscale:a {this.OGGVBRBitrateToQualityIndex(encodingQuality)} {channelArgs} {metadataArgs}";
string encoderArgs = $"-vn -codec:a libvorbis -qscale:a {this.OGGVBRBitrateToQualityIndex(encodingQuality)} {channelArgs}";
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);

this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
Expand All @@ -279,7 +281,7 @@ protected virtual void FillFFMpegArgumentsList()
audioArgs = $"-codec:a libvorbis -qscale:a {this.OGGVBRBitrateToQualityIndex(audioEncodingBitrate)}";
}

string encoderArgs = $"-codec:v libtheora -qscale:v {this.OGVTheoraQualityToQualityIndex(videoEncodingQuality)} {audioArgs} {videoFilteringArgs} {metadataArgs}";
string encoderArgs = $"-codec:v libtheora -qscale:v {this.OGVTheoraQualityToQualityIndex(videoEncodingQuality)} {audioArgs} {videoFilteringArgs}";

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

Expand Down Expand Up @@ -312,7 +314,7 @@ protected virtual void FillFFMpegArgumentsList()
string channelArgs = ConversionJob_FFMPEG.ComputeAudioChannelArgs(this.ConversionPreset);

EncodingMode encodingMode = this.ConversionPreset.GetSettingsValue<EncodingMode>(ConversionPreset.ConversionSettingKeys.AudioEncodingMode);
string encoderArgs = $"-acodec {this.WAVEncodingToCodecArgument(encodingMode)} {channelArgs} {metadataArgs}";
string encoderArgs = $"-acodec {this.WAVEncodingToCodecArgument(encodingMode)} {channelArgs}";
string arguments = string.Format("-n -stats -i \"{0}\" {2} \"{1}\"", this.InputFilePath, this.OutputFilePath, encoderArgs);

this.ffmpegArgumentStringByPass.Add(new FFMpegPass(arguments));
Expand All @@ -330,11 +332,11 @@ protected virtual void FillFFMpegArgumentsList()
if (videoEncodingQuality == 63)
{
// Replace maximum quality settings by lossless compression.
encodingArgs = $"-lossless 1 {metadataArgs}";
encodingArgs = $"-lossless 1";
}
else
{
encodingArgs = $"-crf {this.WebmQualityToCRF(videoEncodingQuality)} -b:v 0 {metadataArgs}";
encodingArgs = $"-crf {this.WebmQualityToCRF(videoEncodingQuality)} -b:v 0";
}

string transformArgs = ConversionJob_FFMPEG.ComputeTransformArgs(this.ConversionPreset);
Expand Down
1 change: 1 addition & 0 deletions Application/FileConverter/FileConverter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.en.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.pt.resx" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
Expand Down
8 changes: 7 additions & 1 deletion Application/FileConverter/Helpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ public static IEnumerable<CultureInfo> GetSupportedCultures()
string exeLocation = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));

// Return all culture for which satellite folder found with culture code.
return cultures.Where(cultureInfo => Directory.Exists(Path.Combine(exeLocation, "Languages", cultureInfo.Name)));
foreach (CultureInfo cultureInfo in cultures)
{
if (!string.IsNullOrEmpty(cultureInfo.Name) && Directory.Exists(Path.Combine(exeLocation, "Languages", cultureInfo.Name)))
{
yield return cultureInfo;
}
}
}

public static string GetExtensionCategory(string extension)
Expand Down
2 changes: 1 addition & 1 deletion Application/FileConverter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FileConverter")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
Loading

0 comments on commit d610f08

Please sign in to comment.