Beispiel #1
0
        private static void AddAudioSourceFromOption(string[] option, VideoEditCore core)
        {
            AudioSource src;

            if (option.Length == 2)
            {
                src = new AudioSource(
                    option[0],
                    new[] { new FileSegment(null, null) });
            }
            else
            {
                src = new AudioSource(
                    option[0],
                    new[] { new FileSegment(TimeSpan.FromMilliseconds(Convert.ToInt32(option[2])), TimeSpan.FromMilliseconds(Convert.ToInt32(option[3]))) });
            }

            if (option.Length == 2)
            {
                core.Input_AddAudioFile(src);
            }
            else
            {
                core.Input_AddAudioFile(src, TimeSpan.FromMilliseconds(Convert.ToInt32(option[4])));
            }
        }
Beispiel #2
0
        private static void AddAudioSourceFromOption(string[] option, VideoEditCore core)
        {
            VFVEAudioSource src;

            if (option.Length == 2)
            {
                src = new VFVEAudioSource(
                    option[0],
                    new[] { new VFVEFileSegment(-1, -1) });
            }
            else
            {
                src = new VFVEAudioSource(
                    option[0],
                    new[] { new VFVEFileSegment(Convert.ToInt32(option[2]), Convert.ToInt32(option[3])) });
            }

            if (option.Length == 2)
            {
                core.Input_AddAudioFile(src);
            }
            else
            {
                core.Input_AddAudioFile(src, Convert.ToInt32(option[4]));
            }
        }
Beispiel #3
0
        public ActionResult StartConvertClick()
        {
            var sourceFile     = Session["UploadedFile"].ToString();
            var sourceFileFull = Path.Combine(Server.MapPath("~/Data/"), sourceFile);

            ViewBag.Message = $"Converting... ({sourceFile})";

            _core             = new VideoEditCore();
            _core.OnError    += _core_OnError;
            _core.OnProgress += _core_OnProgress;
            _core.Input_AddVideoFile(sourceFileFull);
            _core.Input_AddAudioFile(sourceFileFull, sourceFileFull);
            _core.Mode            = VFVideoEditMode.Convert;
            _core.Output_Format   = new VFMP4v8v10Output();
            _core.Output_Filename = Server.MapPath("~/Data/output.mp4");

            _core.ConsoleUsage = true;

            _core.Start();

            _core.Dispose();

            return(RedirectToAction("Download", new { filename = "output.mp4" }));
        }