private static async Task <string> UploadVideoReview(VisualModerationResult vmResult, TextModerationResult tmResult) { Console.WriteLine("[Content Moderator] Video Review publishing started..."); string reviewId = string.Empty; string videoFilePath = vmResult.VideoFilePath; try { reviewId = await videoReviewUploader.CreateVideoReview(vmResult, tmResult); await videoReviewUploader.AddVideoFramesToVideoReview(vmResult, reviewId); await videoReviewUploader.AddVideoTranscriptToVideoReview(tmResult, reviewId); await videoReviewUploader.AddVideoTranscriptModerationResultToVideoReview(tmResult, reviewId); await videoReviewUploader.PublishVideoReview(reviewId); } catch (Exception e) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[Content Moderator] Video Review publishing failed. Error: ", e.ToString()); Console.ForegroundColor = ConsoleColor.White; } FFmpegComponent.CleanUp(videoFilePath, reviewId); Console.WriteLine("[Content Moderator] Video Review published Successfully and the review Id {0}", reviewId); return(reviewId); }
private static string GenerateProxyVideo(string videoPath) { Console.WriteLine("[Content Moderator] Video compression process started..."); var compressedVideoPath = FFmpegComponent.CompressVideo(videoPath); if (string.IsNullOrWhiteSpace(compressedVideoPath)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[Content Moderator] Video Compression failed."); Console.ForegroundColor = ConsoleColor.White; } Console.WriteLine("[Content Moderator] Video compression process completed..."); return(compressedVideoPath); }
private string GenerateFrameImages(List <List <FrameEvent> > segmetedFrameEventList, string reviewId, string videoFilePath) { List <FFmpegVideoFrameImage> videoFrameImages = new List <FFmpegVideoFrameImage>(); int frameEventsSegment = 0; foreach (var frameEventList in segmetedFrameEventList) { foreach (var frame in frameEventList) { FFmpegVideoFrameImage frameImage = new FFmpegVideoFrameImage(); frameImage.VideoFilePath = videoFilePath; frameImage.FrameImagesPath = "\\" + frameEventsSegment; frameImage.FrameImageFilePath = frameImage.FrameImagesPath + "\\" + frame.FrameName; frameImage.FramePosition = TimeSpan.FromMilliseconds(Convert.ToDouble(frame.TimeStamp)); videoFrameImages.Add(frameImage); } frameEventsSegment++; } return(FFmpegComponent.GenerateFrameImages(videoFrameImages, reviewId, segmetedFrameEventList.Count)); }