/// <summary> /// <para> ---- </para> /// <para>Establishes whether the data contains progress information.</para> /// </summary> /// <param name="data">Event data from the FFmpeg console.</param> /// <param name="progressEventArgs"> /// <para>If successful, outputs a <see cref="ConvertProgressEventArgs"/> which is </para> /// <para>generated from the data. </para> /// </param> internal static bool IsProgressData(string data, out ConvertProgressEventArgs progressEventArgs) { progressEventArgs = null; Match matchFrame = Index[Find.ConvertProgressFrame].Match(data); Match matchFps = Index[Find.ConvertProgressFps].Match(data); Match matchSize = Index[Find.ConvertProgressSize].Match(data); Match matchTime = Index[Find.ConvertProgressTime].Match(data); Match matchBitrate = Index[Find.ConvertProgressBitrate].Match(data); if (!matchFrame.Success || !matchFps.Success || !matchSize.Success || !matchTime.Success || !matchBitrate.Success) { return(false); } TimeSpan processedDuration; TimeSpan.TryParse(matchTime.Groups[1].Value, out processedDuration); long frame = Convert.ToInt64(matchFrame.Groups[1].Value, CultureInfo.InvariantCulture); double fps = Convert.ToDouble(matchFps.Groups[1].Value, CultureInfo.InvariantCulture); int sizeKb = Convert.ToInt32(matchSize.Groups[1].Value, CultureInfo.InvariantCulture); double bitrate = Convert.ToDouble(matchBitrate.Groups[1].Value, CultureInfo.InvariantCulture); progressEventArgs = new ConvertProgressEventArgs(processedDuration, TimeSpan.Zero, frame, fps, sizeKb, bitrate); return(true); }
private void Converter_ConvertProgress(object sender, ConvertProgressEventArgs e, CancellationTokenSource taskToken) { if (taskToken.IsCancellationRequested) { ((FFMpegConverter)sender).Stop(); } }
/// <summary> /// <para> ---- </para> /// <para>Establishes whether the data contains progress information.</para> /// </summary> /// <param name="data">Event data from the FFmpeg console.</param> /// <param name="progressEventArgs"> /// <para>If successful, outputs a <see cref="ConvertProgressEventArgs"/> which is </para> /// <para>generated from the data. </para> /// </param> internal static bool IsProgressData(string data, out ConvertProgressEventArgs progressEventArgs) { progressEventArgs = null; Match matchFrame = Index[Find.ConvertProgressFrame].Match(data); Match matchFps = Index[Find.ConvertProgressFps].Match(data); Match matchSize = Index[Find.ConvertProgressSize].Match(data); Match matchTime = Index[Find.ConvertProgressTime].Match(data); Match matchBitrate = Index[Find.ConvertProgressBitrate].Match(data); if (!matchFrame.Success || !matchFps.Success || !matchSize.Success || !matchTime.Success || !matchBitrate.Success) return false; TimeSpan processedDuration; TimeSpan.TryParse(matchTime.Groups[1].Value, out processedDuration); long frame = Convert.ToInt64(matchFrame.Groups[1].Value, CultureInfo.InvariantCulture); double fps = Convert.ToDouble(matchFps.Groups[1].Value, CultureInfo.InvariantCulture); int sizeKb = Convert.ToInt32(matchSize.Groups[1].Value, CultureInfo.InvariantCulture); double bitrate = Convert.ToDouble(matchBitrate.Groups[1].Value, CultureInfo.InvariantCulture); progressEventArgs = new ConvertProgressEventArgs(processedDuration, TimeSpan.Zero, frame, fps, sizeKb, bitrate); return true; }
internal static bool IsProgressData(string data, out ConvertProgressEventArgs progressEventArgs) { progressEventArgs = null; Match matchFrame = Index[Find.ConvertProgressFrame].Match(data); Match matchFps = Index[Find.ConvertProgressFps].Match(data); Match matchSize = Index[Find.ConvertProgressSize].Match(data); Match matchTime = Index[Find.ConvertProgressTime].Match(data); Match matchBitrate = Index[Find.ConvertProgressBitrate].Match(data); if (!matchSize.Success || !matchTime.Success || !matchBitrate.Success) { return(false); } TimeSpan processedDuration; TimeSpan.TryParse(matchTime.Groups[1].Value, out processedDuration); long? frame = GetLongValue(matchFrame); double?fps = GetDoubleValue(matchFps); int? sizeKb = GetIntValue(matchSize); double?bitrate = GetDoubleValue(matchBitrate); progressEventArgs = new ConvertProgressEventArgs(processedDuration, TimeSpan.Zero, frame, fps, sizeKb, bitrate); return(true); }
/// <summary> /// Updates the progress of the process (use for the progress bar). /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="ConvertProgressEventArgs"/> instance containing the event data.</param> private void updateProgress(object sender, ConvertProgressEventArgs e) { ffmpegMaxProcess = e.TotalDuration.Seconds; ffmpegProcess = e.Processed.Seconds; _percentage = (long)((float)(ffmpegProcess / ffmpegMaxProcess) * 100); processPercentage = _percentage + " %"; }
/*** * Updates progress bar of file convertion (bottom one) * ***/ private void updateProgress(object sender, ConvertProgressEventArgs e) { pbConvert.Invoke(new Action(() => { pbConvert.Value = Convert.ToInt32(((double)e.Processed.Ticks / (double)e.TotalDuration.Ticks) * pbConvert.Maximum * 0.9); })); }
static void FFMpegConverter_ConvertProgress(object sender, ConvertProgressEventArgs e) { Console.SetCursorPosition(left: 0, top: Console.CursorTop); Log(contents: "", messageType: MessageType.INFO, writeMode: WriteMode.Append); Console.ResetColor(); Console.Write($"{ JoinVideoName }.{ OutputType } |"); double percent = (e.Processed.TotalMilliseconds / e.TotalDuration.TotalMilliseconds) * 100; Console.BackgroundColor = ConsoleColor.DarkYellow; for (int i = 2; i <= (int)percent; i += 2) { Console.Write(" "); } Console.BackgroundColor = ConsoleColor.Gray; for (int i = (int)percent + (2 - ((int)percent % 2)); i <= 100; i += 2) { Console.Write(" "); } Console.ResetColor(); Console.Write($"|{ percent.ToString(" 0.00") }%"); }
private void _filereader_ConvertProgress(object sender, ConvertProgressEventArgs e) { //_reportedDuration = e.TotalDuration; //if (e.Processed == e.TotalDuration) { // CurrentPercentage = 1.0; //} }
private void OnProgress(object sender, ConvertProgressEventArgs eargs) { if (ConvertProgressEvent == null) { return; } ConvertProgressEvent(sender, eargs); }
protected void ConvertProgress(object sender, ConvertProgressEventArgs args) { if (args.IsCompleted) { var duration = args.TotalDuration; var d = args.Processed; } }
private void engine_ConvertProgressEvent(object sender, ConvertProgressEventArgs eventArgs) { //if ((convertedSong * 100 + (int)((eventArgs.ProcessedDuration.TotalSeconds / eventArgs.TotalDuration.TotalSeconds) * 100)) < ) //{ // convertedSong++; //} int i = eventArgs.TotalDuration.Seconds; int k = eventArgs.ProcessedDuration.Seconds; }
private void _ffmpeg_ConvertProgress(ConvertProgressEventArgs e, string fileName) { if (e.Percent == _percent) { return; } _logger.LogInformation($"{fileName} [{e.Duration} / {e.TotalLength}] {e.Percent}%"); _percent = e.Percent; }
/// <summary> /// Update progress event /// </summary> /// <param name="sender">Sender</param> /// <param name="e">EventArgs<see cref="ConvertProgressEventArgs"/></param> private void UpdateProgress(object sender, ConvertProgressEventArgs e) { if (_totalDutarion == TimeSpan.Zero) { _totalDutarion = e.TotalDuration; } _progress = e.Processed; }
private void OnConvertProgressEvent(object sender, ConvertProgressEventArgs e) { Console.WriteLine("\n------------\nConverting...\n------------"); Console.WriteLine("Bitrate: {0}", e.Bitrate); Console.WriteLine("Fps: {0}", e.Fps); Console.WriteLine("Frame: {0}", e.Frame); Console.WriteLine("ProcessedDuration: {0}", e.ProcessedDuration); Console.WriteLine("SizeKb: {0}", e.SizeKb); Console.WriteLine("TotalDuration: {0}\n", e.TotalDuration); }
private void UpdateProgress(object sender, ConvertProgressEventArgs e) { lblProgress.BeginInvoke((MethodInvoker) delegate() { lblProgress.Text = "Progress: " + e.Processed.ToString() + " / " + e.TotalDuration.ToString(); if (e.Processed == e.TotalDuration) { lblProgress.Text = "Progress: Done"; MessageBox.Show("Download completed"); } }); }
private void FfMpeg_ConvertProgress(object sender, ConvertProgressEventArgs e) { try { progr = e.Processed.ToString(); File.AppendAllText($@"Files\progress.txt", string.Format("ffmpeg progress: {0}" + Environment.NewLine, e.Processed.ToString())); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void engine_ConvertProgressEvent(object sender, ConvertProgressEventArgs e) { if (!_printToConsoleEnabled) { return; } Console.WriteLine("Bitrate: {0}", e.Bitrate); Console.WriteLine("Fps: {0}", e.Fps); Console.WriteLine("Frame: {0}", e.Frame); Console.WriteLine("ProcessedDuration: {0}", e.ProcessedDuration); Console.WriteLine("SizeKb: {0}", e.SizeKb); Console.WriteLine("TotalDuration: {0}\n", e.TotalDuration); }
private void ConvertProgressEvent(object sender, ConvertProgressEventArgs e) { var progressDetails = new ProgressDetailsEvent(); progressDetails.CurrentFileNumber = _currentFile.ToString(); progressDetails.TotalFileCount = _totalFiles.ToString(); progressDetails.BitRate = e.Bitrate; progressDetails.FramesPerSecond = e.Fps; progressDetails.Frame = e.Frame; progressDetails.ProcessedDuration = e.ProcessedDuration; progressDetails.SizeKB = e.SizeKb; progressDetails.TotalDuration = e.TotalDuration; progressDetails.PercentComplete = e.ProcessedDuration.TotalMilliseconds / e.TotalDuration.TotalMilliseconds * 100.0; _callBack(progressDetails); }
public static bool GainedDuration(object sender, ConvertProgressEventArgs eargs, out TaskSetup setup) { if (eargs.IsGainedDuration) { if (sender is MagickTask) { setup = (sender as MagickTask).TaskSetup; return(true); } setup = null; return(true); } setup = null; return(false); }
public static bool GainedDuration(object sender, ConvertProgressEventArgs eargs, out string mediaId) { if (eargs.IsGainedDuration) { if (sender is FFMpegEncoderTask) { mediaId = (sender as FFMpegEncoderTask).MediaId; return(true); } mediaId = null; return(true); } mediaId = null; return(false); }
public static bool ProgressCompleted(object sender, ConvertProgressEventArgs eargs, out TaskSetup setup) { if (eargs.IsCompleted) { if (sender is OfficeTask) { setup = (sender as OfficeTask).TaskSetup; return(true); } setup = null; return(true); } setup = null; return(false); }
private void UpdateProgress(object sender, ConvertProgressEventArgs e) { if (ProgressVisible.Equals(Visibility.Hidden)) { ProgressVisible = Visibility.Visible; } ProgressValue = (int)((e.Processed.TotalSeconds / e.TotalDuration.TotalSeconds) * 100); //Debug.WriteLine(""); //Debug.WriteLine("\rProcessed: " + e.Processed.TotalSeconds); //Debug.WriteLine("\rTotalDuration: " + e.TotalDuration.TotalSeconds); //Debug.WriteLine(""); //Console.Write("\rTotalDuration: " + e.TotalDuration); }
// progress bar handler to update percentages static void progHandler(object o, ConvertProgressEventArgs args, ProgressWindow progform) { int prog = (int)(100 * (args.Processed.TotalSeconds / args.TotalDuration.TotalSeconds)); progform.BeginInvoke(new Action(() => { //you might think this is a bug. No, this is intentional. Due to the way MS implemented events and progressbar class //if the events and/or update goes too fast, the bar not draw the updates. Even after you've slept the process. // so this is set as is to make sure that the process *ends* with 100 for the end user. If you want to be a purist //prog is set to the proper percentage. // *note* --- args.Processed= 00:00:22.7500000/22.75, args.TotalDuration= 00:00:22.7500000/22.75, ((processed*100)/totalduration)=103 --- //--- args.Processed= 00:00:22.7500000/22.75, args.TotalDuration= 00:00:22.7500000/22.75, 100 *(processed/totalduration)=100 --- //because microsoft. progform.setProgress(100); progform.Update(); })); Console.WriteLine(String.Format("--- args.Processed= " + args.Processed + "/" + args.Processed.TotalSeconds + ", args.TotalDuration= " + args.TotalDuration + "/" + args.TotalDuration.TotalSeconds.ToString() + ", ((processed*100)/totalduraction)=" + prog + " ---")); }
private void UpdateProgress(object sender, ConvertProgressEventArgs e) { double rT = e.TotalDuration.TotalSeconds - e.Processed.TotalSeconds; if (rT < 0) { rT = 0; } TimeSpan remainingTime = TimeSpan.FromSeconds(rT); ConvertProgress = (double)e.Processed.TotalMilliseconds; ConvertDuration = (double)e.TotalDuration.TotalMilliseconds; currentProgress = (progressBar / 2) + (progressBar / 2) * (ConvertProgress / ConvertDuration); if (currentProgress > progressBar) { currentProgress = progressBar; } dialog.SetMessage("\nCollection is currently being created! \n\nIt may take a while...(" + remainingTime.ToString(@"mm\:ss") + ")"); dialog.SetProgress(currentProgress); }
private void Convert_Progess(object sender, ConvertProgressEventArgs e) { _process = 0; _duration = 0; _percentage = 0; _process = e.Processed.TotalMinutes; _duration = e.TotalDuration.TotalMinutes; _percentage = (_process / _duration) * 100; if (_percentage > 100) { _percentage = 100.00; } VideoProgressBarConvert.Value = Convert.ToInt32(_percentage); VideoProgressBarConvert.Refresh(); VideoLabelProcessingOn.Text = string.Concat("Process on.", Environment.NewLine, e.Processed, " / ", e.TotalDuration); VideoLabelProcessingOn.Refresh(); }
private void engine_ConvertProgressEvent(object sender, ConvertProgressEventArgs e) { if (!_printToConsoleEnabled) return; Console.WriteLine("Bitrate: {0}", e.Bitrate); Console.WriteLine("Fps: {0}", e.Fps); Console.WriteLine("Frame: {0}", e.Frame); Console.WriteLine("ProcessedDuration: {0}", e.ProcessedDuration); Console.WriteLine("SizeKb: {0}", e.SizeKb); Console.WriteLine("TotalDuration: {0}\n", e.TotalDuration); }
private void OnConvertProgress(object sender, ConvertProgressEventArgs e) { Console.WriteLine($"{Math.Round(e.ProcessedDuration.TotalSeconds / e.TotalDuration.TotalSeconds * 100, 2)} %"); }
public void HandleProgress(object sender, ConvertProgressEventArgs e) { task.Message = String.Format(Properties.Resources.COMMAND_MSG_PROGRESS_MP3, e.Processed, e.TotalDuration); }
private void OnProgressChanged(ConvertProgressEventArgs e) { ConvertProgressEvent?.Invoke(this, e); }
private void FfMpeg_ConvertProgress(object sender, ConvertProgressEventArgs e) => Dispatcher.Invoke(() => { waitBar.Value = (waitBar.Value + 1) % 10; });
private static void ConvertProgressEvent(object sender, ConvertProgressEventArgs e) { Console.WriteLine("\n------------\nConverting...\n------------"); Console.WriteLine("ProcessedDuration: {0}", e.Processed); Console.WriteLine("TotalDuration: {0}\n", e.TotalDuration); }
private void Engine_ConvertProgressEvent(object sender, ConvertProgressEventArgs e) { //pbConvert.Value - e. }
private void FfMpeg_ConvertProgress(object sender, ConvertProgressEventArgs e) { Debug.WriteLine(string.Format("ffmpeg progress: {0}", e.Processed.ToString())); }