public static void RunFFmpegToAAC(AudioConfig audioConfig) { string bat = getAudiobat(audioConfig); ProcessCmd.RunBat(bat, Path.GetTempPath()); }
public static void RunFFmpegToFlac(AudioConfig audioconfig) { ProcessStartInfo processinfo = new ProcessStartInfo(); string bat = getAudioFlacBat(audioconfig.Input, audioconfig.Output, audioconfig); ProcessCmd.RunBat(bat, Path.GetTempPath()); }
public static string NvEncSelf(FileConfig fileConfig) { VedioConfig vedioConfig = fileConfig.VedioConfig; ProcessStartInfo processinfo = new ProcessStartInfo(); string outfile = FileUtility.GetNoSameNameFile(fileConfig.OutputFile + ".h265"); string ffmpegline = Path.Combine(Application.StartupPath, FFmpegCommand.FFmpegExecute).Maohao(); string cqp = $" --cqp {vedioConfig.crf}"; if (vedioConfig.UserArgs.Contains("--cqp") || vedioConfig.UserArgs.Contains("--cbr") || vedioConfig.UserArgs.Contains("--vbr")) { cqp = ""; } string codec = vedioConfig.Encoder == Encoder.NvEnc_H265 ? "-c hevc" : "-c h264"; var bat = $"{nvencexe.Maohao()} {cqp} {codec} --output-depth {vedioConfig.depth} {vedioConfig.UserArgs} -i {fileConfig.VedioFileFullName.Maohao()} -o {outfile.Maohao()}"; if (vedioConfig.BitType == EncoderBitrateType.crf || vedioConfig.BitType == EncoderBitrateType.qp) { ProcessCmd.RunBat(bat, Config.Temp); } else if (vedioConfig.BitType == EncoderBitrateType.twopass) { throw new NotSupportedException(); } return(outfile); }
public static void RunFFmpegToOpus(AudioConfig audioConfig) { string tmp = Path.GetTempPath(); string bat = getAudioOpus(audioConfig); ProcessCmd.RunBat(bat, tmp); }
public static void Mp4boxMux(string vedio, string audio, string outfile, int audiodelay = 0) { string Arguments = string.Format("-add \"{1}\" -add \"{2}\" {3} \"{0}\"", outfile, vedio, audio, audiodelay == 0 ? "" : ("-delay 2=" + audiodelay) ); ProcessCmd.Run(Mp4boxExcute, Arguments); }
public static string ConvertAudioTOpus(FileConfig fileConfig) { AudioConfig audioConfig = fileConfig.AudioConfig; string tmp = Config.Temp; string audiofile = FileUtility.RandomName(tmp) + ".opus"; string bat = $"{Eac3toExecute.Maohao()} {fileConfig.VedioFileFullName.Maohao()} {audioConfig.Tracker}: stdout.wav | {OpusEnc.Maohao()} --ignorelength - {audiofile.Maohao()}"; ProcessCmd.RunBat(bat, Config.Temp); return(audiofile); }
public static string ConvertMusic(FileConfig fileConfig) { AudioConfig audioConfig = fileConfig.AudioConfig; string tmp = Config.Temp; string audiofile = FileUtility.RandomName(tmp) + ".m4a"; string bat = $"{Eac3toExecute.Maohao()} {fileConfig.VedioFileFullName.Maohao()} {audioConfig.Tracker}: {audiofile.Maohao()} -quality={audioConfig.Quality} {audioConfig.CommandLineArgs}"; ProcessCmd.RunBat(bat, Config.Temp); return(audiofile); }
public void SaveDefaultSysConfigFile() { lastUsedDate = DateTime.Now; string path = Application.StartupPath + sysName; ProcessCmd.SetMacConfigRegister((int)this.sysCfg); string s = Serialize.XmlSerialize(this); File.WriteAllText(path, s); }
public static string RunFFmpegToAAC(AudioConfig audioConfig) { string audiofile = FileUtility.RandomName(Path.GetTempPath()) + ".aac"; string bat = getAudiobat(audioConfig); ProcessCmd.RunBat(bat, Path.GetTempPath()); return(audiofile); }
public static string RunFFmpegToOpus(AudioConfig audioConfig) { string tmp = Path.GetTempPath(); string audiofile = FileUtility.RandomName(tmp) + ".opus"; string bat = getAudioOpus(audioConfig); ProcessCmd.RunBat(bat, tmp); return(audiofile); }
private void BrownMoveHardDiskEventHander(object sender, EventArgs e) { bool flag = ProcessCmd.HasMoveHardDisk(); if (flag) { } else { Common.ReportCmdKeyProgress(CmdKey.F0049); } }
public static string ConvertAudioToFlac(FileConfig fileConfig) { AudioConfig audioConfig = fileConfig.AudioConfig; string tmp = Config.Temp; string audiofile = FileUtility.RandomName(tmp) + ".flac"; var eac3to = Path.Combine(Environment.CurrentDirectory, Eac3toExecute); var opusenc = Path.Combine(Environment.CurrentDirectory, OpusEnc); string bat = $"{eac3to.Maohao()} {fileConfig.VedioFileFullName.Maohao()} {audioConfig.Tracker}: {audiofile.Maohao()} "; ProcessCmd.RunBat(bat, Config.Temp); return(audiofile); }
public static string ffmpegPipeX265(FileConfig fileConfig) { VedioConfig vedioConfig = fileConfig.VedioConfig; ProcessStartInfo processinfo = new ProcessStartInfo(); string finalX265Path = ""; if (vedioConfig.depth == 8) { finalX265Path = x265Excute8lite; } else if (vedioConfig.depth == 10) { finalX265Path = x265Excute10lite; } if (!File.Exists(finalX265Path)) { throw new EncoderException("找不到指定程序:" + finalX265Path); } processinfo.FileName = Environment.GetEnvironmentVariable("ComSpec"); string x264Line; string outputpath = ""; Getx265Line(fileConfig, 1, out x264Line, out outputpath); string ffmpegline = TextManager.Mh + FFmpegCommand.FFmpegExecute + TextManager.Mh + FFmpegCommand.GetFfmpegArgs(fileConfig); var bat = ffmpegline + finalX265Path + " " + x264Line + " -"; //processinfo.UseShellExecute = false; //输出信息重定向 //processinfo.CreateNoWindow = true; //processinfo.RedirectStandardInput = true; //processinfo.RedirectStandardOutput = true; //processinfo.RedirectStandardError = false; //processinfo.WindowStyle = ProcessWindowStyle.Hidden; Process avsx264mod = new Process(); if (vedioConfig.BitType == EncoderBitrateType.crf) { ProcessCmd.RunBat(bat, Config.Temp); } else if (vedioConfig.BitType == EncoderBitrateType.twopass) { Getx265Line(fileConfig, 1, out x264Line, out outputpath); var bat1 = ffmpegline + finalX265Path + " " + x264Line + " -"; ProcessCmd.RunBat(bat1, Config.Temp); Getx265Line(fileConfig, 2, out x264Line, out outputpath); var bat2 = ffmpegline + finalX265Path + " " + x264Line + " -"; ProcessCmd.RunBat(bat2, Config.Temp); } avsx264mod.Dispose(); return(outputpath); }
public static string ffmpegPipeX265(FileConfig fileConfig) { VedioConfig vedioConfig = fileConfig.VedioConfig; ProcessStartInfo processinfo = new ProcessStartInfo(); string finalX265Path = ""; finalX265Path = GetX265LiteFullName(vedioConfig); if (Config.IsWindows) { finalX265Path = Path.Combine(Application.StartupPath, finalX265Path); } string x264Line; string outputpath = ""; Getx265Line(fileConfig, 1, out x264Line, out outputpath); string ffmpegline = Path.Combine(Application.StartupPath, FFmpegCommand.FFmpegExecute).Maohao() + FFmpegCommand.GetFfmpegArgs(fileConfig); var bat = ffmpegline + finalX265Path.Maohao() + " " + x264Line; //bat += "\r\npause"; //processinfo.UseShellExecute = false; //输出信息重定向 //processinfo.CreateNoWindow = true; //processinfo.RedirectStandardInput = true; //processinfo.RedirectStandardOutput = true; //processinfo.RedirectStandardError = false; //processinfo.WindowStyle = ProcessWindowStyle.Hidden; Process avsx264mod = new Process(); if (vedioConfig.BitType == EncoderBitrateType.crf) { ProcessCmd.RunBat(bat, Config.Temp); } else if (vedioConfig.BitType == EncoderBitrateType.twopass) { Getx265Line(fileConfig, 1, out x264Line, out outputpath); var bat1 = ffmpegline + finalX265Path + " " + x264Line + " -"; ProcessCmd.RunBat(bat1, Config.Temp); Getx265Line(fileConfig, 2, out x264Line, out outputpath); var bat2 = ffmpegline + finalX265Path + " " + x264Line + " -"; ProcessCmd.RunBat(bat2, Config.Temp); } avsx264mod.Dispose(); return(outputpath); }
public static string RunFFmpegToOpus(FileConfig fileConfig) { AudioConfig audioConfig = fileConfig.AudioConfig; ProcessStartInfo processinfo = new ProcessStartInfo(); string tmp = Config.Temp; string audiofile = FileUtility.RandomName(tmp) + ".opus"; string bat = string.Empty; if (fileConfig.InputType == InputType.AvisynthScriptFile) { return(null); } else { bat = getAudioOpus(fileConfig.AudioInputFile, audiofile, audioConfig); } ProcessCmd.RunBat(bat, Config.Temp); return(audiofile); }
public static string RunFFmpegToAAC(FileConfig fileConfig) { AudioConfig audioConfig = fileConfig.AudioConfig; string tmp = Config.Temp; string audiofile = FileUtility.RandomName(tmp) + ".aac"; string bat = string.Empty; if (fileConfig.InputType == InputType.AvisynthScriptFile) { return(null); } else { bat = getAudiobat(fileConfig.AudioInputFile, audiofile, audioConfig); } ProcessCmd.RunBat(bat, Config.Temp); return(audiofile); }
public static string ConvertAudioTOpus(FileConfig fileConfig) { AudioConfig audioConfig = fileConfig.AudioConfig; string tmp = Config.Temp; string audiofile = FileUtility.RandomName(tmp) + ".opus"; int bitrat = 0; if (audioConfig.Quality < 1) { bitrat = (int)(audioConfig.Quality * 400); } else { bitrat = (int)audioConfig.Quality; } var eac3to = Path.Combine(Environment.CurrentDirectory, Eac3toExecute); var opusenc = Path.Combine(Environment.CurrentDirectory, OpusEnc); string bat = $"{eac3to.Maohao()} {fileConfig.VedioFileFullName.Maohao()} {audioConfig.Tracker}: {audioConfig.CommandLineArgs} stdout.wav | {opusenc.Maohao()} --ignorelength --bitrate {bitrat} --vbr - {audiofile.Maohao()}"; ProcessCmd.RunBat(bat, Config.Temp); return(audiofile); }
private void OperMaintain_Click(object sender, EventArgs e) { int n = Globals.AutoFource ? 4 : 3; MidScreen form = new MidScreen("操作维护", n); form.BtArray[0].Text = "功能参数"; form.BtArray[1].Text = "工程维护"; form.BtArray[2].Text = "外部存储"; form.BtArray[3].Text = "焦距维护"; form.BtArray[2].Click += delegate(Object se, System.EventArgs arg) { bool flag = ProcessCmd.HasMoveHardDisk(); if (flag) { } else { Common.ReportCmdKeyProgress(CmdKey.F0049); } }; ParentForm.PushChildForm(form); }
public override TaskStatus Run() { Info("Launching process..."); if (GeneratesFiles && !(ProcessCmd.Contains(VarFileName) && (ProcessCmd.Contains(VarOutput) && (ProcessCmd.Contains(VarFileName) || ProcessCmd.Contains(VarFileNameWithoutExtension))))) { Error("Error in process command. Please read the documentation."); return(new TaskStatus(Status.Error, false)); } bool success = true; bool atLeastOneSucceed = false; if (!GeneratesFiles) { return(StartProcess(ProcessPath, ProcessCmd, HideGui)); } foreach (FileInf file in SelectFiles()) { string cmd; string outputFilePath; try { cmd = ProcessCmd.Replace(string.Format("{{{0}}}", VarFilePath), string.Format("\"{0}\"", file.Path)); const string outputRegexPattern = @"{\$output:(?:\$fileNameWithoutExtension|\$fileName)(?:[a-zA-Z0-9._-]*})"; var outputRegex = new Regex(outputRegexPattern); var m = outputRegex.Match(cmd); if (m.Success) { string val = m.Value; outputFilePath = val; if (outputFilePath.Contains(VarFileNameWithoutExtension)) { outputFilePath = outputFilePath.Replace(VarFileNameWithoutExtension, Path.GetFileNameWithoutExtension(file.FileName)); } else if (outputFilePath.Contains(VarFileName)) { outputFilePath = outputFilePath.Replace(VarFileName, file.FileName); } outputFilePath = outputFilePath.Replace("{" + VarOutput + ":", Workflow.WorkflowTempFolder.Trim('\\') + "\\"); outputFilePath = outputFilePath.Trim('}'); cmd = cmd.Replace(val, "\"" + outputFilePath + "\""); } else { Error("Error in process command. Please read the documentation."); return(new TaskStatus(Status.Error, false)); } } catch (ThreadAbortException) { throw; } catch (Exception e) { ErrorFormat("Error in process command. Please read the documentation. Error: {0}", e.Message); return(new TaskStatus(Status.Error, false)); } if (StartProcess(ProcessPath, cmd, HideGui).Status == Status.Success) { Files.Add(new FileInf(outputFilePath, Id)); if (!atLeastOneSucceed) { atLeastOneSucceed = true; } } else { success = false; } } var status = Status.Success; if (!success && atLeastOneSucceed) { status = Status.Warning; } else if (!success) { status = Status.Error; } Info("Task finished."); return(new TaskStatus(status, false)); }
//混流 public static void Mux(string vedio, string audio, string output) { ProcessCmd.Run(FFmpegExecute, string.Format(" -i {0} -vcodec copy -i {1} -acodec copy {3}", vedio.Maohao(), audio.Maohao(), output.Maohao())); }
public static void Extract(string filename, string ID) { ProcessCmd.Run(Mp4boxExcute, string.Format("{0 } -raw {1}", filename, ID)); }
public int GetProcessIdUsingProjectName() { int ProcessID = -1; string ReturnValue = string.Empty, LogInfo = string.Empty, LogError = string.Empty; try { string AbsoluteBinaryPath = string.Empty; string DeviceDeploymentPath = RetrieveDeploymentPathFromDevice(); var PSResult = GetCommand().Execute(string.Format("ps -eo cmd | grep {0}", ProjectConfig.Name)); string[] Processes = PSResult.Split('\n'); // Retrieve process cmd starting with the deployment path (first one will be retrieved at least) foreach (var ProcessCmd in Processes) { if (string.IsNullOrEmpty(ProcessCmd)) { continue; } if (ProcessCmd.StartsWith(DeviceDeploymentPath)) { AbsoluteBinaryPath = ProcessCmd.Substring(0, ProcessCmd.IndexOf(' ')); Logger.Info(string.Format("Following process matching project name '{0}' on device '{1}' has been found : {2}", ProjectConfig.Name, Address, ProcessCmd)); break; } } // If the process name has been found, use pidof with full absolute process path if (AbsoluteBinaryPath != string.Empty) { var CmdResult = SshCommand.ExecuteCommand(Logger, string.Format("pidof {0}", AbsoluteBinaryPath), this, out ReturnValue, out LogInfo, out LogError); if (CmdResult == CommandResult.Failure) { Logger.Warning(string.Format("[pidof {0}] command failed on Linux device '{1}'. {2}. {3}. {4}.", AbsoluteBinaryPath, Address, ReturnValue, LogInfo, LogError)); return(ProcessID); } string[] ProcessIds = ReturnValue.Split(' '); foreach (var ProcessId in ProcessIds) { if (string.IsNullOrEmpty(ProcessId)) { continue; } int.TryParse(ProcessId, out ProcessID); break; // break at first non null process string } } else { Logger.Warning(string.Format("No running process(es) found that matches the path {0} on device '{1}'!", DeviceDeploymentPath, Address)); } } catch (Exception e) { Logger.Warning(string.Format("[GetProcessIdUsingProjectName] Failed to get process id for process '{0}' on Linux device '{1}'. {2}. {3}. {4}. Ex: {5}", GetLinuxDedicatedProcessName(), Address, ReturnValue, LogInfo, LogError, e.Message)); } return(ProcessID); }
public static void ConvertMusic(string input, string output, string q, string tracker) { string bat = string.Format("{0} {3}: {1} -q {2}", input, q, output, tracker); ProcessCmd.Run(Eac3toExecute, bat); }
public static void MkvMux(string vedio, string outfile) { string Arguments = $"--output {outfile.Maohao()} ( { vedio.Maohao()} )"; ProcessCmd.Run(MkvMergeExcute, Arguments); }
//分离音频文件 public static void DemuxAudio(string vedio, string output) { ProcessCmd.Run(FFmpegExecute, string.Format(" -i {0} -acodec copy -vn {1} ", vedio.Maohao(), output.Maohao())); }