예제 #1
0
        private void GenerateVorschau(bool von)
        {
            if (this.IsInitialized == false) { return; }

            Zeitpunkt zp = new Zeitpunkt();
            if (von)
            {
                zp.setAll(sstartzeit.Value);
            }
            else {
                zp.setAll(sstartzeit.Value + slaenge.Value);
            }

            lastZP = zp;
            GenerateVorschauName();

            if (tmpvorlage == null || isTemplateOld()) {
                setTempVorlage();
            }

            if (CheckIfInFrame() == false) {
                return;
            }

            if (File.Exists(strVorschauPfad + tmpvorlage.strName + lastZP.pathString() + strVorschaubild))
            {
                setImage();
            }
            else {
                BackgroundWorker ba = new BackgroundWorker();
                ba.DoWork += new DoWorkEventHandler(CreateNewVorschau);
                ba.RunWorkerAsync();
            }
        }
예제 #2
0
        private void CreateExportWorker(object sender, EventArgs e)
        {
            try
            {
                System.Diagnostics.Process p = new System.Diagnostics.Process();
                p.StartInfo.FileName = "ffmpeg.exe";

                Zeitpunkt startZP = new Zeitpunkt();
                startZP.setAll(exportStart);
                Zeitpunkt bisZP = new Zeitpunkt();
                bisZP.setAll(exportLaenge);

                strOutputFile = PfadAufraeumen(System.IO.Path.GetFileNameWithoutExtension(strInputFile) + "_" + startZP.pathString() + "_" + bisZP.pathString());
                //-fs 1000000
                p.StartInfo.Arguments = "-ss " + startZP.ToString() + " -i \"" + strInputFile + "\" -sn -c:v libvpx";
                if (tmpvorlage.imaxfilesize > 0) {
                    p.StartInfo.Arguments += " -fs " + (tmpvorlage.imaxfilesize * 1000000);
                }
                if (tmpvorlage.baudioaus == true) {
                    p.StartInfo.Arguments += " -an";
                }
                p.StartInfo.Arguments += " -crf " + tmpvorlage.icrf + " -qmin " + tmpvorlage.iqmin + " -qmax " + tmpvorlage.iqmax;
                if (tmpvorlage.icropbreite > 0 && tmpvorlage.icrophoehe > 0)
                {
                    p.StartInfo.Arguments += " -vf \"[in]scale=" + tmpvorlage.ibreite + ":" +
                    tmpvorlage.ihoehe + "[middle];[middle]crop=" + tmpvorlage.icropbreite + ":" + tmpvorlage.icrophoehe + ":" +
                    tmpvorlage.icropx + ":" + tmpvorlage.icropy + "[out]\"";
                }
                else {
                    p.StartInfo.Arguments += " -vf \"scale=" + tmpvorlage.ibreite + ":" + tmpvorlage.ihoehe + "\"";
                }
                p.StartInfo.Arguments += " -to " + bisZP.ToString() + " -y \"" + strOutputFile + ".webm\"";

                lsFfmpegLog.Add(p.StartInfo.FileName + " " + p.StartInfo.Arguments);

                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.CreateNoWindow = true;
                p.StartInfo.WorkingDirectory = AppDomain.CurrentDomain.BaseDirectory;
                p.Start();

                p.WaitForExit();
                this.Dispatcher.BeginInvoke(new Action(() => gridContent.IsEnabled = true));
                this.Dispatcher.BeginInvoke(new Action(() => gridContentBlurEffekt.Radius = 0));
                this.Dispatcher.BeginInvoke(new Action(() => gridLoading.Visibility = Visibility.Collapsed));
            }
            catch { MessageBox.Show("Fehler beim encoden des Videos.", "Vorgang abgebrochen", MessageBoxButton.OK, MessageBoxImage.Error);  }
        }