Skip to content

Commit

Permalink
Removed some hard-coded defaults.
Browse files Browse the repository at this point in the history
  • Loading branch information
kmcclive committed Mar 2, 2021
1 parent 5d8b69b commit b8d6a3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Tricycle.Media.FFmpeg/MediaTranscoder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ protected virtual Codec GetVideoCodec(FFmpegConfig config,
VideoOutputStream outputStream)
{
VideoFormat format = outputStream.Format;
VideoCodec codec = config?.Video?.Codecs.GetValueOrDefault(format) ?? new VideoCodec("medium");
VideoCodec codec = config?.Video?.Codecs.GetValueOrDefault(format);
string codecName = GetVideoCodecName(format);
X26xCodec result = format == VideoFormat.Hevc ? new X265Codec(codecName) : new X26xCodec(codecName);

result.Preset = codec.Preset;
result.Preset = codec?.Preset;
result.Crf = outputStream.Quality;

if (outputStream.DynamicRange == DynamicRange.High)
Expand Down
20 changes: 10 additions & 10 deletions Tricycle.UI/ViewModels/ConfigViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,8 @@ TricycleConfig GenerateTricycleConfig()
Video = GenerateTricycleVideoConfig(),
DefaultFileExtensions = new Dictionary<ContainerFormat, string>()
{
{ ContainerFormat.Mp4, string.IsNullOrWhiteSpace(Mp4FileExtension) ? "mp4" : Mp4FileExtension },
{ ContainerFormat.Mkv, string.IsNullOrWhiteSpace(MkvFileExtension) ? "mkv" : MkvFileExtension }
{ ContainerFormat.Mp4, Mp4FileExtension },
{ ContainerFormat.Mkv, MkvFileExtension }
},
DestinationDirectoryMode = (AutomationMode)SelectedDestinationDirectoryMode.Value,
DestinationDirectory = DestinationDirectory,
Expand Down Expand Up @@ -718,14 +718,14 @@ FFmpegAudioConfig GenerateFFmpegAudioConfig()
AudioFormat.Aac,
new FFmpegAudioCodec()
{
Name = string.IsNullOrWhiteSpace(AacCodec) ? "aac" : AacCodec
Name = AacCodec
}
},
{
AudioFormat.Ac3,
new FFmpegAudioCodec()
{
Name = string.IsNullOrWhiteSpace(Ac3Codec) ? "ac3" : Ac3Codec
Name = Ac3Codec
}
}
}
Expand All @@ -742,21 +742,21 @@ FFmpegVideoConfig GenerateFFmpegVideoConfig()
VideoFormat.Avc,
new FFmpegVideoCodec()
{
Preset = SelectedX264Preset?.ToString() ?? "medium"
Preset = SelectedX264Preset?.ToString()
}
},
{
VideoFormat.Hevc,
new FFmpegVideoCodec()
{
Preset = SelectedX265Preset?.ToString() ?? "medium",
Preset = SelectedX265Preset?.ToString()
}
}
},
CropDetectOptions = string.IsNullOrWhiteSpace(CropDetectOptions) ? null : CropDetectOptions,
DeinterlaceOptions = string.IsNullOrWhiteSpace(DeinterlaceOptions) ? "bwdif" : DeinterlaceOptions,
DenoiseOptions = string.IsNullOrWhiteSpace(DenoiseOptions) ? "hqdn3d=4:4:3:3" : DenoiseOptions,
TonemapOptions = string.IsNullOrWhiteSpace(TonemapOptions) ? "hable:desat=0" : TonemapOptions
CropDetectOptions = CropDetectOptions,
DeinterlaceOptions = DeinterlaceOptions,
DenoiseOptions = DenoiseOptions,
TonemapOptions = TonemapOptions
};
}

Expand Down

0 comments on commit b8d6a3a

Please sign in to comment.