Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Video Merging with Xabe.FFmpeg. How to track the progress?

Video Merging with Xabe.FFmpeg. How to track the progress?

Scheduled Pinned Locked Moved C#
tutorialquestion
3 Posts 3 Posters 10 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Kasun Lee
    wrote on last edited by
    #1

    Hi I wrote the below simple code to merge two video files, it's working. But I wanna track the merging task percentage (or something that shows the progress), so I could show it using a progress bar. How to track the progress? Thanks.

    textBox_taskMsg.Text = "Task is being performed.. This may take some time.";

    string[] files = { textBox_Source1.Text, textBox_Source2.Text }; // Vids to be merged
    string output = textBox_Source1.Text + "_merged.mp4"; // Output vid name
    var conversion = await FFmpeg.Conversions.FromSnippet.Concatenate(output, files); // Merge
    await conversion.Start();

    // SHOW MERGING PROGRESS

    textBox_taskMsg.Text = "Merge Complete.";

    OriginalGriffO A 2 Replies Last reply
    0
    • K Kasun Lee

      Hi I wrote the below simple code to merge two video files, it's working. But I wanna track the merging task percentage (or something that shows the progress), so I could show it using a progress bar. How to track the progress? Thanks.

      textBox_taskMsg.Text = "Task is being performed.. This may take some time.";

      string[] files = { textBox_Source1.Text, textBox_Source2.Text }; // Vids to be merged
      string output = textBox_Source1.Text + "_merged.mp4"; // Output vid name
      var conversion = await FFmpeg.Conversions.FromSnippet.Concatenate(output, files); // Merge
      await conversion.Start();

      // SHOW MERGING PROGRESS

      textBox_taskMsg.Text = "Merge Complete.";

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      The only way to find that out is to go back to where you got the package from, and either ask there or read the documentation. But ... if you are using ffmpeg in a separate process, it's very unlikely that progress reporting is going to be possible: ffmpeg isn't a "windows aware" app, it's a console app and those don't generally report anything except to a console screen. And while you can pipe the console app progress to a stream you can read that requires getting the process itself, and providing extra command line instructions when the process is started. Since you are using a wrapper API, it would be entirely up to what that wrapper provides, and I'm not familiar with that one.

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • K Kasun Lee

        Hi I wrote the below simple code to merge two video files, it's working. But I wanna track the merging task percentage (or something that shows the progress), so I could show it using a progress bar. How to track the progress? Thanks.

        textBox_taskMsg.Text = "Task is being performed.. This may take some time.";

        string[] files = { textBox_Source1.Text, textBox_Source2.Text }; // Vids to be merged
        string output = textBox_Source1.Text + "_merged.mp4"; // Output vid name
        var conversion = await FFmpeg.Conversions.FromSnippet.Concatenate(output, files); // Merge
        await conversion.Start();

        // SHOW MERGING PROGRESS

        textBox_taskMsg.Text = "Merge Complete.";

        A Offline
        A Offline
        Andre Oosthuizen
        wrote on last edited by
        #3

        You can use the 'OnProgress' event - ffmpeg Documentation[^] To add a progress tracker using a percentage, add the following to your code -

        textBox_taskMsg.Text = "Task is being performed.. This may take some time.";

        string[] files = { textBox_Source1.Text, textBox_Source2.Text };
        string output = textBox_Source1.Text + "_merged.mp4";

        var conversion = await FFmpeg.Conversions.FromSnippet.Concatenate(output, files)
        .OnProgress += (sender, args) =>
        {
        //Calculate and display the progress as a percentage to your uswer...
        double progressPercentage = args.Percent;
        textBox_taskMsg.Text = $"Merging... {progressPercentage:F2}% complete";
        };

        await conversion.Start();

        textBox_taskMsg.Text = "Merge Complete.";

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups