public ResidentsController(ILocationsService locationsService, IResidentsService dataService, ILogger logger,
                            IUsersService usersService, IVideoConverter videoConverter)
     : base(dataService, logger, usersService)
 {
     _locationsService = locationsService;
     _videoConverter   = videoConverter;
 }
Esempio n. 2
0
 public UpscaleApp(ILoggerFactory loggerFactory, IWaifu2x waifu2X, IVideoConverter videoConverter, UpscaleSettings upscaleSettings)
 {
     this._loggerFactory   = loggerFactory;
     this._waifu2X         = waifu2X;
     this._videoConverter  = videoConverter;
     this._upscaleSettings = upscaleSettings;
 }
Esempio n. 3
0
        public async Task Upscale(IWaifu2x waifu2X, IVideoConverter videoConverter)
        {
            if (this._resume)
            {
                await this.ReadFrames(waifu2X, videoConverter);
            }
            else
            {
                List <Frame> extractFrames = await videoConverter.ExtractFrames(this);

                this._frames.AddRange(extractFrames);
            }

            while (this.IsUpscaleFrameAvailable())
            {
                await this.UpscaleFrames(waifu2X);

                // read frames again because sometimes upscale does not work
                await this.ReadFrames(waifu2X, videoConverter);
            }

            var intermediateVideo = new IntermediateVideo(this);
            await intermediateVideo.CreateVideoFromUpscaledFrames(videoConverter, waifu2X.GetScaledPath());

            await intermediateVideo.CreateFinaleVideo(videoConverter);
        }
Esempio n. 4
0
 public VideoConvertEventService(
     IVideoConverter videoConverter,
     IVideoHelper videoHelper,
     IContentTypeService contentTypeService,
     IMediaService mediaService)
 {
     _videoConverter     = videoConverter;
     _videoHelper        = videoHelper;
     _contentTypeService = contentTypeService;
     _mediaService       = mediaService;
 }
Esempio n. 5
0
 private async Task ReadFrames(IWaifu2x waifu2X, IVideoConverter videoConverter)
 {
     this._logger.LogInformation("Resume from previous upscaling");
     this._frames.AddRange(videoConverter.GetFrames());
     foreach (Frame frame in this._frames)
     {
         if (!await waifu2X.IsAlreadyUpscaled(frame))
         {
             continue;
         }
         this._logger.LogInformation($"{frame} already scaled");
         frame.SetToUpscaled();
     }
 }
        public VideoService(IVideoConverter videoConverterService, IWebHostEnvironment env, IVideoRepository videoRepository, IConfiguration configuration, ILogger <VideoService> logger)
        {
            _videoConverter  = videoConverterService;
            _videoRepository = videoRepository;
            _logger          = logger;
            _videosBaseUrl   = configuration.GetValue <string>("VideosBaseUrl");
            var outputRelDir = configuration.GetValue <string>("StoredFilesPath");

            _outputDir           = Path.Combine(env.ContentRootPath, outputRelDir);
            _thumbnailsBySeconds = configuration.GetSection("ThumbnailsBySeconds")?.AsEnumerable()
                                   .Where(p => p.Value != null)
                                   .Select(p => int.Parse(p.Value))
                                   .ToArray();
        }
        public YouTubeServiceTests()
        {
            var vidProfile    = new VideoProfile();
            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(vidProfile);
            });

            _mapper     = new Mapper(configuration);
            _youtube    = new YoutubeClient();
            _downloader = new VideoDownloader(_youtube);
            _converter  = new VideoConverter(_mapper);
            _sut        = new YouTubeService(_downloader, _converter);
        }
