コード例 #1
0
        void startTranscode()
        {
            VideoLib.VideoOperations videoOperations = new VideoLib.VideoOperations();
            videoOperations.setLogCallback(logCallback, true, VideoLib.VideoOperations.LogLevel.LOG_LEVEL_INFO);
            TotalProgressMax = Items.Count;
            TotalProgress    = 0;
            ItemProgressMax  = 100;

            Dictionary <String, Object> options = getOptions();

            foreach (VideoAudioPair input in Items)
            {
                ItemProgress = 0;
                ItemInfo     = "Transcoding: " + input.Name;

                if (CancellationToken.IsCancellationRequested)
                {
                    return;
                }

                /*if (MediaFormatConvert.isImageFile(input.Location))
                 * {
                 *  InfoMessages.Add("Skipping: " + input.Name + " is not a video file.");
                 *  TotalProgress++;
                 *  continue;
                 * }*/

                String outLocation = getOutputLocation(input);

                try
                {
                    VideoLib.OpenVideoArgs openArgs =
                        new VideoLib.OpenVideoArgs(input.Location, null, input.Audio == null ? null : input.Audio.Location, null);

                    videoOperations.transcode(openArgs, outLocation, CancellationToken, options,
                                              transcodeProgressCallback);
                }
                catch (Exception e)
                {
                    InfoMessages.Add("Error transcoding: " + e.Message);

                    try
                    {
                        File.Delete(outLocation);
                    }
                    catch (Exception ex)
                    {
                        InfoMessages.Add("Error deleting: " + outLocation + " " + ex.Message);
                    }

                    return;
                }

                ItemProgress = 100;
                TotalProgress++;

                InfoMessages.Add("Finished Transcoding: " + input.Name + " -> " + outLocation);
            }
        }
コード例 #2
0
        void startConcat()
        {
            VideoLib.VideoOperations videoOperations = new VideoLib.VideoOperations();
            videoOperations.setLogCallback(logCallback, true, VideoLib.VideoOperations.LogLevel.LOG_LEVEL_INFO);
            TotalProgressMax = Items.Count;
            TotalProgress    = 0;
            ItemProgressMax  = 100;

            List <VideoLib.OpenVideoArgs> inputArgs = new List <VideoLib.OpenVideoArgs>();

            foreach (VideoAudioPair input in Items)
            {
                inputArgs.Add(new VideoLib.OpenVideoArgs(input.Location, null, input.Audio == null ? null : input.Audio.Location, null));
            }

            String outLocation = getOutputLocation(Items.ElementAt(0));
            Dictionary <String, Object> options = getOptions();

            try
            {
                videoOperations.concat(inputArgs, outLocation, CancellationToken, options,
                                       concatProgressCallback);
            }
            catch (Exception e)
            {
                InfoMessages.Add("Error concatenating: " + e.Message);

                try
                {
                    File.Delete(outLocation);
                }
                catch (Exception ex)
                {
                    InfoMessages.Add("Error deleting: " + outLocation + " " + ex.Message);
                }

                return;
            }

            ItemProgress = 100;
            TotalProgress++;

            InfoMessages.Add("Finished concatenating: " + outLocation);
        }
コード例 #3
0
        void startConcat()
        {
            VideoLib.VideoOperations videoOperations = new VideoLib.VideoOperations();
            videoOperations.setLogCallback(logCallback, true, VideoLib.VideoOperations.LogLevel.LOG_LEVEL_INFO);
            TotalProgressMax = Items.Count;
            TotalProgress = 0;
            ItemProgressMax = 100;

            List<VideoLib.OpenVideoArgs> inputArgs = new List<VideoLib.OpenVideoArgs>();

            foreach (VideoAudioPair input in Items)
            {
                inputArgs.Add(new VideoLib.OpenVideoArgs(input.Location, null, input.Audio == null ? null : input.Audio.Location, null));
            }
            
            String outLocation = getOutputLocation(Items.ElementAt(0));
            Dictionary<String, Object> options = getOptions();

            try
            {
                videoOperations.concat(inputArgs, outLocation, CancellationToken, options,
                    concatProgressCallback);
            }
            catch (Exception e)
            {
                InfoMessages.Add("Error concatenating: " + e.Message);

                try
                {
                    File.Delete(outLocation);
                }
                catch (Exception ex)
                {
                    InfoMessages.Add("Error deleting: " + outLocation + " " + ex.Message);
                }

                return;
            }

            ItemProgress = 100;
            TotalProgress++;

            InfoMessages.Add("Finished concatenating: " + outLocation);

        }
コード例 #4
0
        void startTranscode()
        {
            VideoLib.VideoOperations videoOperations = new VideoLib.VideoOperations();
            videoOperations.setLogCallback(logCallback, true, VideoLib.VideoOperations.LogLevel.LOG_LEVEL_INFO);
            TotalProgressMax = Items.Count;
            TotalProgress = 0;
            ItemProgressMax = 100;

            Dictionary<String, Object> options = getOptions();

            foreach (VideoAudioPair input in Items)
            {
                ItemProgress = 0;
                ItemInfo = "Transcoding: " + input.Name;

                if (CancellationToken.IsCancellationRequested) return;
                /*if (MediaFormatConvert.isImageFile(input.Location))
                {
                    InfoMessages.Add("Skipping: " + input.Name + " is not a video file.");
                    TotalProgress++;
                    continue;
                }*/

                String outLocation = getOutputLocation(input);

                try
                {
                    VideoLib.OpenVideoArgs openArgs =
                        new VideoLib.OpenVideoArgs(input.Location, null, input.Audio == null ? null : input.Audio.Location, null);

                    videoOperations.transcode(openArgs, outLocation, CancellationToken, options,
                        transcodeProgressCallback);
                }
                catch (Exception e)
                {
                    InfoMessages.Add("Error transcoding: " + e.Message);

                    try
                    {
                        File.Delete(outLocation);
                    }
                    catch (Exception ex)
                    {
                        InfoMessages.Add("Error deleting: " + outLocation + " " + ex.Message);
                    }

                    return;
                }

                ItemProgress = 100;
                TotalProgress++;

                InfoMessages.Add("Finished Transcoding: " + input.Name + " -> " + outLocation);
            }

        }