private void DoSubClip() { var subclipConfig = this.GetSubclippingConfiguration(); if (subclipConfig.Reencode) // reencode the clip { List<IMediaProcessor> Procs = Mainform.GetMediaProcessorsByName(Constants.AzureMediaEncoderStandard); EncodingAMEStandard form2 = new EncodingAMEStandard(_context, subclipConfig) { EncodingLabel = (_selectedAssets.Count > 1) ? _selectedAssets.Count + " assets have been selected. " + _selectedAssets.Count + " jobs will be submitted." : "Asset '" + _selectedAssets.FirstOrDefault().Name + "' will be encoded.", EncodingProcessorsList = Procs, EncodingJobName = "Subclipping with reencoding of " + Constants.NameconvInputasset, EncodingOutputAssetName = Constants.NameconvInputasset + "- Subclipped with reencoding", EncodingAMEStdPresetJSONFilesUserFolder = Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder, EncodingAMEStdPresetJSONFilesFolder = Application.StartupPath + Constants.PathAMEStdFiles, SelectedAssets = _selectedAssets }; if (form2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string taskname = "Subclipping with reencoding of " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername; _mainform.LaunchJobs( form2.EncodingProcessorSelected, _selectedAssets, form2.EncodingJobName, form2.JobOptions.Priority, taskname, form2.EncodingOutputAssetName, new List<string>() { form2.EncodingConfiguration }, form2.JobOptions.OutputAssetsCreationOptions, form2.JobOptions.TasksOptionsSetting, form2.JobOptions.StorageSelected); } } else if (subclipConfig.CreateAssetFilter) // create a asset filter { IAsset selasset = _selectedAssets.FirstOrDefault(); DynManifestFilter formAF = new DynManifestFilter(_contextdynmanifest, _context, null, selasset, subclipConfig); if (formAF.ShowDialog() == DialogResult.OK) { AssetFilter myassetfilter = new AssetFilter(selasset); Filter filter = formAF.GetFilter; myassetfilter.Name = filter.Name; myassetfilter.PresentationTimeRange = filter.PresentationTimeRange; myassetfilter.Tracks = filter.Tracks; myassetfilter._context = filter._context; try { myassetfilter.Create(); _mainform.TextBoxLogWriteLine("Asset filter '{0}' created.", myassetfilter.Name); } catch (Exception ex) { _mainform.TextBoxLogWriteLine("Error when creating filter '{0}'.", myassetfilter.Name, true); _mainform.TextBoxLogWriteLine(ex); } _mainform.DoRefreshGridFiltersV(false); } } else // no reencode or asset filter but stream copy { string taskname = "Subclipping of " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername; IMediaProcessor Proc = Mainform.GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard); _mainform.LaunchJobs( Proc, _selectedAssets, this.EncodingJobName, this.JobOptions.Priority, taskname, this.EncodingOutputAssetName, new List<string>() { this.GetSubclippingConfiguration().Configuration }, this.JobOptions.OutputAssetsCreationOptions, this.JobOptions.TasksOptionsSetting, this.JobOptions.StorageSelected); MessageBox.Show("Subclipping job(s) submitted", "Sublipping", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void DoSubClip() { var subclipConfig = this.GetSubclippingConfiguration(); if (subclipConfig.Reencode) // reencode the clip { List <IMediaProcessor> Procs = Mainform.GetMediaProcessorsByName(Constants.AzureMediaEncoderStandard); EncodingAMEStandard form2 = new EncodingAMEStandard(_context, _selectedAssets.Count, subclipConfig) { EncodingLabel = (_selectedAssets.Count > 1) ? string.Format("{0} asset{1} selected. You are going to submit {0} job{1} with 1 task.", _selectedAssets.Count, Program.ReturnS(_selectedAssets.Count), _selectedAssets.Count) : "Asset '" + _selectedAssets.FirstOrDefault().Name + "' will be encoded (1 job with 1 task).", EncodingProcessorsList = Procs, EncodingJobName = "Subclipping with reencoding of " + Constants.NameconvInputasset, EncodingOutputAssetName = Constants.NameconvInputasset + "- Subclipped with reencoding", EncodingAMEStdPresetJSONFilesUserFolder = Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder, EncodingAMEStdPresetJSONFilesFolder = Application.StartupPath + Constants.PathAMEStdFiles, SelectedAssets = _selectedAssets }; if (form2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string taskname = "Subclipping with reencoding of " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername; _mainform.LaunchJobs( form2.EncodingProcessorSelected, _selectedAssets, form2.EncodingJobName, form2.JobOptions.Priority, taskname, form2.EncodingOutputAssetName, new List <string>() { form2.EncodingConfiguration }, form2.JobOptions.OutputAssetsCreationOptions, form2.JobOptions.TasksOptionsSetting, form2.JobOptions.StorageSelected); } } else if (subclipConfig.CreateAssetFilter) // create a asset filter { IAsset selasset = _selectedAssets.FirstOrDefault(); DynManifestFilter formAF = new DynManifestFilter(_context, null, selasset, subclipConfig); if (formAF.ShowDialog() == DialogResult.OK) { FilterCreationInfo filterinfo = null; try { filterinfo = formAF.GetFilterInfo; selasset.AssetFilters.Create(filterinfo.Name, filterinfo.Presentationtimerange, filterinfo.Trackconditions); _mainform.TextBoxLogWriteLine("Asset filter '{0}' created.", filterinfo.Name); } catch (Exception ex) { _mainform.TextBoxLogWriteLine("Error when creating filter '{0}'.", (filterinfo != null && filterinfo.Name != null) ? filterinfo.Name : "unknown name", true); _mainform.TextBoxLogWriteLine(ex); } _mainform.DoRefreshGridFiltersV(false); } } else // no reencode or asset filter but stream copy { string taskname = "Subclipping (archive extraction) of " + Constants.NameconvInputasset; IMediaProcessor Proc = Mainform.GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard); _mainform.LaunchJobs( Proc, _selectedAssets, this.EncodingJobName, this.JobOptions.Priority, taskname, this.EncodingOutputAssetName, new List <string>() { this.GetSubclippingConfiguration().Configuration }, this.JobOptions.OutputAssetsCreationOptions, this.JobOptions.TasksOptionsSetting, this.JobOptions.StorageSelected); MessageBox.Show("Subclipping job(s) submitted", "Sublipping", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void DoGenerateThumbnails() { List<IAsset> SelectedAssets = ReturnSelectedAssets(); if (SelectedAssets.Count == 0) { MessageBox.Show("No asset was selected"); return; } if (SelectedAssets.FirstOrDefault() == null) return; string taskname = "Media Encoder Standard Thumbnails generation from " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername; var processor = GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard); EncodingAMEStandard form = new EncodingAMEStandard(_context, SelectedAssets.Count, processor.Version, ThumbnailsModeOnly: true) { EncodingLabel = (SelectedAssets.Count > 1) ? string.Format("{0} asset{1} selected. You are going to submit {0} job{1} with 1 task.", SelectedAssets.Count, Program.ReturnS(SelectedAssets.Count), SelectedAssets.Count) : "Asset '" + SelectedAssets.FirstOrDefault().Name + "' will be encoded (1 job with 1 task).", EncodingJobName = "Thumbnails generation (MES) of " + Constants.NameconvInputasset, EncodingOutputAssetName = Constants.NameconvInputasset + " - Media Standard encoded", EncodingAMEStdPresetJSONFilesUserFolder = Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder, EncodingAMEStdPresetJSONFilesFolder = Application.StartupPath + Constants.PathAMEStdFiles, SelectedAssets = SelectedAssets }; if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (IAsset asset in form.SelectedAssets) { string jobnameloc = form.EncodingJobName.Replace(Constants.NameconvInputasset, asset.Name); IJob job = _context.Jobs.Create(jobnameloc, form.JobOptions.Priority); string tasknameloc = taskname.Replace(Constants.NameconvInputasset, asset.Name).Replace(Constants.NameconvEncodername, processor.Name + " v" + processor.Version); ITask AMEStandardTask = job.Tasks.AddNew( tasknameloc, processor, form.EncodingConfiguration, form.JobOptions.TasksOptionsSetting ); AMEStandardTask.InputAssets.Add(asset); // Add an output asset to contain the results of the job. string outputassetnameloc = form.EncodingOutputAssetName.Replace(Constants.NameconvInputasset, asset.Name); AMEStandardTask.OutputAssets.AddNew(outputassetnameloc, form.JobOptions.OutputAssetsCreationOptions); // Submit the job TextBoxLogWriteLine("Submitting job '{0}'", jobnameloc); try { job.Submit(); } catch (Exception e) { // Add useful information to the exception if (SelectedAssets.Count < 5) { MessageBox.Show(string.Format("There has been a problem when submitting the job '{0}'", jobnameloc) + Constants.endline + Constants.endline + Program.GetErrorMessage(e), "Job Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } TextBoxLogWriteLine("There has been a problem when submitting the job '{0}' ", jobnameloc, true); TextBoxLogWriteLine(e); return; } Task.Factory.StartNew(() => dataGridViewJobsV.DoJobProgress(job)); } DotabControlMainSwitch(Constants.TabJobs); DoRefreshGridJobV(false); } }
private void DoMenuEncodeWithAMEStandard() { List<IAsset> SelectedAssets = ReturnSelectedAssets(); if (SelectedAssets.Count == 0) { MessageBox.Show("No asset was selected"); return; } if (SelectedAssets.FirstOrDefault() == null) return; bool LiveArchiveAsset = false; if (SelectedAssets.Any(a => AssetInfo.GetAssetType(a).StartsWith(AssetInfo.Type_LiveArchive))) { MessageBox.Show("One of the source asset is a Live stream or archive." + Constants.endline + "You should use the subclipping UI if you plan to trim the source to make sure that that timestamps are correctly managed." + Constants.endline + "Overlay is also disabled.", "Live archive asset", MessageBoxButtons.OK, MessageBoxIcon.Warning); LiveArchiveAsset = true; } string taskname = "Media Encoder Standard processing of " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername; var processor = GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard); EncodingAMEStandard form = new EncodingAMEStandard(_context, SelectedAssets.Count, processor.Version, disableOverlay: SelectedAssets.Count > 1 ? true : LiveArchiveAsset, // as only single asset overlay is supported for now disableSourceTrimming: LiveArchiveAsset) { EncodingLabel = (SelectedAssets.Count > 1) ? string.Format("{0} asset{1} selected. You are going to submit {0} job{1} with 1 task.", SelectedAssets.Count, Program.ReturnS(SelectedAssets.Count), SelectedAssets.Count) : "Asset '" + SelectedAssets.FirstOrDefault().Name + "' will be encoded (1 job with 1 task).", EncodingJobName = "Media Encoder Standard processing of " + Constants.NameconvInputasset, EncodingOutputAssetName = Constants.NameconvInputasset + " - Media Standard encoded", EncodingAMEStdPresetJSONFilesUserFolder = Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder, EncodingAMEStdPresetJSONFilesFolder = Application.StartupPath + Constants.PathAMEStdFiles, SelectedAssets = SelectedAssets }; if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { foreach (IAsset asset in form.SelectedAssets) { bool Error = false; string jobnameloc = form.EncodingJobName.Replace(Constants.NameconvInputasset, asset.Name); IJob job = _context.Jobs.Create(jobnameloc, form.JobOptions.Priority); string tasknameloc = taskname.Replace(Constants.NameconvInputasset, asset.Name).Replace(Constants.NameconvEncodername, processor.Name + " v" + processor.Version); ITask AMEStandardTask = job.Tasks.AddNew( tasknameloc, processor, form.EncodingConfiguration, form.JobOptions.TasksOptionsSetting ); AMEStandardTask.InputAssets.Add(asset); // Add an output asset to contain the results of the job. string outputassetnameloc = form.EncodingOutputAssetName.Replace(Constants.NameconvInputasset, asset.Name); AMEStandardTask.OutputAssets.AddNew(outputassetnameloc, form.JobOptions.StorageSelected, form.JobOptions.OutputAssetsCreationOptions); // Submit the job TextBoxLogWriteLine("Submitting job '{0}'", jobnameloc); try { job.Submit(); } catch (Exception e) { // Add useful information to the exception if (SelectedAssets.Count < 5) { MessageBox.Show(string.Format("There has been a problem when submitting the job '{0}'", jobnameloc) + Constants.endline + Constants.endline + Program.GetErrorMessage(e), "Job Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } TextBoxLogWriteLine("There has been a problem when submitting the job '{0}' ", jobnameloc, true); TextBoxLogWriteLine(e); Error = true; } if (!Error) Task.Factory.StartNew(() => dataGridViewJobsV.DoJobProgress(job)); } DotabControlMainSwitch(Constants.TabJobs); DoRefreshGridJobV(false); } }
private void DoSubClip() { var subclipConfig = this.GetSubclippingConfiguration(); if (subclipConfig.Reencode) // reencode the clip { List <IMediaProcessor> Procs = Mainform.GetMediaProcessorsByName(Constants.AzureMediaEncoderStandard); EncodingAMEStandard form2 = new EncodingAMEStandard(_context, subclipConfig) { EncodingLabel = (_selectedAssets.Count > 1) ? _selectedAssets.Count + " assets have been selected. " + _selectedAssets.Count + " jobs will be submitted." : "Asset '" + _selectedAssets.FirstOrDefault().Name + "' will be encoded.", EncodingProcessorsList = Procs, EncodingJobName = "Subclipping with reencoding of " + Constants.NameconvInputasset, EncodingOutputAssetName = Constants.NameconvInputasset + "- Subclipped with reencoding", EncodingAMEStdPresetJSONFilesUserFolder = Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder, EncodingAMEStdPresetJSONFilesFolder = Application.StartupPath + Constants.PathAMEStdFiles, SelectedAssets = _selectedAssets }; if (form2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string taskname = "Subclipping with reencoding of " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername; _mainform.LaunchJobs( form2.EncodingProcessorSelected, _selectedAssets, form2.EncodingJobName, form2.JobOptions.Priority, taskname, form2.EncodingOutputAssetName, new List <string>() { form2.EncodingConfiguration }, form2.JobOptions.OutputAssetsCreationOptions, form2.JobOptions.TasksOptionsSetting, form2.JobOptions.StorageSelected); } } else if (subclipConfig.CreateAssetFilter) // create a asset filter { IAsset selasset = _selectedAssets.FirstOrDefault(); DynManifestFilter formAF = new DynManifestFilter(_contextdynmanifest, _context, null, selasset, subclipConfig); if (formAF.ShowDialog() == DialogResult.OK) { AssetFilter myassetfilter = new AssetFilter(selasset); Filter filter = formAF.GetFilter; myassetfilter.Name = filter.Name; myassetfilter.PresentationTimeRange = filter.PresentationTimeRange; myassetfilter.Tracks = filter.Tracks; myassetfilter._context = filter._context; try { myassetfilter.Create(); _mainform.TextBoxLogWriteLine("Asset filter '{0}' created.", myassetfilter.Name); } catch (Exception ex) { _mainform.TextBoxLogWriteLine("Error when creating filter '{0}'.", myassetfilter.Name, true); _mainform.TextBoxLogWriteLine(ex); } _mainform.DoRefreshGridFiltersV(false); } } else // no reencode or asset filter but stream copy { string taskname = "Subclipping of " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername; IMediaProcessor Proc = Mainform.GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard); _mainform.LaunchJobs( Proc, _selectedAssets, this.EncodingJobName, this.JobOptions.Priority, taskname, this.EncodingOutputAssetName, new List <string>() { this.GetSubclippingConfiguration().Configuration }, this.JobOptions.OutputAssetsCreationOptions, this.JobOptions.TasksOptionsSetting, this.JobOptions.StorageSelected); MessageBox.Show("Subclipping job(s) submitted", "Sublipping", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void DoSubClip() { var subclipConfig = this.GetSubclippingConfiguration(); if (subclipConfig.Reencode) // reencode the clip { List<IMediaProcessor> Procs = Mainform.GetMediaProcessorsByName(Constants.AzureMediaEncoderStandard); EncodingAMEStandard form2 = new EncodingAMEStandard(_context, _selectedAssets.Count, subclipConfig) { EncodingLabel = (_selectedAssets.Count > 1) ? string.Format("{0} asset{1} selected. You are going to submit {0} job{1} with 1 task.", _selectedAssets.Count, Program.ReturnS(_selectedAssets.Count), _selectedAssets.Count) : "Asset '" + _selectedAssets.FirstOrDefault().Name + "' will be encoded (1 job with 1 task).", EncodingProcessorsList = Procs, EncodingJobName = "Subclipping with reencoding of " + Constants.NameconvInputasset, EncodingOutputAssetName = Constants.NameconvInputasset + "- Subclipped with reencoding", EncodingAMEStdPresetJSONFilesUserFolder = Properties.Settings.Default.AMEStandardPresetXMLFilesCurrentFolder, EncodingAMEStdPresetJSONFilesFolder = Application.StartupPath + Constants.PathAMEStdFiles, SelectedAssets = _selectedAssets }; if (form2.ShowDialog() == System.Windows.Forms.DialogResult.OK) { string taskname = "Subclipping with reencoding of " + Constants.NameconvInputasset + " with " + Constants.NameconvEncodername; _mainform.LaunchJobs( form2.EncodingProcessorSelected, _selectedAssets, form2.EncodingJobName, form2.JobOptions.Priority, taskname, form2.EncodingOutputAssetName, new List<string>() { form2.EncodingConfiguration }, form2.JobOptions.OutputAssetsCreationOptions, form2.JobOptions.TasksOptionsSetting, form2.JobOptions.StorageSelected); } } else if (subclipConfig.CreateAssetFilter) // create a asset filter { IAsset selasset = _selectedAssets.FirstOrDefault(); DynManifestFilter formAF = new DynManifestFilter(_context, null, selasset, subclipConfig); if (formAF.ShowDialog() == DialogResult.OK) { FilterCreationInfo filterinfo = null; try { filterinfo = formAF.GetFilterInfo; selasset.AssetFilters.Create(filterinfo.Name, filterinfo.Presentationtimerange, filterinfo.Trackconditions); _mainform.TextBoxLogWriteLine("Asset filter '{0}' created.", filterinfo.Name); } catch (Exception ex) { _mainform.TextBoxLogWriteLine("Error when creating filter '{0}'.", (filterinfo != null && filterinfo.Name != null) ? filterinfo.Name : "unknown name", true); _mainform.TextBoxLogWriteLine(ex); } _mainform.DoRefreshGridFiltersV(false); } } else // no reencode or asset filter but stream copy { string taskname = "Subclipping (archive extraction) of " + Constants.NameconvInputasset; IMediaProcessor Proc = Mainform.GetLatestMediaProcessorByName(Constants.AzureMediaEncoderStandard); _mainform.LaunchJobs( Proc, _selectedAssets, this.EncodingJobName, this.JobOptions.Priority, taskname, this.EncodingOutputAssetName, new List<string>() { this.GetSubclippingConfiguration().Configuration }, this.JobOptions.OutputAssetsCreationOptions, this.JobOptions.TasksOptionsSetting, this.JobOptions.StorageSelected); MessageBox.Show("Subclipping job(s) submitted", "Sublipping", MessageBoxButtons.OK, MessageBoxIcon.Information); } }