private MediaConversionSettings RotateVideo(IGalleryObject mediaObject)
        {
            var gallerySetting = Factory.LoadGallerySetting(mediaObject.GalleryId);

            // Determine file name and path of the new file.
            var dirName     = Path.GetDirectoryName(mediaObject.Original.FileNamePhysicalPath) ?? String.Empty;
            var newFilename = HelperFunctions.ValidateFileName(dirName, mediaObject.Original.FileName);
            var newFilePath = Path.Combine(dirName, newFilename);

            const string args           = @"-i ""{SourceFilePath}"" -vf ""{AutoRotateFilter}"" -q:a 0 -q:v 0 -acodec copy -metadata:s:v:0 rotate=0 ""{DestinationFilePath}""";
            var          encoderSetting = new MediaEncoderSettings(Path.GetExtension(newFilename), Path.GetExtension(mediaObject.Original.FileName), args, 0);

            var mediaSettings = new MediaConversionSettings
            {
                FilePathSource      = mediaObject.Original.FileNamePhysicalPath,
                FilePathDestination = newFilePath,
                EncoderSetting      = encoderSetting,
                GalleryId           = mediaObject.GalleryId,
                MediaQueueId        = _currentMediaQueueItemId,
                TimeoutMs           = gallerySetting.MediaEncoderTimeoutMs,
                MediaObjectId       = mediaObject.Id,
                TargetWidth         = 0,
                TargetHeight        = 0,
                FFmpegArgs          = String.Empty,
                FFmpegOutput        = String.Empty,
                CancellationToken   = CancelTokenSource.Token
            };

            mediaSettings.FFmpegOutput = FFmpeg.CreateMedia(mediaSettings);
            mediaSettings.FileCreated  = ValidateFile(mediaSettings.FilePathDestination);

            return(mediaSettings);
        }
        private MediaConversionSettings RotateVideo(IGalleryObject mediaObject)
        {
            var gallerySetting = Factory.LoadGallerySetting(mediaObject.GalleryId);

            // Determine file name and path of the new file.
            var dirName = Path.GetDirectoryName(mediaObject.Original.FileNamePhysicalPath) ?? String.Empty;
            var newFilename = HelperFunctions.ValidateFileName(dirName, mediaObject.Original.FileName);
            var newFilePath = Path.Combine(dirName, newFilename);

            const string args = @"-i ""{SourceFilePath}"" -vf ""{AutoRotateFilter}"" -q:a 0 -q:v 0 -acodec copy -metadata:s:v:0 rotate=0 ""{DestinationFilePath}""";
            var encoderSetting = new MediaEncoderSettings(Path.GetExtension(newFilename), Path.GetExtension(mediaObject.Original.FileName), args, 0);

            var mediaSettings = new MediaConversionSettings
            {
                FilePathSource = mediaObject.Original.FileNamePhysicalPath,
                FilePathDestination = newFilePath,
                EncoderSetting = encoderSetting,
                GalleryId = mediaObject.GalleryId,
                MediaQueueId = _currentMediaQueueItemId,
                TimeoutMs = gallerySetting.MediaEncoderTimeoutMs,
                MediaObjectId = mediaObject.Id,
                TargetWidth = 0,
                TargetHeight = 0,
                FFmpegArgs = String.Empty,
                FFmpegOutput = String.Empty,
                CancellationToken = CancelTokenSource.Token
            };

            mediaSettings.FFmpegOutput = FFmpeg.CreateMedia(mediaSettings);
            mediaSettings.FileCreated = ValidateFile(mediaSettings.FilePathDestination);

            return mediaSettings;
        }