示例#1
0
        static void AddSound(int ToFolder, int FormFolder)
        {
            try
            {
                //thrdSleep(30);
                CodeFFMPEG code = new CodeFFMPEG();
                for (int i = ToFolder; i < FormFolder; i++)
                {
Jump:
                    if (i == FormFolder)
                    {
                        break;
                    }
                    if (File.Exists($"C:\\RACC\\Data\\Video{i}\\Image\\VideoSound.mp4"))
                    {
                        i++;
                        Console.WriteLine("\n Đã hoàn thành Video:" + i + " OK");
                        goto Jump;
                    }
                    AddSoundManhua(i);
                    bool check    = false;
                    int  SolanLap = 0;
                    do
                    {
                        if (File.Exists("C:\\RACC\\Data\\Video" + i + "\\Image\\VideoSound.mp4"))
                        {
                            Console.WriteLine("\n Đã hoàn thành Video:" + i + " OK");
                            check = true;
                            Delete(ToFolder, FormFolder);
                        }
                        SolanLap++;
                        if (SolanLap == 3)
                        {
                            goto videoError;
                        }
                        //  Thread.Sleep(13500);
                        thrdSleep(20);
                    } while (!check);
                    videoError :;
                }
            }
            catch (Exception)
            {
            }
        }
示例#2
0
        static void AddSound(int To, int From)
        {
            try
            {
                //thrdSleep(30);
                CodeFFMPEG code = new CodeFFMPEG();
                for (int i = To; i < From; i++)
                {
Jump:
                    if (i == From)
                    {
                        break;
                    }
                    if (File.Exists("C:\\RACC\\Data\\Video" + (i) + "\\Image\\VideoSound.mp4"))
                    {
                        i++;
                        Console.WriteLine("\n Success VideoSound:" + i + " OK");
                        goto Jump;
                    }
                    code.Add_Sound(i);
                    bool check    = false;
                    int  SolanLap = 0;
                    do
                    {
                        if (File.Exists("C:\\RACC\\Data\\Video" + i + "\\Image\\VideoSound.mp4"))
                        {
                            Console.WriteLine("\n Success VideoSound1:" + i + " OK");
                            check = true;
                        }
                        SolanLap++;
                        if (SolanLap == 3)
                        {
                            goto videoError;
                        }
                        //  Thread.Sleep(13500);
                        thrdSleep(20);
                    } while (!check);
                    videoError :;
                }
            }
            catch (Exception)
            {
            }
        }
示例#3
0
        // chia 3 giai đoạn
        //1. each image => video single
        //2. join video single => video total => delete video single
        //3. Add  sound free


        static void Render_Video_Single(int ToFolder, int FormFolder)
        {
            CodeFFMPEG code = new CodeFFMPEG();

            try
            {
                for (int k = ToFolder; k < FormFolder; k++)
                {
Jump:
                    if (k == FormFolder)
                    {
                        break;
                    }
                    if (File.Exists($"C:\\RACC\\Data\\Video{k}\\Image\\VideoImage.mp4"))
                    {
                        k++;
                        Console.WriteLine("\n Da hoan thanh video :" + k + " OK");
                        goto Jump;
                    }

                    int        time    = 20;
                    int        speed   = 70;
                    List <int> listImg = new List <int>();
                    listImg = countImg(k);
                    ///  // truyền vào thư mục videox và số ảnh
                    Edit_Image.Convert_1280x(k, listImg);

                    thrdSleep(10);
                    code.Render_Video_Manhua(k, listImg, time, speed);
                    Console.WriteLine($"Render success video{k}");
                    thrdSleep(10);

                    code.Join_Video_Manhua(k, listImg);
                }
            }
            catch
            {
            }
        }
