資源簡介
C# 圖片幀轉換mp4格式視頻
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Diagnostics;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Threading.Tasks;
using?System.Windows.Forms;
namespace?demo
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?PictureFile_Click(object?sender?EventArgs?e)
????????{
????????????FolderBrowserDialog?dlg?=?new?FolderBrowserDialog();
????????????if?(dlg.ShowDialog()?==?System.Windows.Forms.DialogResult.OK)
????????????{
????????????????this.txtPath.Text?=?dlg.SelectedPath;
????????????}
????????}
????????private?void?MP4File_Click(object?sender?EventArgs?e)
????????{
????????????FolderBrowserDialog?dlg?=?new?FolderBrowserDialog();
????????????if?(dlg.ShowDialog()?==?System.Windows.Forms.DialogResult.OK)
????????????{
????????????????this.MP4Path.Text?=?dlg.SelectedPath;
????????????}
????????}
????????private?void?txtPath_Click(object?sender?EventArgs?e)
????????{
????????}
????????private?void?button1_Click(object?sender?EventArgs?e)
????????{
????????????ImageGetVideo();
????????}
????????#region?圖片轉視頻
????????public?void?ImageGetVideo()
????????{
????????????string?ffmpeg?=?string.Format(“{0}ffmpeg.exe“?AppDomain.CurrentDomain.baseDirectory);
????????????try
????????????{
????????????????ProcessStartInfo?startInfo?=?new?ProcessStartInfo(ffmpeg);
????????????????startInfo.Windowstyle?=?System.Diagnostics.ProcessWindowstyle.Hidden;
????????????????//?-i?foo.avi?-r?1?-s?WxH?-f?image2?foo-%03d.jpeg??//這是把視頻轉圖片的
????????????????//及其耗CUP的指定幀截取圖片幀?string.Format(“?-i?\“{0}\“?-y?-f?image2?-ss?{1}?-s?\“{2}\“?\“{3}\““?vedioPath?catchTime?saveImgSize?saveImgPath)
????????????????startInfo.Arguments?=?string.Format(“?-f?image2?-i?“+?txtPath.Text?+?@“\%d.jpg?-vcodec?libx264?-r?10??“+?MP4Path.Text?+?@“\test.mp4“);
????????????????System.Diagnostics.Process.Start(startInfo).Close();
????????????}
????????????catch?(Exception?ex)
????????????{
????????????????MessageBox.Show(ex.ToString());
????????????????return;
????????????}
????????}
????????#endregion
????????private?void?MP4Path_Click(object?sender?EventArgs?e)
????????{
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-10-08?17:01??C#?圖片幀轉換mp4格式視頻\
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\.vs\
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\v15\
?????文件???????43520??2018-10-16?11:06??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\v15\.suo
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\v15\Server\
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\v15\Server\sqlite3\
?????文件???????????0??2018-10-16?10:44??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\v15\Server\sqlite3\db.lock
?????文件??????581632??2018-10-16?10:58??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\v15\Server\sqlite3\storage.ide
?????文件???????32768??2018-10-16?10:59??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\v15\Server\sqlite3\storage.ide-shm
?????文件??????733392??2018-10-16?11:10??C#?圖片幀轉換mp4格式視頻\demo\.vs\demo\v15\Server\sqlite3\storage.ide-wal
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\demo\
?????文件?????????187??2018-10-16?10:44??C#?圖片幀轉換mp4格式視頻\demo\demo\App.config
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\demo\bin\
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\demo\bin\Debug\
?????文件???????10752??2018-10-16?11:06??C#?圖片幀轉換mp4格式視頻\demo\demo\bin\Debug\demo.exe
?????文件?????????187??2018-10-16?10:44??C#?圖片幀轉換mp4格式視頻\demo\demo\bin\Debug\demo.exe.config
?????文件???????22016??2018-10-16?11:06??C#?圖片幀轉換mp4格式視頻\demo\demo\bin\Debug\demo.pdb
?????文件????35645440??2017-01-16?06:04??C#?圖片幀轉換mp4格式視頻\demo\demo\bin\Debug\ffmpeg.exe
?????文件????????3482??2018-10-16?10:55??C#?圖片幀轉換mp4格式視頻\demo\demo\demo.csproj
?????文件????????2396??2018-10-16?11:10??C#?圖片幀轉換mp4格式視頻\demo\demo\Form1.cs
?????文件????????7405??2018-10-16?11:10??C#?圖片幀轉換mp4格式視頻\demo\demo\Form1.Designer.cs
?????文件????????5817??2018-10-16?11:10??C#?圖片幀轉換mp4格式視頻\demo\demo\Form1.resx
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\demo\obj\
?????目錄???????????0??2018-10-16?11:11??C#?圖片幀轉換mp4格式視頻\demo\demo\obj\Debug\
?????文件??????????42??2018-10-16?10:44??C#?圖片幀轉換mp4格式視頻\demo\demo\obj\Debug\demo.csproj.CoreCompileInputs.cache
?????文件?????????762??2018-10-16?10:55??C#?圖片幀轉換mp4格式視頻\demo\demo\obj\Debug\demo.csproj.FileListAbsolute.txt
?????文件????????1012??2018-10-16?11:06??C#?圖片幀轉換mp4格式視頻\demo\demo\obj\Debug\demo.csproj.GenerateResource.cache
?????文件???????13843??2018-10-16?10:44??C#?圖片幀轉換mp4格式視頻\demo\demo\obj\Debug\demo.csprojResolveAssemblyReference.cache
?????文件???????10752??2018-10-16?11:06??C#?圖片幀轉換mp4格式視頻\demo\demo\obj\Debug\demo.exe
............此處省略18個文件信息
評論
共有 條評論