Exemplo n.º 1
0
 public VideoEditionProperties()
 {
     this.Build();
     encSettings = new EncodingSettings();
     FillVideoStandards();
     FillEncodingProfiles();
 }
Exemplo n.º 2
0
        void RenderPlay(Project project, Play play, MediaFile file)
        {
            PlayList         playlist;
            EncodingSettings settings;
            EditionJob       job;
            string           outputDir, outputFile;

            if (Config.AutoRenderDir == null ||
                !Directory.Exists(Config.AutoRenderDir))
            {
                outputDir = Config.VideosDir;
            }
            else
            {
                outputDir = Config.AutoRenderDir;
            }

            outputFile = String.Format("{0}-{0}.mp4", play.Category.Name, play.Name);
            outputFile = Path.Combine(outputDir, project.Description.Title, outputFile);
            try {
                Directory.CreateDirectory(Path.GetDirectoryName(outputFile));
                settings = EncodingSettings.DefaultRenderingSettings(outputFile);
                playlist = new PlayList();
                playlist.Add(new PlayListPlay(play, file, true));

                job = new EditionJob(playlist, settings);
                renderer.AddJob(job);
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
Exemplo n.º 3
0
        void RemuxOutputFile(EncodingSettings settings)
        {
            VideoMuxerType muxer;

            /* We need to remux to the original format */
            muxer = settings.EncodingProfile.Muxer;
            if (muxer == VideoMuxerType.Avi || muxer == VideoMuxerType.Mp4)
            {
                string outFile = settings.OutputFile;
                string tmpFile = settings.OutputFile;

                while (System.IO.File.Exists(tmpFile))
                {
                    tmpFile = tmpFile + ".tmp";
                }

                System.IO.File.Move(outFile, tmpFile);
                Remuxer remuxer = new Remuxer(PreviewMediaFile.DiscoverFile(tmpFile),
                                              outFile, muxer);

                /* Remuxing suceed, delete old file */
                if (remuxer.Remux(this.Toplevel as Gtk.Window) == outFile)
                {
                    System.IO.File.Delete(tmpFile);
                }
                else
                {
                    System.IO.File.Delete(outFile);
                    System.IO.File.Move(tmpFile, outFile);
                }
            }
        }
 internal FileTransmitterEncoderBuilder(FluentJdfLibrary fluentJdfLibrary, EncodingSettings encodingSettings, FileTransmitterEncoder encoder)
     : base(fluentJdfLibrary) {
     ParameterCheck.ParameterRequired(encodingSettings, "encodingSettings");
     this.fluentJdfLibrary = fluentJdfLibrary;
     this.encodingSettings = encodingSettings;
     this.encoder = encoder;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes wrapper on a target executable using given working directory and encoding.
        /// </summary>
        /// <param name="filePath">File path of the target executable.</param>
        /// <param name="workingDirectory">Target executable's working directory.</param>
        /// <param name="encodingSettings">Encodings to use for input/output streams.</param>
        public Cli(string filePath, string workingDirectory, EncodingSettings encodingSettings)
        {
            FilePath         = filePath.GuardNotNull(nameof(filePath));
            WorkingDirectory = workingDirectory.GuardNotNull(nameof(workingDirectory));
            EncodingSettings = encodingSettings.GuardNotNull(nameof(encodingSettings));

            _killSwitchCts = new CancellationTokenSource();
        }
Exemplo n.º 6
0
 public VideoEditionProperties()
 {
     this.Build();
     encSettings = new EncodingSettings();
     stdStore    = Misc.FillImageFormat(sizecombobox, Config.RenderVideoStandard);
     encStore    = Misc.FillEncodingFormat(formatcombobox, Config.RenderEncodingProfile);
     qualStore   = Misc.FillQuality(qualitycombobox, Config.RenderEncodingQuality);
 }
Exemplo n.º 7
0
        public List <EditionJob> ConfigureRenderingJob(IPlayList playlist)
        {
            VideoEditionProperties vep;
            List <EditionJob>      jobs = new List <EditionJob>();
            int response;

            if (playlist.Count == 0)
            {
                WarningMessage(Catalog.GetString("The playlist you want to render is empty."));
                return(null);
            }

            vep = new VideoEditionProperties();
            vep.TransientFor = mainWindow as Gtk.Window;
            response         = vep.Run();
            while (response == (int)ResponseType.Ok)
            {
                if (!vep.SplitFiles && vep.EncodingSettings.OutputFile == "")
                {
                    WarningMessage(Catalog.GetString("Please, select a video file."));
                    response = vep.Run();
                }
                else if (vep.SplitFiles && vep.OutputDir == "")
                {
                    WarningMessage(Catalog.GetString("Please, select an output directory."));
                    response = vep.Run();
                }
                else
                {
                    break;
                }
            }
            if (response == (int)ResponseType.Ok)
            {
                if (!vep.SplitFiles)
                {
                    jobs.Add(new EditionJob(playlist, vep.EncodingSettings));
                }
                else
                {
                    int i = 0;
                    foreach (PlayListPlay play in playlist)
                    {
                        EncodingSettings settings = vep.EncodingSettings;
                        PlayList         pl       = new PlayList();
                        string           filename = String.Format("{0}-{1}.{2}", i.ToString("d4"), play.Name,
                                                                  settings.EncodingProfile.Extension);

                        pl.Add(play);
                        settings.OutputFile = Path.Combine(vep.OutputDir, filename);
                        jobs.Add(new EditionJob(pl, settings));
                        i++;
                    }
                }
            }
            vep.Destroy();
            return(jobs);
        }
Exemplo n.º 8
0
        public void AudioSettings_DisableAudio(string argument)
        {
            var encodingSettings = EncodingSettings.CreateAudioSettings(EncodingSettings.CodecEnum.None, EncodingSettings.RateControlEnum.Remove, 0);

            Assert.That(encodingSettings.GetArgument(), Does.Contain(argument));

            Console.Out.WriteLine("Generated argument");
            Console.Out.WriteLine(encodingSettings.GetArgument());
        }
Exemplo n.º 9
0
        public void AudioSettings_Acc(string argument)
        {
            var encodingSettings = EncodingSettings.CreateAudioSettings(EncodingSettings.CodecEnum.Aac, EncodingSettings.RateControlEnum.ConstantBitRate, value: 128);

            Assert.That(encodingSettings.GetArgument(), Does.Contain(argument));

            Console.Out.WriteLine("Generated argument");
            Console.Out.WriteLine(encodingSettings.GetArgument());
        }
Exemplo n.º 10
0
        public void VideoSettings_StreamCopy(string argument)
        {
            var encodingSettings = EncodingSettings.CreateVideoSettings(EncodingSettings.CodecEnum.Copy, EncodingSettings.RateControlEnum.None, EncodingSettings.PresetsEnum.Medium, value: 28);

            Assert.That(encodingSettings.GetArgument(), Does.Contain(argument));

            Console.Out.WriteLine("Generated argument");
            Console.Out.WriteLine(encodingSettings.GetArgument());
        }
Exemplo n.º 11
0
        EditionJob PrepareEditon()
        {
            var playlist = new Playlist();

            const string     outputFile = "path";
            EncodingSettings settings   = new EncodingSettings(VideoStandards.P720, EncodingProfiles.MP4,
                                                               EncodingQualities.Medium, 25, 1, outputFile, true, true, 20, null);

            return(new EditionJob(playlist, settings));
        }
Exemplo n.º 12
0
 /// <summary>Constructor.</summary>
 ///<remarks>
 /// Do not use this constructor to access global settings.
 /// The global settings are contained in FluentJdfLibrary.Settings.
 /// </remarks>
 public FluentJdfLibrary() {
     //TODO we need an interface for the HttpTransmissionSettings and a better way to resolve.
     Infrastructure.Core.Configuration.Settings.ServiceLocator.Register(typeof(HttpTransmissionSettings), typeof(HttpTransmissionSettings));
     jdfAuthoringSettings = new JdfAuthoringSettings();
     encodingSettings = new EncodingSettings();
     transmissionPartSettings = new TransmissionPartSettings();
     transmitterSettings = new TransmitterSettings();
     httpTransmissionSettings = Infrastructure.Core.Configuration.Settings.ServiceLocator.Resolve<HttpTransmissionSettings>();
     templateEngineSettings = new TemplateEngineSettings();
     ResetToDefaults();
 }
Exemplo n.º 13
0
 /// <summary>Constructor.</summary>
 ///<remarks>
 /// Do not use this constructor to access global settings.
 /// The global settings are contained in FluentJdfLibrary.Settings.
 /// </remarks>
 public FluentJdfLibrary()
 {
     //TODO we need an interface for the HttpTransmissionSettings and a better way to resolve.
     Infrastructure.Core.Configuration.Settings.ServiceLocator.Register(typeof(HttpTransmissionSettings), typeof(HttpTransmissionSettings));
     jdfAuthoringSettings     = new JdfAuthoringSettings();
     encodingSettings         = new EncodingSettings();
     transmissionPartSettings = new TransmissionPartSettings();
     transmitterSettings      = new TransmitterSettings();
     httpTransmissionSettings = Infrastructure.Core.Configuration.Settings.ServiceLocator.Resolve <HttpTransmissionSettings>();
     templateEngineSettings   = new TemplateEngineSettings();
     ResetToDefaults();
 }
Exemplo n.º 14
0
        public VideoEditionProperties(Window parent)
        {
            TransientFor = parent;
            this.Build();
            Icon        = Misc.LoadIcon(App.Current.SoftwareIconName, IconSize.Button, 0);
            encSettings = new EncodingSettings();
            stdStore    = Misc.FillImageFormat(sizecombobox, VideoStandards.Rendering,
                                               App.Current.Config.RenderVideoStandard);
            encStore  = Misc.FillEncodingFormat(formatcombobox, App.Current.Config.RenderEncodingProfile);
            qualStore = Misc.FillQuality(qualitycombobox, App.Current.Config.RenderEncodingQuality);
            descriptioncheckbutton.Active      = App.Current.Config.OverlayTitle;
            audiocheckbutton.Active            = App.Current.Config.EnableAudio;
            mediafilechooser1.FileChooserMode  = FileChooserMode.File;
            mediafilechooser1.FilterName       = "Multimedia Files";
            mediafilechooser1.FilterExtensions = new string [] { "*.mkv", "*.mp4", "*.ogg",
                                                                 "*.avi", "*.mpg", "*.vob" };
            mediafilechooser2.FileChooserMode = FileChooserMode.Directory;
            mediafilechooser2.ChangedEvent   += (sender, e) => {
                OutputDir = mediafilechooser2.CurrentPath;
            };

            watermarkSelector.ResetButtonHeight      = RESET_BUTTON_HEIGHT;
            watermarkSelector.ImageButtonPressEvent += HandleChangeWatermarkClicked;
            watermarkSelector.ResetButton.Clicked   += (sender, e) => ResetWatermark();
            watermarkcheckbutton.Toggled            += HandleWatermarkCheckToggled;
            if (App.Current.Config.Watermark != null)
            {
                SetWatermarkPreview();
            }
            else
            {
                ResetWatermark();
            }
            watermarkcheckbutton.Active = App.Current.Config.AddWatermark;

            if (App.Current.LicenseManager != null)
            {
                bool canRemoveWatermark = App.Current.LicenseLimitationsService.CanExecute(VASFeature.Watermark.ToString());
                watermarkcheckbutton.Sensitive = canRemoveWatermark;
                if (!canRemoveWatermark)
                {
                    watermarkcheckbutton.Active = true;
                    watermarkLabel.Visible      = watermarkSelector.Visible = false;
                    if (App.Current.Config.Watermark != null)
                    {
                        ResetWatermark();
                    }
                }
            }
            ModifyBg(StateType.Normal, Misc.ToGdkColor(App.Current.Style.ThemeContrastDisabled));
            containerRegular.ModifyBg(StateType.Normal, Misc.ToGdkColor(App.Current.Style.ThemeBase));
        }
Exemplo n.º 15
0
        public void TestModel()
        {
            var encSettings = new EncodingSettings {
                OutputFile = "test.mp4",
            };
            var model = new Job(encSettings)
            {
            };
            var viewModel = new JobVM {
                Model = model
            };

            Assert.AreSame(model, viewModel.Model);
        }
Exemplo n.º 16
0
        protected void OnButtonOkClicked(object sender, System.EventArgs e)
        {
            EncodingSettings encSettings;
            TreeIter         iter;
            VideoStandard    std;

            sizecombobox.GetActiveIter(out iter);
            std = (VideoStandard)stdStore.GetValue(iter, 1);

            encSettings = new EncodingSettings(std, EncodingProfiles.MP4,
                                               EncodingQualities.High,
                                               25, 1, outputFile, true, false, 0);
            EncodingSettings = encSettings;
            Respond(ResponseType.Ok);
        }
Exemplo n.º 17
0
        void ExecuteConversion()
        {
            EncodingSettings encSettings;
            EncodingQuality  qual;
            TreeIter         iter;
            VideoStandard    std;
            uint             fps_n, fps_d;

            sizecombobox.GetActiveIter(out iter);
            std = (VideoStandard)stdStore.GetValue(iter, 1);

            bitratecombobox.GetActiveIter(out iter);
            qual = bitStore.GetValue(iter, 1) as EncodingQuality;

            var rates = new HashSet <uint> (Files.Select(f => (uint)f.Fps));

            if (rates.Count == 1)
            {
                fps_n = rates.First();
                fps_d = 1;
            }
            else
            {
                fps_n = App.Current.Config.FPS_N;
                fps_d = App.Current.Config.FPS_D;
            }

            if (fps_n == 50)
            {
                fps_n = 25;
            }
            else if (fps_n == 60)
            {
                fps_n = 30;
            }
            encSettings = new EncodingSettings(std, EncodingProfiles.MP4, qual, fps_n, fps_d,
                                               mediafilechooser1.CurrentPath, true, false, 0, null);

            EncodingSettings = encSettings;

            ConversionJob job = new ConversionJob(Files, EncodingSettings);

            App.Current.JobsManager.Add(job);

            Respond(ResponseType.Ok);
        }
Exemplo n.º 18
0
        void RemuxOutputFile(EncodingSettings settings)
        {
            VideoMuxerType muxer;

            /* We need to remux to the original format */
            muxer = settings.EncodingProfile.Muxer;
            if (muxer == VideoMuxerType.Avi || muxer == VideoMuxerType.Mp4)
            {
                string outFile = settings.OutputFile;
                string tmpFile = settings.OutputFile;

                while (System.IO.File.Exists(tmpFile))
                {
                    tmpFile = tmpFile + ".tmp";
                }

                Log.Debug("Remuxing file tmp: " + tmpFile + " out: " + outFile);

                try {
                    System.IO.File.Move(outFile, tmpFile);
                } catch (Exception ex) {
                    /* Try to fix "Sharing violation on path" in windows
                    * wait a bit more until the file lock is released */
                    Log.Exception(ex);
                    System.Threading.Thread.Sleep(5 * 1000);
                    try {
                        System.IO.File.Move(outFile, tmpFile);
                    } catch (Exception ex2) {
                        Log.Exception(ex2);
                        /* It failed again, just skip remuxing */
                        return;
                    }
                }

                /* Remuxing suceed, delete old file */
                if (guiToolkit.RemuxFile(tmpFile, outFile, muxer) == outFile)
                {
                    System.IO.File.Delete(tmpFile);
                }
                else
                {
                    System.IO.File.Delete(outFile);
                    System.IO.File.Move(tmpFile, outFile);
                }
            }
        }
Exemplo n.º 19
0
        public void TestProperties()
        {
            var encSettings = new EncodingSettings {
                OutputFile = "test.mp4",
            };
            var model = new Job(encSettings)
            {
                Progress = 0,
                State    = JobState.Running,
            };
            var viewModel = new JobVM {
                Model = model
            };

            Assert.AreEqual("test.mp4", viewModel.Name);
            Assert.AreEqual(0, viewModel.Progress);
            Assert.AreEqual(JobState.Running, viewModel.State);
        }
Exemplo n.º 20
0
 public VideoEditionProperties(Window parent)
 {
     TransientFor = parent;
     this.Build();
     encSettings = new EncodingSettings();
     stdStore    = Misc.FillImageFormat(sizecombobox, VideoStandards.Rendering,
                                        Config.RenderVideoStandard);
     encStore  = Misc.FillEncodingFormat(formatcombobox, Config.RenderEncodingProfile);
     qualStore = Misc.FillQuality(qualitycombobox, Config.RenderEncodingQuality);
     descriptioncheckbutton.Active      = Config.OverlayTitle;
     audiocheckbutton.Active            = Config.EnableAudio;
     mediafilechooser1.FileChooserMode  = FileChooserMode.File;
     mediafilechooser1.FilterName       = "Multimedia Files";
     mediafilechooser1.FilterExtensions = new string[] { "*.mkv", "*.mp4", "*.ogg",
                                                         "*.avi", "*.mpg", "*.vob" };
     mediafilechooser2.FileChooserMode = FileChooserMode.Directory;
     mediafilechooser2.ChangedEvent   += (sender, e) => {
         OutputDir = mediafilechooser2.CurrentPath;
     };
 }
Exemplo n.º 21
0
        protected void OnButtonOkClicked(object sender, System.EventArgs e)
        {
            EncodingSettings encSettings;
            EncodingQuality  qual;
            TreeIter         iter;
            VideoStandard    std;
            uint             fps_n, fps_d;

            sizecombobox.GetActiveIter(out iter);
            std = (VideoStandard)stdStore.GetValue(iter, 1);

            bitratecombobox.GetActiveIter(out iter);
            qual = bitStore.GetValue(iter, 1) as EncodingQuality;

            var rates = new HashSet <uint> (Files.Select(f => (uint)f.Fps));

            if (rates.Count == 1)
            {
                fps_n = rates.First();
                fps_d = 1;
            }
            else
            {
                fps_n = Config.FPS_N;
                fps_d = Config.FPS_D;
            }

            if (fps_n == 50)
            {
                fps_n = 25;
            }
            else if (fps_n == 60)
            {
                fps_n = 30;
            }
            encSettings = new EncodingSettings(std, EncodingProfiles.MP4, qual, fps_n, fps_d,
                                               mediafilechooser1.CurrentPath, true, false, 0);

            EncodingSettings = encSettings;
            Respond(ResponseType.Ok);
        }
Exemplo n.º 22
0
        public void TestPropertyForwarding()
        {
            int count       = 0;
            var encSettings = new EncodingSettings {
                OutputFile = "test.mp4",
            };
            var model = new Job(encSettings)
            {
                Progress = 0,
                State    = JobState.Running,
            };
            var viewModel = new JobVM {
                Model = model,
            };

            viewModel.PropertyChanged += (sender, e) => {
                count++;
            };

            model.State = JobState.Error;
            Assert.AreEqual(1, count);
        }
Exemplo n.º 23
0
        void RenderPlay(Project project, TimelineEvent play)
        {
            Playlist         playlist;
            EncodingSettings settings;
            EditionJob       job;
            string           outputDir, outputProjectDir, outputFile;

            if (App.Current.Config.AutoRenderDir == null ||
                !Directory.Exists(App.Current.Config.AutoRenderDir))
            {
                outputDir = App.Current.VideosDir;
            }
            else
            {
                outputDir = App.Current.Config.AutoRenderDir;
            }

            outputProjectDir = Path.Combine(outputDir,
                                            Utils.SanitizePath(project.ShortDescription));
            outputFile = String.Format("{0}-{1}.mp4", play.EventType.Name, play.Name);
            outputFile = Utils.SanitizePath(outputFile, ' ');
            outputFile = Path.Combine(outputProjectDir, outputFile);
            try {
                PlaylistPlayElement element;

                Directory.CreateDirectory(outputProjectDir);
                settings = EncodingSettings.DefaultRenderingSettings(outputFile);
                playlist = new Playlist();
                element  = new PlaylistPlayElement(play);
                playlist.Elements.Add(element);
                job = new EditionJob(playlist, settings);
                App.Current.JobsManager.Add(job);
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
Exemplo n.º 24
0
        public ActionResult encode()
        {
            var json       = new StreamReader(Request.Body).ReadToEnd();
            var data       = JsonConvert.DeserializeObject <List <EncoderSettings> >(json);
            int ActionType = data[0].tp;
            var _response  = new Dictionary <string, string>();

            _response["encodeoutput"] = "2.0";

            string Source    = "";
            string Published = "";
            string ProcessID = "";

            switch (ActionType)
            {
            case 0:
                // encode video
                Source    = data[0].key;
                Published = Path.GetFileNameWithoutExtension(data[0].key) + data[0].template.prefix;

                if (Source != "" && Published != null)
                {
                    var    _mhandler = new MediaHandler();
                    string RootPath  = SiteConfig.Environment.ContentRootPath;
                    _mhandler.FFMPEGPath           = EncodingSettings.FFMPEGPATH;
                    _mhandler.InputPath            = UrlConfig.Upload_Path("source");
                    _mhandler.OutputPath           = UrlConfig.Upload_Path("published");
                    _mhandler.BackgroundProcessing = true;
                    _mhandler.FileName             = Source;
                    _mhandler.OutputFileName       = Published.Replace(Path.GetExtension(Published), "");
                    _mhandler.Parameters           = EncodingSettings.returnPreset(data[0].template.presetID);          //"-s 640x380 -c:v libx264 -preset medium -crf 22 -b:v 500k -b:a 128k -profile:v baseline -level 3.1"; // Site_Settings.MP4_480p_Settings;
                    _mhandler.OutputExtension      = EncodingSettings.returnOutputExtension(data[0].template.presetID); // ".mp4";
                    _mhandler.vinfo = _mhandler.ProcessMedia();
                    if (_mhandler.vinfo.ErrorCode > 0)
                    {
                        // remove file if failed to publish properly
                        if (System.IO.File.Exists(RootPath + "/" + _mhandler.InputPath))
                        {
                            System.IO.File.Delete(RootPath + "/" + _mhandler.InputPath);
                        }

                        _response["encodeoutput"] = "2.0";
                        _response["ecode"]        = _mhandler.vinfo.ErrorCode.ToString();
                        _response["edesc"]        = _mhandler.vinfo.FFMPEGOutput.ToString();

                        var _message = new System.Text.StringBuilder();
                        _message.Append("<h4>Video Upload Error</h4>");
                        _message.Append("<p>Error:" + _mhandler.vinfo.ErrorCode + " _ _ " + _mhandler.vinfo.ErrorMessage + "</p>");
                        _message.Append("<p>Source FileName: " + Source);
                        _message.Append("<p>Published FileName: " + Published);

                        return(Ok(_response));
                    }
                    else
                    {
                        // _mhandler.vinfo.ProcessID = Guid.NewGuid().ToString(); // unique guid to attach with each process to identify proper object on progress bar and get info request
                        _lst.Add(_mhandler);
                        _response["encodeoutput"] = "2.0";
                        _response["ecode"]        = _mhandler.vinfo.ErrorCode.ToString();
                        _response["procid"]       = _mhandler.vinfo.ProcessID; // _mhandler.vinfo.ProcessID;
                        return(Ok(_response));
                    }
                }
                break;

            case 1:
                // get progress status
                ProcessID = data[0].pid;
                if (ProcessID != "")
                {
                    string completed_process = "0";
                    if (_lst.Count > 0)
                    {
                        int i = 0;
                        for (i = 0; i <= _lst.Count - 1; i++)
                        {
                            if (_lst[i].vinfo.ProcessID == ProcessID)
                            {
                                completed_process = Math.Round(_lst[i].vinfo.ProcessingCompleted, 2).ToString();
                            }
                        }
                    }

                    _response["encodeoutput"] = "2.0";
                    _response["status"]       = completed_process;
                    return(Ok(_response));
                }

                break;

            case 2:
                // get information
                ProcessID = data[0].pid;
                Published = Path.GetFileNameWithoutExtension(data[0].key) + data[0].template.prefix;
                if (ProcessID != "")
                {
                    if (_lst.Count > 0)
                    {
                        int i = 0;
                        for (i = 0; i <= _lst.Count - 1; i++)
                        {
                            if (_lst[i].vinfo.ProcessID == ProcessID)
                            {
                                _response["status"] = "OK";
                                _response["ecode"]  = _lst[i].vinfo.ErrorCode.ToString();
                                _response["fname"]  = Published;

                                _response["dur"]    = _lst[i].vinfo.Duration.ToString();
                                _response["dursec"] = _lst[i].vinfo.Duration_Sec.ToString();


                                // remove from list of corrent processes if processes reach this point
                                // store all information of completed process and remove it from list of concurrent processes
                                // e.g
                                VideoInfo current_uploaded_video_info = _lst[i].vinfo;
                                _lst.Remove(_lst[i]);

                                // Validation
                                int    plength  = 0;
                                var    pub_file = Path.GetFileNameWithoutExtension(data[0].key) + data[0].template.prefix;
                                string path     = UrlConfig.Upload_Path("source") + "\\" + pub_file;
                                if (System.IO.File.Exists(path))
                                {
                                    FileInfo flv_info = new FileInfo(path);
                                    plength = (int)flv_info.Length;
                                }
                                if (plength == 0)
                                {
                                    var _message = new System.Text.StringBuilder();
                                    _message.Append("<h4>Video Publishing Error</h4>");
                                    _message.Append("<p>Error: 0kb file generated</p>");
                                    _message.Append("<p>Source FileName: " + Source);
                                    _message.Append("<p>Published FileName: " + Published);
                                }

                                // ii: add meta information to mp4 video
                                if (data[0].template.applyMeta)
                                {
                                    try
                                    {
                                        var mp4med = new MediaHandler();
                                        mp4med.MP4BoxPath = EncodingSettings.MP4BoxPath;
                                        string _mp4_temp_path = "\"" + UrlConfig.Upload_Path("source") + "/" + pub_file + "\"";
                                        string meta_filename  = data[0].key.Replace(".mp4", "_meta.mp4");
                                        mp4med.Parameters = "-isma -hint -add " + _mp4_temp_path + "";
                                        mp4med.FileName   = meta_filename;
                                        mp4med.InputPath  = UrlConfig.Upload_Path("source");
                                        mp4med.Set_MP4_Buffering();

                                        // check whether file created
                                        string pubPath = UrlConfig.Upload_Path("source");
                                        if (System.IO.File.Exists(pubPath + "\\" + meta_filename))
                                        {
                                            // remove temp mp4 file
                                            if (System.IO.File.Exists(pubPath + "" + pub_file))
                                            {
                                                System.IO.File.Delete(pubPath + "\\" + pub_file);
                                            }

                                            _response["fname"] = meta_filename;
                                        }
                                        else
                                        {
                                            // file not created by mp4box
                                            // rename published mp4 as _meta.mp4
                                            System.IO.File.Move(pubPath + "\\" + pub_file, pubPath + "\\" + meta_filename);
                                            _response["fname"] = meta_filename;
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        var _message = new System.Text.StringBuilder();
                                        _message.Append("<h4>Video Meta Information Error</h4>");
                                        _message.Append("<p>Error: " + ex.Message + "</p>");
                                        _message.Append("<p>Source FileName: " + Source);
                                        _message.Append("<p>Published FileName: " + Published);
                                    }
                                }

                                _response["isenable"] = "1";

                                // Thumb Grabbing Script
                                if (data[0].template.generateThumbnails)
                                {
                                    string thumb_start_index = "";
                                    try
                                    {
                                        var med = new MediaHandler();
                                        med.FFMPEGPath           = EncodingSettings.FFMPEGPATH;
                                        med.InputPath            = UrlConfig.Upload_Path("source");     // RootPath + "\\" + SourcePath;
                                        med.OutputPath           = UrlConfig.Upload_Path("thumbnails"); // RootPath + "\\" + PublishedPath;
                                        med.FileName             = data[0].key;                         // source file
                                        thumb_start_index        = med.FileName.Replace(Path.GetExtension(med.FileName), "_");
                                        med.Image_Format         = "jpg";
                                        med.VCodec               = "image2"; //optional
                                        med.ACodec               = "";
                                        med.ImageName            = thumb_start_index;
                                        med.Multiple_Thumbs      = true;
                                        med.ThumbMode            = 0;
                                        med.No_Of_Thumbs         = 15;
                                        med.Thumb_Start_Position = 5;     // start grabbing thumbs from 5th second
                                                                          //if (this.BackgroundProcessing)
                                                                          //    med.BackgroundProcessing = true;
                                        int width = SiteSettings.Width;
                                        if (width > 0)
                                        {
                                            med.Width = width;
                                        }
                                        int height = SiteSettings.Height;
                                        if (height > 0)
                                        {
                                            med.Height = height;
                                        }
                                        var tinfo = med.Grab_Thumb();
                                        if (tinfo.ErrorCode > 0)
                                        {
                                            // Error occured in grabbing thumbs - Rollback process
                                            _response["ecode"] = "1006";
                                            _response["edesc"] = "Grabbing thumbs from video failed";

                                            var _message = new System.Text.StringBuilder();
                                            _message.Append("<h4>Thumb Generation Error</h4>");
                                            _message.Append("<p>Error: " + _response["edesc"] + "</p>");
                                            _message.Append("<p>Source FileName: " + Source);
                                            _message.Append("<p>Published FileName: " + Published);

                                            // call rollback script here
                                            return(Ok(_response));
                                        }

                                        // Validate Thumbs
                                        path = UrlConfig.Upload_Path("thumbnails") + "/" + thumb_start_index;
                                        if (!System.IO.File.Exists(path + "004.jpg") || !System.IO.File.Exists(path + "008.jpg") || !System.IO.File.Exists(path + "011.jpg"))
                                        {
                                            // thumb failed try again grabbing thumbs from published video
                                            med.InputPath = UrlConfig.Upload_Path("published");
                                            med.FileName  = pub_file;    // grab thumb from encoded video
                                            tinfo         = med.Grab_Thumb();
                                            if (tinfo.ErrorCode > 0)
                                            {
                                                // Error occured in grabbing thumbs - Rollback process
                                                _response["ecode"] = "1006";
                                                _response["edesc"] = "Grabbing thumbs from video failed";
                                                // rollback script here
                                                var _message = new System.Text.StringBuilder();
                                                _message.Append("<h4>Thumb Generation Error</h4>");
                                                _message.Append("<p>Error: " + _response["edesc"] + "</p>");
                                                _message.Append("<p>Source FileName: " + Source);
                                                _message.Append("<p>Published FileName: " + Published);
                                                return(Ok(_response));
                                            }
                                            // Disable Video
                                            if (!System.IO.File.Exists(path + "004.jpg") || !System.IO.File.Exists(path + "008.jpg") || !System.IO.File.Exists(path + "011.jpg"))
                                            {
                                                _response["isenable"] = "0";     // disable video - thumbs not grabbed properly.
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        _response["ecode"] = "1010";
                                        _response["edesc"] = ex.Message;

                                        var _message = new System.Text.StringBuilder();
                                        _message.Append("<h4>Thumb Generation Error</h4>");
                                        _message.Append("<p>Error: " + ex.Message + "</p>");
                                        _message.Append("<p>Source FileName: " + Source);
                                        _message.Append("<p>Published FileName: " + Published);
                                    }

                                    _response["tfile"]   = thumb_start_index + "" + "008.jpg";
                                    _response["fIndex"]  = thumb_start_index;
                                    _response["img_url"] = "/uploads/thumbnails/";     // + _response["tfile"]);
                                }
                                else
                                {
                                    // generate thumbnail is disabled
                                    _response["tfile"]   = "";
                                    _response["fIndex"]  = "";
                                    _response["img_url"] = "";
                                }
                            }
                        }
                    }
                    return(Ok(_response));
                }

                break;

            case 3:
                // final check
                ProcessID = data[0].pid;
                Source    = data[0].key;
                Published = Path.GetFileNameWithoutExtension(data[0].key) + data[0].template.prefix;

                if (ProcessID != "" && Source != "" && Published != "")
                {
                    if (_lst.Count > 0)
                    {
                        int i = 0;
                        for (i = 0; i <= _lst.Count - 1; i++)
                        {
                            if (_lst[i].vinfo.ProcessID == ProcessID)
                            {
                                if (_lst[i].vinfo.ProcessingCompleted >= 100)
                                {
                                    // check whether published file uploaded properly
                                    string publishedPath = UrlConfig.Upload_Path("published");

                                    if (!System.IO.File.Exists(publishedPath + "/" + Published))
                                    {
                                        _response["status"] = "INVALID";    // published file not found
                                    }
                                    else
                                    {
                                        _response["encodeoutput"] = "2.0";
                                        _response["status"]       = "OK";
                                    }
                                }
                            }
                        }
                    }

                    return(Ok(_response));
                }
                break;
            }
            _response["status"] = "INVALID";
            return(Ok(_response));
        }
Exemplo n.º 25
0
        bool CreateProject()
        {
            TreeIter  iter;
            MediaFile file;

            if (projectType == ProjectType.FileProject ||
                projectType == ProjectType.EditProject)
            {
                if (!mediafilesetselection1.FileSet.CheckFiles())
                {
                    dialogs.WarningMessage(Catalog.GetString("You need at least 1 video file for the main angle"));
                    return(false);
                }
            }

            if (project != null)
            {
                FillProject();
                return(true);
            }

            if (projectType == ProjectType.CaptureProject ||
                projectType == ProjectType.URICaptureProject)
            {
                if (String.IsNullOrEmpty(capturemediafilechooser.CurrentPath))
                {
                    dialogs.WarningMessage(Catalog.GetString("No output video file"));
                    return(false);
                }
            }
            if (projectType == ProjectType.URICaptureProject)
            {
                if (urientry.Text == "")
                {
                    dialogs.WarningMessage(Catalog.GetString("No input URI"));
                    return(false);
                }
            }

            project             = new LMProject();
            project.Description = new ProjectDescription();
            FillProject();
            ViewModel.Project.Model = project;


            encSettings     = new EncodingSettings();
            captureSettings = new CaptureSettings();

            encSettings.OutputFile = capturemediafilechooser.CurrentPath;

            /* Get quality info */
            qualitycombobox.GetActiveIter(out iter);
            encSettings.EncodingQuality = (EncodingQuality)qualList.GetValue(iter, 1);

            /* Get size info */
            imagecombobox.GetActiveIter(out iter);
            encSettings.VideoStandard = (VideoStandard)videoStandardList.GetValue(iter, 1);

            /* Get encoding profile info */
            encodingcombobox.GetActiveIter(out iter);
            encSettings.EncodingProfile = (EncodingProfile)encProfileList.GetValue(iter, 1);

            encSettings.Framerate_n = App.Current.Config.FPS_N;
            encSettings.Framerate_d = App.Current.Config.FPS_D;

            captureSettings.EncodingSettings = encSettings;

            file = project.Description.FileSet.FirstOrDefault();
            if (file == null)
            {
                file = new MediaFile()
                {
                    Name = Catalog.GetString("Main camera angle")
                };
                file.FilePath = capturemediafilechooser.CurrentPath;
                file.Fps      = (ushort)(App.Current.Config.FPS_N / App.Current.Config.FPS_D);
                file.Par      = 1;
                project.Description.FileSet.Add(file);
            }

            if (projectType == ProjectType.CaptureProject)
            {
                captureSettings.Device = videoDevices [devicecombobox.Active];
                captureSettings.Format = captureSettings.Device.Formats [deviceformatcombobox.Active];
                file.VideoHeight       = encSettings.VideoStandard.Height;
                file.VideoWidth        = encSettings.VideoStandard.Width;
            }
            else if (projectType == ProjectType.URICaptureProject)
            {
                string uri = urientry.Text;
                if (!String.IsNullOrEmpty(userentry.Text) || !String.IsNullOrEmpty(passwordentry.Text))
                {
                    int index = uri.IndexOf("://", StringComparison.Ordinal);
                    if (index != -1)
                    {
                        uri = uri.Insert(index + 3, string.Format("{0}:{1}@", userentry.Text, passwordentry.Text));
                    }
                }
                captureSettings.Device = new Device {
                    DeviceType = CaptureSourceType.URI,
                    ID         = uri
                };
                file.VideoHeight = encSettings.VideoStandard.Height;
                file.VideoWidth  = encSettings.VideoStandard.Width;
            }
            else if (projectType == ProjectType.FakeCaptureProject)
            {
                file.FilePath = Constants.FAKE_PROJECT;
            }
            return(true);
        }
Exemplo n.º 26
0
        public void TestRenderedCamera()
        {
            Project p = Utils.CreateProject();

            try {
                TimelineEvent evt = p.Timeline [0];
                evt.CamerasConfig = new List <CameraConfig> {
                    new CameraConfig(0)
                };
                PlaylistPlayElement element = new PlaylistPlayElement(evt, p.Description.FileSet);

                // Playlist with one event
                var playlist = new Playlist();
                playlist.Elements.Add(element);

                // Create a job
                const string     outputFile = "path";
                EncodingSettings settings   = new EncodingSettings(VideoStandards.P720, EncodingProfiles.MP4, EncodingQualities.Medium,
                                                                   25, 1, outputFile, true, true, 20);
                EditionJob job = new EditionJob(playlist, settings);

                // Mock IMultimediaToolkit and video editor
                var mtk = Mock.Of <IMultimediaToolkit> (m => m.GetVideoEditor() == Mock.Of <IVideoEditor> ());
                // and guitoolkit
                var gtk = Mock.Of <IGUIToolkit> (g => g.RenderingStateBar == Mock.Of <IRenderingStateBar> ());
                // and a video editor
                Mock <IVideoEditor> mock = Mock.Get <IVideoEditor> (mtk.GetVideoEditor());
                // And eventbroker
                Config.EventsBroker = Mock.Of <EventsBroker> ();

                // Create a rendering object with mocked interfaces
                RenderingJobsManager renderer = new RenderingJobsManager(mtk, gtk);
                // Start service
                renderer.Start();

                renderer.AddJob(job);

                // Check that AddSegment is called with the right video file.
                mock.Verify(m => m.AddSegment(p.Description.FileSet [0].FilePath,
                                              evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area()), Times.Once());

                /* Test with a camera index bigger than the total cameras */
                renderer.CancelAllJobs();
                mock.ResetCalls();
                evt = p.Timeline [1];
                evt.CamerasConfig = new List <CameraConfig> {
                    new CameraConfig(1)
                };
                element = new PlaylistPlayElement(evt, p.Description.FileSet);
                playlist.Elements [0] = element;
                job = new EditionJob(playlist, settings);
                renderer.AddJob(job);
                mock.Verify(m => m.AddSegment(p.Description.FileSet [1].FilePath,
                                              evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area()), Times.Once());

                /* Test with the secondary camera */
                renderer.CancelAllJobs();
                mock.ResetCalls();
                evt = p.Timeline [1];
                evt.CamerasConfig = new List <CameraConfig> {
                    new CameraConfig(2)
                };
                element = new PlaylistPlayElement(evt, p.Description.FileSet);
                playlist.Elements [0] = element;
                job = new EditionJob(playlist, settings);
                renderer.AddJob(job);
                mock.Verify(m => m.AddSegment(p.Description.FileSet [0].FilePath,
                                              evt.Start.MSeconds, evt.Stop.MSeconds, evt.Rate, evt.Name, true, new Area()), Times.Once());
            } finally {
                Utils.DeleteProject(p);
            }
        }
Exemplo n.º 27
0
 /// <summary>
 /// Initializes wrapper on a target executable using given encoding and
 /// using current directory as working directory.
 /// </summary>
 /// <param name="filePath">File path of the target executable.</param>
 /// <param name="encodingSettings">Encodings to use for input/output streams.</param>
 public Cli(string filePath, EncodingSettings encodingSettings)
     : this(filePath, Directory.GetCurrentDirectory(), encodingSettings)
 {
 }
Exemplo n.º 28
0
        /// <summary>
        /// Encodes the given location.
        /// </summary>
        public static LineLocation Encode(ReferencedLine referencedLocation, Coder coder, EncodingSettings settings)
        {
            try
            {
                // Step – 1: Check validity of the location and offsets to be encoded.
                // validate connected and traversal.
                referencedLocation.ValidateConnected(coder);
                // validate offsets.
                referencedLocation.ValidateOffsets();
                // validate for binary.
                referencedLocation.ValidateBinary();

                // Step – 2 Adjust start and end node of the location to represent valid map nodes.
                referencedLocation.AdjustToValidPoints(coder);
                // keep a list of LR-point.
                var points = new List <int>(new int[] { 0, referencedLocation.Vertices.Length - 1 });

                // Step – 3     Determine coverage of the location by a shortest-path.
                // Step – 4     Check whether the calculated shortest-path covers the location completely.
                //              Go to step 5 if the location is not covered completely, go to step 7 if the location is covered.
                // Step – 5     Determine the position of a new intermediate location reference point so that the part of the
                //              location between the start of the shortest-path calculation and the new intermediate is covered
                //              completely by a shortest-path.
                // Step – 6     Go to step 3 and restart shortest path calculation between the new intermediate location reference
                //              point and the end of the location.
                if (settings.VerifyShortestPath)
                {
                    bool isOnShortestPath = false;
                    while (!isOnShortestPath)
                    { // keep on adding intermediates until all paths between intermediates are on shortest paths.
                        isOnShortestPath = true;

                        // loop over all LRP-pairs.
                        for (var i = 0; i < points.Count - 1; i++)
                        {
                            var fromPoint = points[i];
                            var toPoint   = points[i + 1];

                            var fromEdge  = referencedLocation.Edges[fromPoint];
                            var toEdge    = referencedLocation.Edges[toPoint - 1];
                            var edgeCount = toPoint - fromPoint;

                            // calculate shortest path between their first and last edge.
                            var pathResult = coder.Router.TryCalculateRaw(coder.Profile.Profile,
                                                                          coder.Router.GetDefaultWeightHandler(coder.Profile.Profile),
                                                                          fromEdge, toEdge, coder.Profile.RoutingSettings);
                            if (pathResult.IsError)
                            {
                                try
                                {
                                    coder.Profile.RoutingSettings.SetMaxSearch(coder.Profile.Profile.FullName, float.MaxValue);
                                    pathResult = coder.Router.TryCalculateRaw(coder.Profile.Profile,
                                                                              coder.Router.GetDefaultWeightHandler(coder.Profile.Profile),
                                                                              fromEdge, toEdge, coder.Profile.RoutingSettings);
                                    if (pathResult.IsError)
                                    {
                                        throw new Exception("No path found between two edges of the line location.");
                                    }
                                }
                                catch
                                {
                                    throw;
                                }
                                finally
                                {
                                    coder.Profile.RoutingSettings.SetMaxSearch(coder.Profile.Profile.FullName, coder.Profile.MaxSearch);
                                }
                            }
                            var path  = pathResult.Value;
                            var edges = new List <long>();
                            while (path.From != null)
                            {
                                edges.Add(path.Edge);
                                path = path.From;
                            }
                            edges.Reverse();

                            // calculate converage.
                            var splitAt = -1;
                            for (var j = 0; j < edges.Count; j++)
                            {
                                var locationEdgeIdx = j + fromPoint;
                                if (locationEdgeIdx >= referencedLocation.Edges.Length ||
                                    edges[j] != referencedLocation.Edges[locationEdgeIdx])
                                {
                                    splitAt = j + fromPoint + 1;
                                    break;
                                }
                            }

                            // split if needed.
                            if (splitAt != -1)
                            {
                                points.Add(splitAt);
                                points.Sort();

                                isOnShortestPath = false;
                                break;
                            }
                        }
                    }
                }

                // Step – 7     Concatenate the calculated shortest-paths for a complete coverage of the location and form an
                //              ordered list of location reference points (from the start to the end of the location).

                // Step – 8     Check validity of the location reference path. If the location reference path is invalid then go
                //              to step 9, if the location reference path is valid then go to step 10.
                // Step – 9     Add a sufficient number of additional intermediate location reference points if the distance
                //              between two location reference points exceeds the maximum distance. Remove the start/end LR-point
                //              if the positive/negative offset value exceeds the length of the corresponding path.
                referencedLocation.AdjustToValidDistance(coder, points);

                // Step – 10    Create physical representation of the location reference.
                var coordinates = referencedLocation.GetCoordinates(coder.Router.Db);
                var length      = coordinates.Length();

                // 3: The actual encoding now!
                // initialize location.
                var location = new LineLocation();

                // build lrp's.
                var locationReferencePoints = new List <LocationReferencePoint>();
                for (var idx = 0; idx < points.Count - 1; idx++)
                {
                    locationReferencePoints.Add(referencedLocation.BuildLocationReferencePoint(coder,
                                                                                               points[idx], points[idx + 1]));
                }
                locationReferencePoints.Add(referencedLocation.BuildLocationReferencePointLast(
                                                coder, points[points.Count - 2]));

                // build location.
                location.First        = locationReferencePoints[0];
                location.Intermediate = new LocationReferencePoint[locationReferencePoints.Count - 2];
                for (var idx = 1; idx < locationReferencePoints.Count - 1; idx++)
                {
                    location.Intermediate[idx - 1] = locationReferencePoints[idx];
                }
                location.Last = locationReferencePoints[locationReferencePoints.Count - 1];

                // set offsets.
                location.PositiveOffsetPercentage = referencedLocation.PositiveOffsetPercentage;
                location.NegativeOffsetPercentage = referencedLocation.NegativeOffsetPercentage;

                return(location);
            }
            catch (ReferencedEncodingException)
            { // rethrow referenced encoding exception.
                throw;
            }
            catch (Exception ex)
            { // unhandled exception!
                throw new ReferencedEncodingException(referencedLocation,
                                                      string.Format("Unhandled exception during ReferencedLineEncoder: {0}", ex.ToString()), ex);
            }
        }
Exemplo n.º 29
0
        void RemuxOutputFile(EncodingSettings settings)
        {
            VideoMuxerType muxer;

            /* We need to remux to the original format */
            muxer = settings.EncodingProfile.Muxer;
            if (muxer == VideoMuxerType.Avi || muxer == VideoMuxerType.Mp4) {
                string outFile = settings.OutputFile;
                string tmpFile = settings.OutputFile;

                while (File.Exists (tmpFile)) {
                    tmpFile = tmpFile + ".tmp";
                }

                Log.Debug ("Remuxing file tmp: " + tmpFile + " out: " + outFile);

                try {
                    File.Move (outFile, tmpFile);
                } catch (Exception ex) {
                    /* Try to fix "Sharing violation on path" in windows
                     * wait a bit more until the file lock is released */
                    Log.Exception (ex);
                    System.Threading.Thread.Sleep (5 * 1000);
                    try {
                        File.Move (outFile, tmpFile);
                    } catch (Exception ex2) {
                        Log.Exception (ex2);
                        /* It failed again, just skip remuxing */
                        return;
                    }
                }

                /* Remuxing suceed, delete old file */
                if (guiToolkit.RemuxFile (tmpFile, outFile, muxer) == outFile) {
                    System.IO.File.Delete (tmpFile);
                } else {
                    System.IO.File.Delete (outFile);
                    System.IO.File.Move (tmpFile, outFile);
                }
            }
        }
Exemplo n.º 30
0
        bool CreateProject()
        {
            TreeIter  iter;
            MediaFile file;

            if (projectType == ProjectType.FileProject ||
                projectType == ProjectType.EditProject)
            {
                if (!mediafilesetselection1.FileSet.CheckFiles())
                {
                    gtoolkit.WarningMessage(Catalog.GetString("You need at least 1 video file for the main angle"));
                    return(false);
                }
            }

            if (project != null)
            {
                /* Make sure event types and timers are updated in case we are importing
                 * a project without dashboard */
                project.UpdateEventTypesAndTimers();
                return(true);
            }

            if (projectType == ProjectType.CaptureProject ||
                projectType == ProjectType.URICaptureProject)
            {
                if (String.IsNullOrEmpty(capturemediafilechooser.CurrentPath))
                {
                    gtoolkit.WarningMessage(Catalog.GetString("No output video file"));
                    return(false);
                }
            }
            if (projectType == ProjectType.URICaptureProject)
            {
                if (urientry.Text == "")
                {
                    gtoolkit.WarningMessage(Catalog.GetString("No input URI"));
                    return(false);
                }
            }
            project                         = new Project();
            project.Dashboard               = analysisTemplate;
            project.LocalTeamTemplate       = hometemplate;
            project.VisitorTeamTemplate     = awaytemplate;
            project.Description             = new ProjectDescription();
            project.Description.Competition = competitionentry.Text;
            project.Description.MatchDate   = datepicker1.Date;
            project.Description.Description = desctextview.Buffer.GetText(desctextview.Buffer.StartIter,
                                                                          desctextview.Buffer.EndIter, true);
            project.Description.Season      = seasonentry.Text;
            project.Description.LocalName   = project.LocalTeamTemplate.TeamName;
            project.Description.VisitorName = project.VisitorTeamTemplate.TeamName;
            project.Description.FileSet     = mediafilesetselection1.FileSet;
            project.UpdateEventTypesAndTimers();

            encSettings     = new EncodingSettings();
            captureSettings = new CaptureSettings();

            encSettings.OutputFile = capturemediafilechooser.CurrentPath;

            /* Get quality info */
            qualitycombobox.GetActiveIter(out iter);
            encSettings.EncodingQuality = (EncodingQuality)qualList.GetValue(iter, 1);

            /* Get size info */
            imagecombobox.GetActiveIter(out iter);
            encSettings.VideoStandard = (VideoStandard)videoStandardList.GetValue(iter, 1);

            /* Get encoding profile info */
            encodingcombobox.GetActiveIter(out iter);
            encSettings.EncodingProfile = (EncodingProfile)encProfileList.GetValue(iter, 1);

            encSettings.Framerate_n = Config.FPS_N;
            encSettings.Framerate_d = Config.FPS_D;

            captureSettings.EncodingSettings = encSettings;

            file = project.Description.FileSet.FirstOrDefault();
            if (file == null)
            {
                file = new MediaFile()
                {
                    Name = Catalog.GetString("Main camera angle")
                };
                file.FilePath = capturemediafilechooser.CurrentPath;
                file.Fps      = (ushort)(Config.FPS_N / Config.FPS_D);
                file.Par      = 1;
                project.Description.FileSet.Add(file);
            }

            if (projectType == ProjectType.CaptureProject)
            {
                captureSettings.Device = videoDevices [devicecombobox.Active];
                captureSettings.Format = captureSettings.Device.Formats [deviceformatcombobox.Active];
                file.VideoHeight       = encSettings.VideoStandard.Height;
                file.VideoWidth        = encSettings.VideoStandard.Width;
            }
            else if (projectType == ProjectType.URICaptureProject)
            {
                captureSettings.Device = new Device {
                    DeviceType = CaptureSourceType.URI,
                    ID         = urientry.Text
                };
                file.VideoHeight = encSettings.VideoStandard.Height;
                file.VideoWidth  = encSettings.VideoStandard.Width;
            }
            else if (projectType == ProjectType.FakeCaptureProject)
            {
                file.FilePath = Constants.FAKE_PROJECT;
            }
            return(true);
        }