Esempio n. 8
0
 public AssetController(
     ILoggerManager logger,
     IBlobService azureBlobService,
     IImageAnalyzer azureImageAnalyzer,
     IImageConverter azureImageConverter,
     IVideoConverter azureVideoConverter,
     IAssetRepository assetRepository
     )
 {
     _logger              = logger;
     _azureBlobService    = azureBlobService;
     _azureImageAnalyzer  = azureImageAnalyzer;
     _azureImageConverter = azureImageConverter;
     _azureVideoConverter = azureVideoConverter;
     _assetRepository     = assetRepository;
 }
 internal Converting(string fileName, ConversionFormat format, bool sendToITunesSelected)
 {
     InitializeComponent();
     this.conversionFormat     = format;
     this.sendToITunesSelected = sendToITunesSelected;
     this.ffmpegOutput         = new List <string>();
     fileNameLabel.Content     = IOPath.GetFileName(fileName);
     progressLabel.Content     = "Starting...";
     converter                  = format.MakeConverter(fileName);
     converter.Output          += new EventHandler <ProcessOutputArgs>(converter_FFMPEGOutput);
     converter.ConvertProgress +=
         new EventHandler <VideoConvertProgressArgs>(converter_ConvertProgress);
     converter.Finished      += new EventHandler <EventArgs>(converter_Finished);
     converter.UnknownFormat += new EventHandler <EventArgs>(converter_UnknownFormat);
     converter.Start();
 }
Esempio n. 10
0
 internal Converting(string fileName, ConversionFormat format, bool sendToITunesSelected)
 {
     InitializeComponent();
     this.conversionFormat = format;
     this.sendToITunesSelected = sendToITunesSelected;
     this.ffmpegOutput = new List<string>();
     fileNameLabel.Content = IOPath.GetFileName(fileName);
     progressLabel.Content = "Starting...";
     converter = format.MakeConverter(fileName);
     converter.Output += new EventHandler<ProcessOutputArgs>(converter_FFMPEGOutput);
     converter.ConvertProgress +=
         new EventHandler<VideoConvertProgressArgs>(converter_ConvertProgress);
     converter.Finished += new EventHandler<EventArgs>(converter_Finished);
     converter.UnknownFormat += new EventHandler<EventArgs>(converter_UnknownFormat);
     converter.Start();
 }
Esempio n. 11
0
 public MediaHelper(ICacheService cacheService,
                    IIntranetMemberService <IntranetMember> intranetMemberService,
                    IMediaModelService mediaModelService,
                    IMediaService mediaService,
                    IMediaFolderTypeProvider mediaFolderTypeProvider,
                    IImageHelper imageHelper,
                    IVideoHelper videoHelper,
                    IVideoConverter videoConverter)
 {
     _cacheService            = cacheService;
     _intranetMemberService   = intranetMemberService;
     _mediaModelService       = mediaModelService;
     _mediaService            = mediaService;
     _mediaFolderTypeProvider = mediaFolderTypeProvider;
     _imageHelper             = imageHelper;
     _videoHelper             = videoHelper;
     _videoConverter          = videoConverter;
 }
Esempio n. 12
0
 public MediaHelper(ICacheService cacheService,
                    IMediaService mediaService,
                    IIntranetUserService <IIntranetUser> intranetUserService,
                    UmbracoHelper umbracoHelper,
                    IMediaFolderTypeProvider mediaFolderTypeProvider,
                    IImageHelper imageHelper,
                    IVideoHelper videoHelper,
                    IVideoConverter videoConverter,
                    IVideoConverterLogService videoConverterLogService)
 {
     _cacheService             = cacheService;
     _mediaService             = mediaService;
     _intranetUserService      = intranetUserService;
     _umbracoHelper            = umbracoHelper;
     _mediaFolderTypeProvider  = mediaFolderTypeProvider;
     _imageHelper              = imageHelper;
     _videoHelper              = videoHelper;
     _videoConverter           = videoConverter;
     _videoConverterLogService = videoConverterLogService;
 }
Esempio n. 13
0
        public FaceBook(IVideoConverter VideoConverter, IImageConverter ImageConverter)//,IConfiguration configuration)
        {
            _VideoConverter = VideoConverter;
            _ImageConverter = ImageConverter;
            // _configuration = configuration;
            // /////
            //// we can get this data from API or Database
            _imageRequiredScaled.Add(new ImageInfo {
                Extention = ImageFormat.Png, Width = 64, Height = 64, FoldersName = "Small/Thumbnail"
            });
            _imageRequiredScaled.Add(new ImageInfo {
                Extention = ImageFormat.Png, Width = 256, Height = 256, FoldersName = "Medium/Personal/Folder 1"
            });

            //    {
            //        new VideoInfo { Extention = VideoFormat.mp4, Quality = VideoQuality.Q320 },
            //    new VideoInfo { Extention = VideoFormat.mp4, Quality = VideoQuality.QFullHD },
            //    new VideoInfo { Extention = VideoFormat.mp4, Quality = VideoQuality.Q4K },
            //};
        }
