tags:

views:

416

answers:

3

I'm trying to extract an mp3 from a flash compatible mp4 file and have so far found FFMpeg and a bunch of different wrappers that all claim to be able to do the job.

Ideally, I'd like to not have to rely on shelling to the FFMpeg exe, but none of the wrappers I've tried seem to work....

Has anyone got any code or advice for how to go about this?

Thanks!

A: 

An alternative might be to use VLC. There's a library dll, and several semi-supported C# wrappers for it. You should be able to do transcoding, playback, even streaming.

Not sure if it's less work than shelling out to ffmpeg, though.

JoshRivers
+1  A: 

In my opinion using Process class is the way to go:

Create process:

private Process GetProc(string workingDirectory)

    {

        return new Process

                   {

                       StartInfo = new ProcessStartInfo

                                       {

                                           WorkingDirectory = workingDirectory,

                                           UseShellExecute = false,

                                           RedirectStandardOutput = true,

                                           FileName = "YOUR_EXECUTABLE"

                                       }

                   };

    }

Call with parmeters and then get the result. After this you need to check if it was successful or not. Keep it simple.

public string Execute(string arguments)

    {

        var action = GetProc();

        action.StartInfo.Arguments = arguments;

        action.Start();

        action.WaitForExit();

        return action.StandardOutput.ReadToEnd();

    }
Serkan
This is more or less the strategy I use in one of my apps for extracting the MPEG from a DVR-MS file. It's not as feedback-rich as doing it in code, but it works well. +1
Eric Smith
A: 

There is a tutorial and a .NET library to do this here: http://ivolo.mit.edu/post/Convert-Audio-Video-to-Any-Format-using-C.aspx

Ilya