if (parsed.FastDecode)\r
{\r
tune = tune == "none" ? "fastdecode" : tune + ",fastdecode";\r
- }\r
- AddEncodeElement(xmlWriter, "x264Tune", "string", tune);\r
- AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0");\r
- AddEncodeElement(xmlWriter, "QsvPreset", "string", parsed.QsvPreset.ToString());\r
-\r
- int videoQualityType = 0;\r
- if (parsed.VideoBitrate != null) videoQualityType = 1;\r
+ }
+ AddEncodeElement(xmlWriter, "x264Tune", "string", tune);
+ AddEncodeElement(xmlWriter, "x264UseAdvancedOptions", "integer", parsed.ShowAdvancedTab ? "1" : "0");
+ AddEncodeElement(xmlWriter, "qsvPreset", "string", parsed.QsvPreset.ToString().ToLower());
+
+ int videoQualityType = 0;
+ if (parsed.VideoBitrate != null) videoQualityType = 1;
else if (parsed.Quality != null) videoQualityType = 2;\r
\r
AddEncodeElement(xmlWriter, "VideoQualityType", "integer", videoQualityType.ToString());\r
{\r
query += string.Format(" -x {0}", task.ExtraAdvancedArguments);\r
}\r
- }\r
- }\r
-\r
- // Options that apply to both x264 and QuickSync\r
- if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)\r
- {\r
+ }
+ }
+
+ // QSV Only
+ if (task.VideoEncoder == VideoEncoder.QuickSync)
+ {
+ query += string.Format(" --qsv-preset={0}", task.QsvPreset.ToString().ToLower());
+ }
+
+ // options that apply to all encoders
+ if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions))
+ {
+ query += string.Format(" -x {0}", task.AdvancedEncoderOptions);
+ }
+
+ // Options that apply to both x264 and QuickSync
+ if (task.VideoEncoder == VideoEncoder.QuickSync || task.VideoEncoder == VideoEncoder.X264)
+ {
// when using x264 with the advanced panel, the H.264 profile/level widgets are disabled\r
if (!(task.VideoEncoder == VideoEncoder.X264 && task.ShowAdvancedTab))\r
{\r
if (task.H264Profile != x264Profile.None)\r
{\r
query += string.Format(\r
- " --h264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));\r
- }\r
- }\r
-\r
- if (task.VideoEncoder == VideoEncoder.QuickSync)\r
- {\r
- string qsvPreset;\r
-\r
- if (SystemInfo.IsHswOrNewer)\r
- {\r
- switch (task.QsvPreset)\r
- {\r
- case QsvPreset.Speed:\r
- qsvPreset = "6";\r
- break;\r
- case QsvPreset.Balanced:\r
- qsvPreset = "4";\r
- break;\r
- default:\r
- qsvPreset = "2";\r
- break;\r
- }\r
- }\r
- else\r
- {\r
- switch (task.QsvPreset)\r
- {\r
- case QsvPreset.Speed:\r
- qsvPreset = "4";\r
- break;\r
- case QsvPreset.Balanced:\r
- qsvPreset = "2";\r
- break;\r
- default:\r
- qsvPreset = "2";\r
- break;\r
- }\r
- }\r
-\r
- query += string.IsNullOrEmpty(task.AdvancedEncoderOptions)\r
- ? string.Format(" -x target-usage={0}", qsvPreset)\r
- : string.Format(" -x target-usage={0}:{1}", qsvPreset, task.AdvancedEncoderOptions);\r
- }\r
- else if (!string.IsNullOrEmpty(task.AdvancedEncoderOptions)) // Not a H.264 encode\r
- {\r
- query += string.Format(" -x {0}", task.AdvancedEncoderOptions);\r
- }\r
-\r
- return query;\r
- }\r
-\r
- return string.IsNullOrEmpty(task.AdvancedEncoderOptions) ? string.Empty : string.Format(" -x {0}", task.AdvancedEncoderOptions);\r
- }\r
-\r
- /// <summary>\r
+ " --h264-profile={0} ", task.H264Profile.ToString().ToLower().Replace(" ", string.Empty));
+ }
+ }
+ }
+
+ return query;
+ }
+
+ /// <summary>
/// Generate the Command Line Arguments for any additional advanced options.\r
/// </summary>\r
/// <param name="verbosity">\r
/// <summary>\r
/// Initializes a new instance of the <see cref="EncoderOptionsViewModel"/> class.\r
/// </summary>\r
- public EncoderOptionsViewModel()\r
- {\r
- this.Task = new EncodeTask();\r
- cachedOptions.Add(VideoEncoder.QuickSync, "async-depth=4");\r
- }\r
-\r
- /// <summary>\r
+ public EncoderOptionsViewModel()
+ {
+ this.Task = new EncodeTask();
+ }
+
+ /// <summary>
/// Gets or sets the task.\r
/// </summary>\r
public EncodeTask Task { get; set; }\r
\r
private void qsv_preset_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)\r
{\r
- VideoViewModel mvm = ((VideoViewModel)this.DataContext);\r
- EncodeTask task = mvm.Task;\r
-\r
- string addon = "";\r
-\r
- if (SystemInfo.IsHswOrNewer)\r
- {\r
- if (task.VideoEncodeRateType == VideoEncodeRateType.ConstantQuality)\r
- {\r
- if (task.QsvPreset == QsvPreset.Balanced ||\r
- task.QsvPreset == QsvPreset.Speed)\r
- addon = "num-ref-frame=1";\r
- }\r
- if (task.VideoEncodeRateType == VideoEncodeRateType.AverageBitrate)\r
- {\r
- if (task.QsvPreset == QsvPreset.Quality)\r
- addon = "lookahead=1:gop-ref-dist=3";\r
- else\r
- if (task.QsvPreset == QsvPreset.Balanced)\r
- {\r
- addon = "num-ref-frame=1:gop-ref-dist=1";\r
- }\r
- else\r
- if (task.QsvPreset == QsvPreset.Speed)\r
- addon = "gop-ref-dist=1";\r
- }\r
- }\r
-\r
-\r
- string full_string = addon + ":";\r
-\r
- IDictionary<string, string> newOptions = new Dictionary<string, string>();\r
- string[] existingSegments = full_string.Split(':');\r
- foreach (string existingSegment in existingSegments)\r
+ VideoViewModel mvm = ((VideoViewModel)this.DataContext);
+ EncodeTask task = mvm.Task;
+
+ string full_string = "";
+
+ IDictionary<string, string> newOptions = new Dictionary<string, string>();
+ string[] existingSegments = full_string.Split(':');
+ foreach (string existingSegment in existingSegments)
{\r
string optionName = existingSegment;\r
string optionValue = string.Empty;\r