C # call FFmpeg to synthesize video based on pictures

Source: Internet
Author: User

1. Project structure:

2. Code:

  

usingSystem;usingSystem.Collections.Generic;usingSystem.Diagnostics;usingsystem.web;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;namespacewebffmpeg{ Public Partial class_default:system.web.ui.page {protected voidPage_Load (Objectsender, EventArgs e) {        }        protected voidButton1_Click (Objectsender, EventArgs e) {            stringPathString =AppDomain.CurrentDomain.SetupInformation.ApplicationBase; Process P=NewProcess (); p.StartInfo.FileName= PathString +"\\FFmpeg\\ffmpeg.exe"; P.startinfo.arguments=@"-y-r 1-i"+pathstring+@"ffmpeg\pic\img%2d.jpg-i"+pathstring+@"ffmpeg\music\02.mp3-s 800x800-vcodec MPEG4"+pathstring+@"Ffmpeg\vedio\out.mp4"; P.startinfo.useshellexecute=false; P.startinfo.redirectstandarderror=true; P.startinfo.crea Tenowindow=true; P.errordatareceived+=NewDatareceivedeventhandler (s, message) = {Response.Write (message). Data); });//the event generated by the external program (here is the ffmpeg) output stream, here is the process of transferring the stream to the following method, please refer to MSDNP.start ();//Start ThreadP.beginerrorreadline ();//start Asynchronous Readp.WaitForExit ();//blocking wait process endP.close ();//Close ProcessP.dispose ();//Freeing ResourcesResponse.Write ("<a href= ' ffmpeg/vedio/out.mp4 ' > Downloads </a>"); }    }}

3.Demo Connection

Http://url.cn/P64rFI

C # call FFmpeg to synthesize video based on pictures

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.