简体   繁体   中英

How can i add ffmpeg.exe file to my project but two files one for 32bit and one for 64bit?

I added one ffmpeg.exe to my project but it's 64bit version . I did on the file properties in my project : Content and Copy always .

But when my brother tried to run the project which need the ffmpeg.exe the program crashed since he got windows xp 32bit.

This is how i'm using the ffmpeg.exe in my code :

public void Start(string pathFileName, int BitmapRate)
        {
            string outPath = pathFileName;
            p = new NamedPipeServerStream(pipename, PipeDirection.Out, 1, PipeTransmissionMode.Byte);
            b = new byte[1920 * 1080 * 3]; // some buffer for the r g and b of pixels of an image of size 720p

            ProcessStartInfo psi = new ProcessStartInfo();
            psi.WindowStyle = ProcessWindowStyle.Hidden;
            psi.UseShellExecute = false;
            psi.CreateNoWindow = true;
            psi.FileName = ffmpegFileName;
            psi.WorkingDirectory = workingDirectory;
            psi.Arguments = @"-f rawvideo -pix_fmt bgr0 -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v libx264 -r " + BitmapRate + " " + outPath;
            //psi.RedirectStandardOutput = true;
            process = Process.Start(psi);
            process.EnableRaisingEvents = false;
            p.WaitForConnection();
        }

The questions are : How can i add another ffmpeg.exe to my project but 32bit this time the problem is that my project have already ffmpeg.exe

Second how can i detect or check if the user have 32bit so to run/use the ffmpeg.exe 32bit and if the user have windows 64bit use 64bit ?

To include ffmpeg twice, just make subdirectories - X86\\ffmpeg.exe and x64\\ffmpeg.exe and call the appropriate one.

To see if your OS is 64-bit capable, use System.Environment.Is64BitOperatingSystem

How to detect programmatically whether you are running on 64-bit Windows

http://blogs.msdn.com/b/oldnewthing/archive/2005/02/01/364563.aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM