FFmpeg download installation and simple application (C # audio format conversion)

Source: Internet
Author: User

FFmpeg download installation and simple application

Let's start by introducing Ffmpeg:ffmpeg is a free software that can run audio and video in a variety of formats, video, conversion, streaming, including libavcodec-This is a library of decoders for audio and video in multiple projects, and libavformat-- An audio and video format conversion Library.
Name origin: "FF" in the word "FFmpeg" refers to "Fast Forward" [2]. Some novice write to "FFmpeg" project leader, ask FF is not on behalf of "fast free" or "fast Fourier" meaning, "FFmpeg" the project leader replied "Just for the record, the original Meaning of "FF" in FFmpeg is "Fast Forward" ... "

First, FFmpeg download

Download the FFmpeg installation file to http://ffmpeg.org/first

Then the middle part of the Latest Zeranoe FFmpeg Build version of the system, 32-bit or 64-bit, and there are three versions, a brief introduction, are I understand the idea, do not understand English, we forgive.
The Static versions is an integrated version, which is all encapsulated in an EXE executable file.
GKFX versions is a shared version, this is the total execution program and some Lib library files in a folder, should be in order to customize the library bar, I guess.
Dev versions is a development version, it is completely script, it looks like Linux, this really does not understand.

Everyone according to their own system number of suggestions to choose the static versions integrated version, only need a file OK, clean and convenient.

Second, ffmpeg installation

A, unzip the download finished ffmpeg-20150407-git-c4b2017-win64-shared

After decompression, (Doc folder is about the document, licenses is a statement, this has an open source software agreement, understand the details please Baidu, presets folder seems to be some of the default settings of the code, I guess, do not understand, want to understand or Baidu bar, degree Niang really omnipotent)

B. Configure the path of the Ffmpeg.exe to path in the environment variable

Third, ffmpeg verification

Alt+r, enter cmd, enter ffmpeg on the DOS command line

The following prompt indicates that the FFmpeg installation was successful

Iv. Simple application of FFmpeg

I'm currently using it to convert a recorded video into a picture.

Ffmpeg.exe-i path \ filename to be converted. mp4-r 30-s 640*480 The path saved after conversion \ folder name/%d.jpg

Ffmpeg.exe-i C:\Users\Administrator\Desktop\video\20150407_174405.mp4-r 30-s 640x480 C:\Users\Administrator\ Desktop\video/%d.jpg

-I is the select executed file

-R 30 is the frame rate of the converted video, which is the number of frames per second

-S 640*480 is the resolution of the converted video screen

C # code implementation

First, you need to download a "Ffmpeg.exe" plugin, and then put it in your project, such as:
The file is called in the program to help convert the audio format!

        /// <summary>        ///Audio Format Conversion/// </summary>        /// <param name= "Pathbefore" >file path/filename before conversion</param>        /// <param name= "Pathlater" >converted file path/file name</param>        /// <returns></returns>         Public stringCONVERTTOMP3 (stringPathbefore,stringpathlater) {            //string pathbefore = Mappathfile ("~/attachment/alertmessage/") + "20180309194843"; //string pathlater = Mappathfile ("~/attachment/alertmessage/") + "20180309194855.mp3";            stringc = Mappathfile ("/resources/ffmpeg/") +@"ffmpeg.exe-i"+ Pathbefore +" "+Pathlater; stringstr =Runcmd (c); returnstr; }        /// <summary>        ///Execute cmd command/// </summary>        Private stringRuncmd (stringc) {Try{ProcessStartInfo Info=NewProcessStartInfo ("Cmd.exe"); Info. Redirectstandardoutput=false; Info. UseShellExecute=false; Process P=Process.Start (info); P.startinfo.useshellexecute=false; P.startinfo.redirectstandardinput=true; P.startinfo.redirectstandardoutput=true; P.startinfo.redirectstandarderror=true;                P.start ();                P.standardinput.writeline (c); P.standardinput.autoflush=true; Thread.Sleep ( +); P.standardinput.writeline ("Exit");                p.WaitForExit (); stringOUTSTR =P.standardoutput.readtoend ();                P.close (); returnoutstr; }            Catch(Exception ex) {return "Error"+Ex.            Message; }        }

FFmpeg download installation and simple application (C # audio format conversion)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.