Beispiel #1
0
        private static bool StartRendering(Job job)
        {
            string parameters = JobPathHelper.GetDeadlineJobFile(job);

            parameters += " " + Settings.LocalFusionPluginPath;
            parameters += " " + JobPathHelper.GetJobCompPath(job);

            VCProcess process = new VCProcess(job);

            process.StartInfo.FileName               = Settings.LocalDeadlineExePath;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardError  = true;
            process.StartInfo.RedirectStandardOutput = true;
            process.StartInfo.Arguments              = parameters;
            process.EnableRaisingEvents              = true;
            process.StartInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Minimized;

            process.Execute();
            string output = process.StandardOutput.ReadToEnd();

            job.RenderID = RenderIDParser.Parse(output);
            process.WaitForExit();
            process.Close();

            return(job.RenderID != null);
        }
        private bool JoinClips()
        {
            string cmd = "-y -loglevel panic -safe 0 -f concat -i " + ProductionPathHelper.GetClipListPath(production) + " -c copy -an ";

            cmd += ProductionPathHelper.GetFullMp4Path(production);

            VCProcess ConcatenateProcess = new VCProcess(production);

            ConcatenateProcess.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            ConcatenateProcess.StartInfo.CreateNoWindow         = true;
            ConcatenateProcess.StartInfo.UseShellExecute        = false;
            ConcatenateProcess.StartInfo.RedirectStandardError  = false;
            ConcatenateProcess.StartInfo.RedirectStandardOutput = false;
            ConcatenateProcess.StartInfo.Arguments              = cmd;
            bool success = ConcatenateProcess.Execute();

            if (success)
            {
                ConcatenateProcess.WaitForExit();
            }

            if (!File.Exists(ProductionPathHelper.GetFullMp4Path(production)))
            {
                FireFailureEvent(ProductionErrorStatus.PES_JOIN_CLIPS);
                return(false);
            }
            else
            {
                return(true);
            }
        }
        private string TrimDicativeFile(Job job)
        {
            //\\IBT-DATA\virtualcampaign\tools\ffmpeg64_cuda\bin\ffmpeg.exe -y -loglevel panic -i \\IBT-DATA\virtualcampaign\data\products\0087\0087.wav -t 19.11 \\SERVER-A\render_temp\productions\virtualcampaign\8270\test.wav
            string sourceFilePath = ProductionPathHelper.GetProductAudioPath(job.ProductID);
            string targetFilePath = Path.Combine(ProductionPathHelper.GetLocalProductionDirectory(production), Path.GetFileName(sourceFilePath));

            string secondsString = $"{Math.Floor(job.FrameCount / 25f)}";
            string framesString  = $"{job.FrameCount % 25}";
            string lengthString  = $"{secondsString}.{framesString}";

            string cmd = $"-y -loglevel panic -i {sourceFilePath} -t {lengthString} {targetFilePath}";

            VCProcess MusicProcess = new VCProcess(production);

            MusicProcess.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            MusicProcess.StartInfo.CreateNoWindow         = true;
            MusicProcess.StartInfo.UseShellExecute        = false;
            MusicProcess.StartInfo.RedirectStandardError  = false;
            MusicProcess.StartInfo.RedirectStandardOutput = false;
            MusicProcess.EnableRaisingEvents              = true;
            MusicProcess.StartInfo.Arguments              = cmd;
            bool success = MusicProcess.Execute();

            return(targetFilePath);
        }
        public static bool Extract(Job job, Motif motif)
        {
            IOHelper.CreateDirectory(JobPathHelper.GetLocalJobAnimatedMotifDiretory(job.Production, motif));

            string sourcePath = JobPathHelper.GetLocalJobMotifPath(job, motif);
            string targetPath = Path.Combine(JobPathHelper.GetLocalJobAnimatedMotifDiretory(job.Production, motif), @"motif_F%04d.tga");

            string parameters = "-i " + sourcePath + " " + targetPath;

            VCProcess process = new VCProcess(job);

            process.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            process.StartInfo.Arguments              = parameters;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardError  = false;
            process.StartInfo.RedirectStandardOutput = false;
            process.StartInfo.WindowStyle            = System.Diagnostics.ProcessWindowStyle.Hidden;
            process.Execute();
            process.WaitForExit();

            motif.Frames = Directory.GetFiles(JobPathHelper.GetLocalJobAnimatedMotifDiretory(job.Production, motif), "*.tga").Length;
            //motif.Extension = ".tga";

            return(motif.Frames > 0);
        }
        private static void Encode(Job job, string parameters)
        {
            VCProcess ConcatenateProcess = new VCProcess(job);

            ConcatenateProcess.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            ConcatenateProcess.StartInfo.CreateNoWindow         = true;
            ConcatenateProcess.StartInfo.UseShellExecute        = false;
            ConcatenateProcess.StartInfo.RedirectStandardError  = false;
            ConcatenateProcess.StartInfo.RedirectStandardOutput = false;
            ConcatenateProcess.StartInfo.Arguments              = parameters;
            ConcatenateProcess.Execute();
            ConcatenateProcess.WaitForExit();
            ConcatenateProcess.Close();
        }
