ffmpeg.我更正要插入徽标 [英] ffmpeg. I correct that to insert the logo
本文介绍了ffmpeg.我更正要插入徽标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
私有 void btnStart_Click(此 .btnStart.Enabled = false ;
此 .progressBar1.Value = 0 ;
字符串 srcFile = Path.Combine( this .txtSource.Text, this .lstFiles.SelectedItem.ToString());
MessageBox.Show(srcFile);
字符串 dstFile = Path.Combine(此 .txtOutput.Text,
Path.GetFileNameWithoutExtension( this .lstFiles.SelectedItem.ToString()))+ " + 字符串 imafile = Path.Combine(" +this.openFileDialog1.SafeFileName);
MessageBox.Show(imafile);
字符串 videoRateOption = 字符串 .Empty;
如果(此 .cboVideoRate.SelectedIndex!= 0 跨度>)
{
videoRateOption = " + > .cboVideoRate.SelectedItem.ToString().Split(' ')[" k";
MessageBox.Show(videoRateOption);
}
字符串 videoSizeOption = 字符串 .Empty;
如果(此 .lstVideoSize.SelectedIndex!= 0 跨度>)
{
videoSizeOption = " + 此 .lstVideoSize.SelectedItem.ToString().Split(' ')[" ";
}
此 .Text = " ;
ThreadPool.QueueUserWorkItem((对象状态)= >
{
ConvertFile(srcFile,imafile,dstFile,videoRateOption,videoSizeOption);
});
}
字符串 strFFMPEGOut;
ProcessStartInfo psiProcInfo = 新 ProcessStartInfo();
TimeSpan估计时间= TimeSpan.MaxValue;
StreamReader srFFMPEG;
字符串 ste = " movie = watermarklogo .png [wm]; [在中] [wm] overlay = main_w-overlay_w-10:main_h-overlay_h-10 [ out ] " ;
字符串 strFFMPEGCmd = " " " -ar 44100" + videoRateOption + videoSizeOption + -vf" span> + ste + " "
+ dstFile +" ";
psiProcInfo.FileName = Application.StartupPath +(( IntPtr .Size == 8 )?" :" )+ " ;
psiProcInfo.Arguments = strFFMPEGCmd;
psiProcInfo.UseShellExecute = false ;
psiProcInfo.WindowStyle = ProcessWindowStyle.Hidden;
psiProcInfo.UseShellExecute = false ;
psiProcInfo.RedirectStandardError = true ;
psiProcInfo.ErrorDialog = true ;
psiProcInfo.RedirectStandardOutput = true ;
psiProcInfo.CreateNoWindow = true ;
prcFFMPEG.StartInfo = psiProcInfo;
prcFFMPEG.Start();
我没有按下启动按钮来尝试修复使用Ffmpeg将徽标插入影片中的代码时的响应.如果我不选择徽标文件的路径,那可以吗?
解决方案
请不要在多个论坛中重新发布相同的问题.您已经在此处了一个答案 [private void btnStart_Click(object sender, EventArgs e) { this.btnStart.Enabled = false; this.progressBar1.Value = 0; string srcFile = Path.Combine(this.txtSource.Text, this.lstFiles.SelectedItem.ToString()); MessageBox.Show(srcFile); string dstFile = Path.Combine(this.txtOutput.Text, Path.GetFileNameWithoutExtension(this.lstFiles.SelectedItem.ToString())) + "." + this.cboOutputFormat.SelectedItem; MessageBox.Show(dstFile); string imafile = Path.Combine("movie= "+this.openFileDialog1.SafeFileName); MessageBox.Show(imafile); string videoRateOption = string.Empty; if (this.cboVideoRate.SelectedIndex != 0) { videoRateOption = " -b:v " + this.cboVideoRate.SelectedItem.ToString().Split(' ')[0] + "k "; MessageBox.Show(videoRateOption); } string videoSizeOption = string.Empty; if (this.lstVideoSize.SelectedIndex != 0) { videoSizeOption = " -s " + this.lstVideoSize.SelectedItem.ToString().Split(' ')[0] + " "; } this.Text = "Converting..."; ThreadPool.QueueUserWorkItem((object state) => { ConvertFile(srcFile, imafile, dstFile, videoRateOption, videoSizeOption); }); } string strFFMPEGOut; ProcessStartInfo psiProcInfo = new ProcessStartInfo(); TimeSpan estimatedTime = TimeSpan.MaxValue; StreamReader srFFMPEG; string ste = ""movie=watermarklogo.png [wm];[in][wm] overlay=main_w-overlay_w-10:main_h-overlay_h-10 [out]""; string strFFMPEGCmd = " -i "" + srcFile + "" -ar 44100 " + videoRateOption + videoSizeOption +"-vf"+ ste + "-y "" + dstFile + """; psiProcInfo.FileName = Application.StartupPath + ((IntPtr.Size == 8) ? "\x64" : "\x86") + "\ffmpeg.exe"; psiProcInfo.Arguments = strFFMPEGCmd; psiProcInfo.UseShellExecute = false; psiProcInfo.WindowStyle = ProcessWindowStyle.Hidden; psiProcInfo.UseShellExecute = false; psiProcInfo.RedirectStandardError = true; psiProcInfo.ErrorDialog = true; psiProcInfo.RedirectStandardOutput = true; psiProcInfo.CreateNoWindow = true; prcFFMPEG.StartInfo = psiProcInfo; prcFFMPEG.Start();
There is no response that I push the start button that I tried to fix the code that I inserted the logo in the movie with Ffmpeg. Is that be okay if I don''t choose the path of logo File. and Is there any something wrong that I did.解决方案Please do not repost the same question in multiple forums. You already have an answer here[^].
这篇关于ffmpeg.我更正要插入徽标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文