示例#1
0
        public override void Apply(FFmpegSettings Settings, VideoWriterArgs WriterArgs, FFmpegOutputArgs OutputArgs)
        {
            // quality: 63 (lowest) to 0 (highest)
            var crf = (63 * (100 - WriterArgs.VideoQuality)) / 99;

            OutputArgs.AddArg("-vcodec libvpx-vp9")
            .AddArg($"-crf {crf}")
            .AddArg("-b:v 0");
        }
示例#2
0
        public override void Apply(FFmpegSettings Settings, VideoWriterArgs WriterArgs, FFmpegOutputArgs OutputArgs)
        {
            // quality: 63 (lowest) to 4 (highest)
            var crf = 63 - ((WriterArgs.VideoQuality - 1) * 59) / 99;

            OutputArgs.AddArg("vcodec", "libvpx")
            .AddArg("crf", crf)
            .AddArg("b:v", "1M");
        }
示例#3
0
        public override void Apply(FFmpegSettings Settings, VideoWriterArgs WriterArgs, FFmpegOutputArgs OutputArgs)
        {
            // quality: 63 (lowest) to 0 (highest)
            var crf = (63 * (100 - WriterArgs.VideoQuality)) / 99;

            OutputArgs.AddArg("vcodec", "libvpx-vp9")
            .AddArg("crf", crf)
            .AddArg("b:v", 0);
        }
示例#4
0
        public override void Apply(FFmpegSettings Settings, VideoWriterArgs WriterArgs, FFmpegOutputArgs OutputArgs)
        {
            // quality: 63 (lowest) to 4 (highest)
            var crf = 63 - ((WriterArgs.VideoQuality - 1) * 59) / 99;

            OutputArgs.AddArg("-vcodec libvpx")
            .AddArg($"-crf {crf}")
            .AddArg("-b:v 1M");
        }
        public FFmpegCodecsViewModel(FFmpegSettings Settings)
        {
            this.Settings = Settings;

            AddCustomCodecCommand = new ReactiveCommand()
                                    .WithSubscribe(() => Settings.CustomCodecs.Add(new FFmpegCodecSettings()));

            RemoveCustomCodecCommand = new ReactiveCommand <FFmpegCodecSettings>()
                                       .WithSubscribe(M => Settings.CustomCodecs.Remove(M));
        }
示例#6
0
 public FFmpegViewsProvider(ILocalizationProvider Loc,
                            IAudioPlayer AudioPlayer,
                            FFmpegSettings Settings,
                            IDialogService DialogService)
 {
     this._loc           = Loc;
     this._audioPlayer   = AudioPlayer;
     this._settings      = Settings;
     this._dialogService = DialogService;
 }
示例#7
0
        public VideoService(FFmpegSettings ffmpegSettings, VideoSettings videoSettings)
        {
            FFmpegSettings = ffmpegSettings;
            VideoSettings  = videoSettings;
            FFmpeg.SetExecutablesPath(ffmpegSettings.ExecutablesPath);

            if (!Directory.Exists(VideoSettings.OutputDirectory))
            {
                Directory.CreateDirectory(VideoSettings.OutputDirectory);
            }
        }
        public FFmpegCodecsViewModel(FFmpegSettings Settings)
        {
            this.Settings = Settings;

            AddCustomCodecCommand = new DelegateCommand(() => Settings.CustomCodecs.Add(new CustomFFmpegCodec()));

            RemoveCustomCodecCommand = new DelegateCommand(M =>
            {
                if (M is CustomFFmpegCodec codec)
                {
                    Settings.CustomCodecs.Remove(codec);
                }
            });
        }
 protected override string GetLink(FFmpegSettings Settings)
 {
     return(Settings.CustomStreamingUrl);
 }
示例#10
0
 public FFmpegWriterProvider(FFmpegSettings Settings)
 {
     _settings = Settings;
 }
        public FFmpegDownloadViewModel(FFmpegSettings FFmpegSettings,
                                       FFmpegDownloadModel DownloadModel,
                                       IFFmpegViewsProvider FFmpegViewsProvider,
                                       IMessageProvider MessageProvider)
        {
            this.FFmpegSettings = FFmpegSettings;
            _downloadModel      = DownloadModel;
            _messageProvider    = MessageProvider;

            StartCommand = _downloaderProgress
                           .Select(M => M.State)
                           .Select(M => M == FFmpegDownloaderState.Ready)
                           .ToReactiveCommand()
                           .WithSubscribe(async() =>
            {
                var progress = new Progress <FFmpegDownloaderProgress>(M => _downloaderProgress.Value = M);

                _downloadTask = DownloadModel.Start(progress, _cancellationTokenSource.Token);

                var result = await _downloadTask;

                AfterDownload?.Invoke(result);
            });

            CanCancel = _downloaderProgress
                        .Select(M => M.State)
                        .Select(M => M == FFmpegDownloaderState.Downloading)
                        .ToReadOnlyReactivePropertySlim();

            SelectFolderCommand = _downloaderProgress
                                  .Select(M => M.State)
                                  .Select(M => M == FFmpegDownloaderState.Ready)
                                  .ToReactiveCommand()
                                  .WithSubscribe(FFmpegViewsProvider.PickFolder);

            OpenFolderCommand = new ReactiveCommand()
                                .WithSubscribe(() =>
            {
                var path = FFmpegSettings.GetFolderPath();

                if (Directory.Exists(path))
                {
                    Process.Start(path);
                }
            });

            Status = _downloaderProgress
                     .Select(M =>
            {
                switch (M.State)
                {
                case FFmpegDownloaderState.Error:
                    return(M.ErrorMessage);

                case FFmpegDownloaderState.Downloading:
                    return($"{FFmpegDownloaderState.Downloading} ({M.DownloadProgress}%)");

                default:
                    return(M.State.ToString());
                }
            })
                     .ToReadOnlyReactivePropertySlim();

            Progress = _downloaderProgress
                       .Where(M => M.State == FFmpegDownloaderState.Downloading)
                       .Select(M => M.DownloadProgress)
                       .ToReadOnlyReactivePropertySlim();

            Progress.Subscribe(M => ProgressChanged?.Invoke(M));

            InProgress = _downloaderProgress
                         .Select(M => M.State)
                         .Select(M => M == FFmpegDownloaderState.Downloading || M == FFmpegDownloaderState.Extracting)
                         .ToReadOnlyReactivePropertySlim();

            IsDone = _downloaderProgress
                     .Select(M => M.State)
                     .Select(M => M == FFmpegDownloaderState.Done || M == FFmpegDownloaderState.Cancelled || M == FFmpegDownloaderState.Error)
                     .ToReadOnlyReactivePropertySlim();
        }
 protected override string GetLink(FFmpegSettings Settings)
 {
     return($"rtmp://live.twitch.tv/app/{Settings.TwitchKey}");
 }
示例#13
0
 protected override string GetLink(FFmpegSettings Settings)
 {
     return($"rtmp://a.rtmp.youtube.com/live2/{Settings.YouTubeLiveKey}");
 }