Esempio n. 14
0
        private void LoadConversionJob(ConversionJob job)
        {
            videoConverter                  = multimediaToolkit.GetVideoConverter(job.EncodingSettings.OutputFile);
            videoConverter.Progress        += OnProgress;
            videoConverter.EncodingSettings = job.EncodingSettings;
            videoConverter.Error           += OnError;

            foreach (MediaFile file in job.InputFiles)
            {
                videoConverter.AddFile(file.FilePath, file.Length);
            }

            try {
                videoConverter.Start();
            } catch (Exception ex) {
                videoConverter.Cancel();
                job.State = JobState.Error;
                Log.Exception(ex);
                Log.Error("Error rendering job: ", job.Name);
                guiToolkit.ErrorMessage(Catalog.GetString("Error rendering job: ") + ex.Message);
            }
        }
Esempio n. 15
0
        public TelegramBot(Settings settings, XabeConverter xabeConverter)
        {
            _settings       = settings.Telegram;
            _videoСonverter = xabeConverter;
            //_voiceСonverter = new VoskAudioRecognizer();

            Console.WriteLine("Starting Telegram Bot");

            var cts = new CancellationTokenSource();
            var cancellationToken = cts.Token;

            var receiverOptions = new ReceiverOptions
            {
                AllowedUpdates = { } // receive all update types
            };

            _client = new TelegramBotClient(_settings.Token);
            _client.StartReceiving(HandleUpdateAsync, HandleErrorAsync, receiverOptions, cancellationToken);

            var(id, name) = GetBotInfoAsync().Result;

            Console.WriteLine($"Telegram Bot init successfully. ID: {id} | Name: {name}");
        }
Esempio n. 16
0
        async Task StopRecording()
        {
            _audioPlayer.Play(SoundKind.Stop);

            FileRecentItem       savingRecentItem = null;
            FileSaveNotification notification     = null;

            var fileName = _recordingModel.CurrentFileName;
            var isVideo  = _recordingModel.IsVideo;

            IVideoConverter postWriter = null;

            // Assume saving to file only when extension is present
            if (!_timerModel.Waiting && !string.IsNullOrWhiteSpace(_videoWritersViewModel.SelectedVideoWriter.Extension))
            {
                savingRecentItem = new FileRecentItem(fileName, isVideo ? RecentFileType.Video : RecentFileType.Audio, true);
                _recentList.Add(savingRecentItem);

                notification = new FileSaveNotification(savingRecentItem);

                notification.OnDelete += () => savingRecentItem.RemoveCommand.ExecuteIfCan();

                _systemTray.ShowNotification(notification);

                if (isVideo && Settings.Video.PostConvert)
                {
                    postWriter = _videoWritersViewModel.SelectedPostWriter;
                }
            }

            var task = _recordingModel.StopRecording();

            lock (_stopRecTaskLock)
            {
                _stopRecTasks.Add(task);
            }

            var wasWaiting = _timerModel.Waiting;

            _timerModel.Waiting = false;

            try
            {
                // Ensure saved
                await task;

                if (postWriter != null)
                {
                    notification.Converting();

                    var progress = new Progress <int>();

                    progress.ProgressChanged += (S, E) => notification.Progress = E;

                    var outFileName = Path.Combine(
                        Path.GetDirectoryName(fileName),
                        $"{Path.GetFileNameWithoutExtension(fileName)}.converted{postWriter.Extension}");

                    try
                    {
                        await postWriter.StartAsync(new VideoConverterArgs
                        {
                            AudioQuality = Settings.Audio.Quality,
                            VideoQuality = Settings.Video.Quality,
                            InputFile    = fileName,
                            FileName     = outFileName
                        }, progress);

                        File.Delete(fileName);

                        var targetFileName = Path.Combine(
                            Path.GetDirectoryName(fileName),
                            $"{Path.GetFileNameWithoutExtension(fileName)}{postWriter.Extension}");

                        File.Move(outFileName, targetFileName);

                        savingRecentItem.Converted(targetFileName);
                        notification.Converted(targetFileName);
                    }
                    catch (FFmpegNotFoundException e)
                    {
                        try
                        {
                            _ffmpegViewsProvider.ShowUnavailable();
                        }
                        catch
                        {
                            // Show simpler message for cases the above fails
                            _messageProvider.ShowException(e, e.Message);
                        }
                    }
                    catch (Exception e)
                    {
                        _messageProvider.ShowException(e, "Conversion Failed");
                    }
                }

                lock (_stopRecTaskLock)
                {
                    _stopRecTasks.Remove(task);
                }
            }
            catch (Exception e)
            {
                _messageProvider.ShowException(e, "Error occurred when stopping recording.\nThis might sometimes occur if you stop recording just as soon as you start it.");

                return;
            }

            if (wasWaiting)
            {
                try
                {
                    File.Delete(fileName);
                }
                catch
                {
                    // Ignore Errors
                }
            }

            if (savingRecentItem != null)
            {
                AfterSave(savingRecentItem, notification);
            }
        }
