C # implements FFmpeg video transcoding, playback

Source: Internet
Author: User

recently the company project required to achieve a panoramic camera video interception, but the interception of video demand transcoding upload. After studying the use of FFmpeg transcoding, a detailed introduction to the blog :

The simplest ffmpeg-based transcoding program

The main is the operation process of transcoding, can realize the MP4 converted from the camera to the normal player MP4 format;

1         //transcoding Method2         Private voidTest1 ()3         {4 5Process p =NewProcess ();6             7 8p.StartInfo.FileName = path +"Ffmpeg.exe";9 TenP.startinfo.useshellexecute =false; One             stringSrcfilename =""; A             stringdestFileName =""; -Srcfilename = path +"Initvideo1.mp4"; -  thedestFileName = path +"Initvideo.mp4"; -  -P.startinfo.arguments ="- I."+ Srcfilename +"-y-vcodec h264-b 500000"+ destFileName;//Execution Parameters -  +P.startinfo.useshellexecute =false;////Do not use system shell to start process -P.startinfo.createnowindow =true;//do not show DOS program window +  AP.startinfo.redirectstandardinput =true; at  -P.startinfo.redirectstandardoutput =true; -  -P.startinfo.redirectstandarderror =true;//writes the external program error output to the StandardError stream -  -P.errordatareceived + =NewDatareceivedeventhandler (p_errordatareceived); in  -P.outputdatareceived + =NewDatareceivedeventhandler (p_outputdatareceived); to  +P.startinfo.useshellexecute =false; -  the P.start (); *  $P.startinfo.windowstyle =Processwindowstyle.hidden;Panax Notoginseng  -P.beginerrorreadline ();//start Asynchronous Read the  +  A  thep.WaitForExit ();//blocking wait process end +  -P.close ();//Close Process $  $P.dispose ();//Freeing Resources -}

Test Demo program included:

Code download

C # implements FFmpeg video transcoding, playback

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.