Skip to content

Commit

Permalink
Added string transformations for VideoCodec and VideoFormat enumerati…
Browse files Browse the repository at this point in the history
…ons. Probably fixes cmxl#66
  • Loading branch information
TobiasFaller committed Jan 5, 2024
1 parent 16fe394 commit b87ce36
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/FFmpeg.NET/FFmpegArgumentBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ private static StringBuilder AppendVideoCodec(StringBuilder commandBuilder, Conv
if (conversionOptions.VideoCodec != VideoCodec.Default)
{
var codec = conversionOptions.VideoCodec.ToString().ToLowerInvariant();
if (codec.StartsWith("_"))
codec = codec.Replace("_", "");
if (codec.Contains("_"))
codec = codec.Replace("_", "-");

commandBuilder.AppendFormat(" -vcodec {0} ", codec);
}
return commandBuilder;
Expand All @@ -265,6 +270,8 @@ private static StringBuilder AppendVideoFormat(StringBuilder commandBuilder, Con
var format = conversionOptions.VideoFormat.ToString().ToLowerInvariant();
if (format.StartsWith("_"))
format = format.Replace("_", "");
if (format.Contains("_"))
format = format.Replace("_", "-");

commandBuilder.AppendFormat(" -f {0} ", format);
}
Expand Down

0 comments on commit b87ce36

Please sign in to comment.