Esempio n. 17
0
 public Task CreateFinaleVideo(IVideoConverter videoConverter)
 {
     return(videoConverter.CreateFinaleVideo(this));
 }
Esempio n. 18
0
 public async Task CreateVideoFromUpscaledFrames(IVideoConverter videoConverter, string scaledPath)
 {
     this.IntermediateVideoFile = await videoConverter.CreateVideoFromFrames(scaledPath);
 }
 public MaterialModificationService(IFamilyInfrastructureProvider infrastructure, IThumbnailProvider thumbnailProvider, IVideoConverter videoConverter)
 {
     _infrastructure    = infrastructure;
     _thumbnailProvider = thumbnailProvider;
     _videoConverter    = videoConverter;
 }
Esempio n. 20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MessagesController"/> class.
 /// </summary>
 /// <param name="configuration">Configuration of Application</param>
 /// <param name="download">Downloads files from Internet</param>
 /// <param name="videoConverter">Video conversion</param>
 public MessagesController(IConfiguration configuration, IYoutubeDownload download, IVideoConverter videoConverter)
 {
     this.configuration  = configuration;
     this.download       = download;
     this.videoConverter = videoConverter;
 }
Esempio n. 21
0
 public YouTubeService(IVideoDownloader downloader, IVideoConverter converter)
 {
     _downloader = downloader;
     _converter  = converter;
 }
 public VideoConversionService()
 {
     videoConverter = new XabeVideoConverterService();
 }
Esempio n. 23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CommandHandler"/> class.
 /// </summary>
 /// <param name="download">Downloads files from Internet</param>
 /// <param name="videoConverter">Video conversion</param>
 public CommandHandler(IYoutubeDownload download, IVideoConverter videoConverter)
 {
     this.download       = download;
     this.videoConverter = videoConverter;
 }
Esempio n. 24
0
        private void LoadConversionJob(ConversionJob job)
        {
            videoConverter = multimediaToolkit.GetVideoConverter (job.EncodingSettings.OutputFile);
            videoConverter.Progress += OnProgress;
            videoConverter.EncodingSettings = job.EncodingSettings;
            videoConverter.Error += OnError;

            foreach (MediaFile file in job.InputFiles) {
                videoConverter.AddFile (file.FilePath, file.Duration.MSeconds,
                    file.VideoWidth, file.VideoHeight, file.Par);
            }

            try {
                videoConverter.Start ();
            } catch (Exception ex) {
                videoConverter.Cancel ();
                job.State = JobState.Error;
                Log.Exception (ex);
                Log.Error ("Error rendering job: ", job.Name);
                guiToolkit.ErrorMessage (Catalog.GetString ("Error rendering job: ") + ex.Message);
            }
        }