示例#4
0
        static void Render_Span(int ToFolder, int FormFolder)
        {
            try
            {
                CodeFFMPEG code = new CodeFFMPEG();


                Process          process   = new Process();
                ProcessStartInfo startInfo = new ProcessStartInfo();
                startInfo.WindowStyle      = ProcessWindowStyle.Hidden;
                startInfo.WorkingDirectory = string.Format(@"C:\RACC");
                startInfo.FileName         = "copy.bat";
                process.StartInfo          = startInfo;
                process.Start();
                process.Close();

                #region Edit Image
                #region Xử lý video0
                try
                {
                    if (!File.Exists(string.Format(@"C:\RACC\Data\Video0\Image\image1.jpg")))
                    {
                        Edit_Image.Convert_All_Jpg(0);
                        Thread.Sleep(5000);
                        Edit_Image.Keep_Origin_Image(0);
                        File.Delete(@"C:\RACC\Data\Video0\Image\image.jpg");
                    }
                }
                catch (Exception)
                {
                }

                #endregion

                for (int i = ToFolder; i < FormFolder; i++)
                {
                    if (File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\image1.jpg", FormFolder - 1)))
                    {
                        break;
                    }
jump:
                    if (i >= FormFolder)
                    {
                        break;
                    }
                    try
                    {
                        if (File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\image1.jpg", i)))
                        {
                            i++;
                            goto jump;
                        }
                        Edit_Image.Convert_All_Jpg(i);
                        Thread.Sleep(1000);

                        Edit_Image.Keep_Origin_Image(i);
                        string path = string.Format(@"C:\RACC\Data\Video{0}\Image\image.jpg", i);

                        File.Delete(path);

                        Thread.Sleep(1000);
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("Không xử lý đk ảnh thứ : " + i);
                    }
                    Thread.Sleep(1000);
                }

                #endregion

                #region Code trong theard

                for (int k = ToFolder; k < FormFolder; k++)
                {
Jump:

                    if (k >= FormFolder)
                    {
                        break;
                    }
                    #region Kiểm tra File tồn tại và xử lý chuỗi input

                    // nếu file đã được tạo thì pass qua
                    if (File.Exists("C:\\RACC\\Data\\Video" + (k) + "\\Image\\VideoImage.mp4"))
                    {
                        Console.WriteLine("\n Đã hoàn thành Video:" + k + " OK");
                        k++;
                        goto Jump;
                    }

                    Standardize_The_String.English(k);


                    #endregion
                    #region Hàm code
                    if (!File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\1.jpg", k)))
                    {
                        if (!File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\2.jpg", k)))
                        {
                            Edit_Image.Change_Image_Name(k);
                            // Thread.Sleep(1000);
                            Thread.Sleep(5000);
                        }
                    }

                    if (!File.Exists(string.Format(@"C:\RACC\Data\Video{0}\Image\TotalMusic.mp3", k)))
                    {
                        TextToSpeech.Start(k, "span");
                        // Thread.Sleep(1000);
                        Thread.Sleep(3000);
                        code.Join_Voice(k);
                        // Thread.Sleep(1000);
                        Thread.Sleep(2000);
                    }

                    try
                    {
                        code.Create_Video(k);
                    }
                    catch (Exception)
                    {
                        goto ketthuc;
                    }

                    #endregion


                    bool check    = false;
                    int  SolanLap = 0;
                    do
                    {
                        if (File.Exists("C:\\RACC\\Data\\Video" + k + "\\Image\\VideoImage.mp4"))
                        {
                            Console.WriteLine("\n Đã hoàn thành Video:" + k + " OK");
                            check = true;
                        }
                        SolanLap++;
                        if (SolanLap == 2)
                        {
                            goto ketthuc;
                        }
                        Thread.Sleep(5000);
                    } while (!check);

ketthuc:
                    #region Create Thumb
                    Create_Thumbnail.Origin(k);
                    #endregion
                }

                #endregion
            }
            catch (Exception)
            {
            }
        }
示例#5
0
        static void Render_VideoSound1_Span(int ToFolder, int FormFolder)
        {
            try
            {
                thrdSleep(5);
                CodeFFMPEG code = new CodeFFMPEG();



                #region Code Japan Video

                for (int k = ToFolder; k < FormFolder; k++)
                {
                    #region Check
Jump1:
                    if (k >= FormFolder)
                    {
                        break;
                    }

                    if (File.Exists("C:\\RACC\\Data\\Video" + (k) + "\\Image\\VideoSound1.mp4"))
                    {
                        k++;
                        Console.WriteLine("\n Đã hoàn thành Video:" + k + " OK");
                        goto Jump1;
                    }

                    #endregion

                    #region Code
                    Standardize_The_String.English(k);
                    try
                    {
                        code.Span_Video(k);
                    }
                    catch (Exception)
                    {
                        Console.WriteLine(string.Format("Có lỗi khi render video: {0} : Bỏ qua và tiếp tục làm video khác", k));
                        k++;
                        goto Jump1;
                    }

                    // Thread.Sleep(18000);
                    thrdSleep(50);

                    bool check    = false;
                    int  SoLanLap = 0;
                    do
                    {
                        if (File.Exists("C:\\RACC\\Data\\Video" + k + "\\Image\\VideoSound1.mp4"))
                        {
                            Console.WriteLine("\n Đã hoàn thành Video:" + k + " OK");
                            check = true;
                        }
                        SoLanLap++;
                        if (SoLanLap == 3)
                        {
                            goto Video_Error;
                        }

                        Thread.Sleep(2000);
                    } while (!check);
                    Video_Error :;
                    #endregion
                }

                #endregion
            }
            catch (Exception)
            {
            }
        }
示例#6
0
        static void Render_VideoSound1(int ToFolder, int FormFolder)
        {
            try
            {
                thrdSleep(5);
                CodeFFMPEG code = new CodeFFMPEG();


                #region Code china Video

                for (int k = ToFolder; k < FormFolder; k++)
                {
                    #region Check
Jump1:
                    if (k >= FormFolder)
                    {
                        break;
                    }

                    if (File.Exists("C:\\RACC\\Data\\Video" + (k) + "\\Image\\VideoSound1.mp4"))
                    {
                        k++;
                        Console.WriteLine("\n Success VideoSound1:" + k + " OK");
                        goto Jump1;
                    }
                    #endregion

                    #region Code

                    try
                    {
                        Create_VideoSound1(k);
                    }
                    catch (Exception)
                    {
                        Console.WriteLine(string.Format("Error VideoSound1: {0}", k));
                        k++;
                        goto Jump1;
                    }

                    // Thread.Sleep(18000);
                    thrdSleep(50);

                    bool check    = false;
                    int  SoLanLap = 0;
                    do
                    {
                        if (File.Exists("C:\\RACC\\Data\\Video" + k + "\\Image\\VideoSound1.mp4"))
                        {
                            Console.WriteLine("\n Success VideoSound1:" + k + " OK");
                            check = true;
                        }
                        SoLanLap++;
                        if (SoLanLap == 3)
                        {
                            goto Video_Error;
                        }

                        Thread.Sleep(2000);
                    } while (!check);
                    Video_Error :;
                    #endregion
                }

                #endregion
            }
            catch (Exception)
            {
            }
        }