Beispiel #6
0
        public static void DeleteJob(Job job)
        {
            VCProcess suspendProcess = new VCProcess(job);

            string arguments = "-deletejob " + job.RenderID;

            suspendProcess.StartInfo.FileName               = Settings.LocalDeadlineExePath;
            suspendProcess.StartInfo.CreateNoWindow         = true;
            suspendProcess.StartInfo.UseShellExecute        = false;
            suspendProcess.StartInfo.RedirectStandardError  = false;
            suspendProcess.StartInfo.RedirectStandardOutput = false;
            suspendProcess.StartInfo.Arguments              = arguments;
            suspendProcess.EnableRaisingEvents              = false;
            suspendProcess.Execute();
        }
        private bool CreateTrimmedMusic()
        {
            int durationInSeconds = 0;

            if (production.HasSpecialIntroMusic)
            {
                durationInSeconds = production.ClipDurationInSeconds;
            }
            else
            {
                durationInSeconds = production.TotalDurationInSeconds;
            }

            if (durationInSeconds == 0)
            {
                FireFailureEvent(ProductionErrorStatus.PES_CALCULATE_DURATION);
                return(false);
            }

            string cmd = "-y -loglevel panic -i " + audioData.AudioPath + " -t " + durationInSeconds + " " + ProductionPathHelper.GetTrimmedMusicPath(production);

            VCProcess MusicProcess = new VCProcess(production);

            MusicProcess.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            MusicProcess.StartInfo.CreateNoWindow         = true;
            MusicProcess.StartInfo.UseShellExecute        = false;
            MusicProcess.StartInfo.RedirectStandardError  = false;
            MusicProcess.StartInfo.RedirectStandardOutput = false;
            MusicProcess.EnableRaisingEvents              = true;
            MusicProcess.StartInfo.Arguments              = cmd;
            bool success = MusicProcess.Execute();

            if (success)
            {
                MusicProcess.WaitForExit();
            }

            if (!File.Exists(ProductionPathHelper.GetTrimmedMusicPath(production)))
            {
                FireFailureEvent(ProductionErrorStatus.PES_MUX_AUDIO);
                return(false);
            }
            else
            {
                return(true);
            }
        }
Beispiel #8
0
        private void EncodeFilm(string parameters)
        {
            VCProcess process = new VCProcess(production);

            process.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            process.StartInfo.Arguments              = parameters;
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardError  = false;
            process.StartInfo.RedirectStandardOutput = false;
            bool success = process.Execute();

            if (success)
            {
                process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                process.WaitForExit();
            }
        }
Beispiel #9
0
        private bool EncodeFilms()
        {
            if (production.IsPreview)
            {
                return(true);
            }

            bool result = true;

            VCProcess process = new VCProcess(production);

            process.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            process.StartInfo.Arguments              = GetParameterString();
            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardError  = false;
            process.StartInfo.RedirectStandardOutput = false;

            bool success = process.Execute();

            if (success)
            {
                process.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                process.WaitForExit();
            }

            //check if all films have been created
            foreach (FilmOutputFormat format in production.Film.FilmOutputFormatList)
            {
                if (format.ID != 20)
                {
                    string filepath = FilmPathHelper.GetFilmHashPath(production, format);
                    if (!File.Exists(filepath))
                    {
                        FireFailureEvent(ProductionErrorStatus.PES_ENCODE_PRODUCTION);
                        result = false;
                        break;
                    }
                }
            }

            return(result);
        }
        private void ResizeDicative(Job thisJob, FilmOutputFormat codecFormat)
        {
            string formattedIndex = String.Format("{0:D4}", thisJob.ProductID);
            string sourcePath     = ProductionPathHelper.GetProductMp4Path(thisJob.ProductID);
            string targetPath     = ProductionPathHelper.GetProductMp4PathByOutputFormat(thisJob.ProductID, codecFormat.ID);

            string cmd = "-y -loglevel panic -i " + sourcePath + " -s " + codecFormat.Width + "x" + codecFormat.Height + " -c:v libx264 -pix_fmt yuv420p -preset ultrafast -qp 19 " + targetPath;

            VCProcess ConcatenateProcess = new VCProcess(production);

            ConcatenateProcess.StartInfo.FileName               = Settings.LocalFfmpegExePath;
            ConcatenateProcess.StartInfo.CreateNoWindow         = true;
            ConcatenateProcess.StartInfo.UseShellExecute        = false;
            ConcatenateProcess.StartInfo.RedirectStandardError  = false;
            ConcatenateProcess.StartInfo.RedirectStandardOutput = false;
            ConcatenateProcess.StartInfo.Arguments              = cmd;
            ConcatenateProcess.Execute();
            ConcatenateProcess.WaitForExit();
        }