Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6556105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:54:06+00:00 2026-05-25T12:54:06+00:00

I’m trying to create a .NET wrapper for media-file conversion using ffmepg , here

  • 0

I’m trying to create a .NET wrapper for media-file conversion using ffmepg, here is what I’ve tried:

static void Main(string[] args)
{
  if (File.Exists("sample.mp3")) File.Delete("sample.mp3");

  string result;

  using (Process p = new Process())
  {
    p.StartInfo.FileName = "ffmpeg";
    p.StartInfo.Arguments = "-i sample.wma sample.mp3";

    p.StartInfo.UseShellExecute = false;
    p.StartInfo.RedirectStandardOutput = true;

    p.Start();

    //result is assigned with an empty string!
    result = p.StandardOutput.ReadToEnd();

    p.WaitForExit();
  }
}

What actually happens is the content of the ffmpeg program is printed out to the Console app, but the result variable is an empty string. I want to control the conversion progress interactively, so the user doesn’t even have to know I’m using ffmpeg, but he still knows the conversion progress’ details and what percentage etc. the app is up to.

Basically I would also be happy with a .NET wrapper for a P/Invoke to conversion function ONLY (I am not interested in a whole external library, unless I can extract the PI function from it).

Anyone with experience in ffmpeg & .NET?

Update
Please view my further question, how to write input to a running ffmpeg process.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T12:54:07+00:00Added an answer on May 25, 2026 at 12:54 pm

    Here is the answer:

    static void Main()
    {
      ExecuteAsync();
      Console.WriteLine("Executing Async");
      Console.Read();
    }
    
    static Process process = null;
    static void ExecuteAsync()
    {
      if (File.Exists("sample.mp3"))
        try
        {
          File.Delete("sample.mp3");
        }
        catch
        {
          return;
        }
    
      try
      {
        process = new Process();
        ProcessStartInfo info = new ProcessStartInfo("ffmpeg.exe",
            "-i sample.wma sample.mp3");
    
        info.CreateNoWindow = false;
        info.UseShellExecute = false;
        info.RedirectStandardError = true;
        info.RedirectStandardOutput = true;
    
        process.StartInfo = info;
    
        process.EnableRaisingEvents = true;
        process.ErrorDataReceived +=
            new DataReceivedEventHandler(process_ErrorDataReceived);
        process.OutputDataReceived +=
            new DataReceivedEventHandler(process_OutputDataReceived);
        process.Exited += new EventHandler(process_Exited);
    
        process.Start();
    
        process.BeginOutputReadLine();
        process.BeginErrorReadLine();
      }
      catch
      {
        if (process != null) process.Dispose();
      }
    }
    
    static int lineCount = 0;
    static void process_ErrorDataReceived(object sender, DataReceivedEventArgs e)
    {
      Console.WriteLine("Input line: {0} ({1:m:s:fff})", lineCount++,
          DateTime.Now);
      Console.WriteLine(e.Data);
      Console.WriteLine();
    }
    
    static void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
    {
      Console.WriteLine("Output Data Received.");
    }
    
    static void process_Exited(object sender, EventArgs e)
    {
      process.Dispose();
      Console.WriteLine("Bye bye!");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I have just tried to save a simple *.rtf file with some websites and
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.