Exemple #1
0
    static string GenerateMovFile(Job job, string path, int startFrame, int CountOfFrames)
    {
        if (job.Id == 10)
        {
        }
        string filemask = Path.GetFileNameWithoutExtension(path);

        filemask = filemask.Substring(0, filemask.Length - 4);
        string OutputMov = RenderTask.GetServerPreviewFileNameByOriginalFileName(filemask);

        path = path.Substring(0, path.Length - 8) + "%04d.jpg ";       //-vframes "+(job.MaximumFrameRendered-job.MinimumFrameRendered+1)

        string offset = " -start_number " + job.MinimumFrameRendered;

        OutputMov = (OutputMov.Substring(0, OutputMov.Length - 3)) + ".mov ";
        path      = " -i " + path + " " + job.ServerPreviewMovFilePath;
        string tmp = offset + path + " -y ";

        Program.RunFFMpeg(tmp);
        Console.WriteLine("Mov: " + job.RenderPath);



        return(null);
    }
Exemple #2
0
    static void TryParseOtherFrames(Job joba)
    {
        int z = 0;

        Console.WriteLine("\n Проверяем джобу номер: " + joba.Id.ToString() + " файлов в папке:  " + joba.ExistingFiles.Length + ":   ");

        for (int j = 0; j < joba.ExistingFiles.Length; j++)
        {
            //if (File.Exists(RenderTask.GetServerPreviewFileNameByOriginalFileName(joba.ExistingFiles[j],joba)))
            if (Tools.FilesEqual(joba.ExistingFiles[j], RenderTask.GetServerPreviewFileNameByOriginalFileName(joba.ExistingFiles[j], joba)))
            {
                Console.Write("*");
            }
            else
            {
                Thread newThread = new Thread(Program.RunOperation);
                Console.Write("Запускаем поток: " + z++);

                Program.GenerateFromToFFmpegJpg(joba.ExistingFiles[j], joba);


                newThread.Start(Program.GenerateFromToFFmpegJpg(joba.ExistingFiles[j], joba));

                Tools.ClearCurrentConsoleLine();
            }
        }
    }
Exemple #3
0
    public static string GenerateFromToFFmpegJpg(string OriginalFilename, Job Joba)
    {
        string FrameStamp = " -vf \"drawtext=fontfile=Arial.ttf: text='Frame\\:%{frame_num}': start_number=" + OriginalFilename.Substring(OriginalFilename.Length - 8, 4) + ": x=0: y=h-(1*lh): fontcolor=black: fontsize=100: box=1: boxcolor=white: boxborderw=25\" ";
        string tmp        = " -i  " + OriginalFilename + FrameStamp + " -s 640:360 " + "-y " + RenderTask.GetServerPreviewFileNameByOriginalFileName(OriginalFilename, Joba);

        //  Console.WriteLine("\nFFMPEG:  " + tmp + "\n");
        return(tmp);
    }
Exemple #4
0
    /*  static string GenerateMov(Job job)
     * {
     *      string offset = " -start_number " + job.MinimumFrameRendered;
     *
     *
     *      // -vf scale = 320:-1 "- vf scale = 320:-1, "+ + GammaCorretion + job.Id.ToString()+"_"
     *      string tmp = offset + " -i  " +job.RenderNameMask+"%04d" + "-y " + job.ServerPreviewMovFilePath;
     *      Console.WriteLine("\nFFMPEG:  " + tmp + "\n");
     *      _ = Program.RunFFMpeg(tmp);
     *      return tmp;
     * }*/

    static void CheckSequence(Job job)
    {
        if (job.Id == 2)
        {
        }
        int SequenceCounter = 0;

        foreach (var item in job.ExistingFiles)
        {
            int framenumber = RenderTask.GetFrameNumberFromFileName(item);
            if (framenumber < 100000)
            {
                if (job.MaximumFrameRendered < framenumber)
                {
                    job.MaximumFrameRendered = framenumber;
                }
                if (job.MinimumFrameRendered > framenumber)
                {
                    job.MinimumFrameRendered = framenumber;
                }
            }
        }
        job.FramesMissed = new List <string>();
        job.MovRendered  = false;
        string Frame = "";


        if (job.Id == 3)
        {
        }
        for (int j = job.MinimumFrameRendered; j <= job.MaximumFrameRendered; j++)
        {
            Frame = j.ToString();
            if (Frame.Length == 1)
            {
                Frame = "000" + Frame;
            }
            if (Frame.Length == 2)
            {
                Frame = "00" + Frame;
            }
            if (Frame.Length == 3)
            {
                Frame = "0" + Frame;
            }
            string tempFrameId = Frame;
            Frame = RenderTask.GetServerPreviewFileNameByOriginalFileName(job.RenderNameMask + Frame + ".jpg", job);


            // проверка  на новизну ебаную
            if (File.Exists(Frame))
            {
                SequenceCounter++;
            }



            else
            {
                job.FramesMissed.Add(Frame.Substring(Frame.Length - 8, 4));
                Program.GenerateFromMissedToServerPreviewFrame(job, Frame);
                SequenceCounter++;

                /*
                 * if (  job.MovRendered==false)
                 * {
                 *      if (job.LastMovFramesCounter != j)
                 *      {
                 *              Console.WriteLine("\nGenerating MOV: "+ job.Id+" " + job.MinimumFrameRendered.ToString() + "-" + job.MaximumFrameRendered.ToString());
                 *
                 *               GenerateMovFile(job, Frame, job.MinimumFrameRendered, j);
                 *              job.MovRendered = true;
                 *              job.LastMovFramesCounter = j;
                 *      }
                 *      else
                 *      {
                 *              Console.WriteLine("\nПропускаем MOV, так как число файлов не изменилось\n");
                 *      }
                 * }
                 *
                 */
            }
            if (SequenceCounter >= (job.MaximumFrameRendered - job.MinimumFrameRendered))
            {
                job.MovRendered = true;
                GenerateMovFile(job, Frame, job.MinimumFrameRendered, j);
            }
        }
        Console.WriteLine("Пропущенных кадров: " + job.FramesMissed.Count);
    }