π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Stop reporting FFmpeg output as exceptions
Neeraj Gupta9d5ac5f33afd
diff --git a/mobile/apps/photos/lib/services/video_preview_service.dart b/mobile/apps/photos/lib/services/video_preview_service.dartindex 0f1f192add..12db37f8d2 100644--- a/mobile/apps/photos/lib/services/video_preview_service.dart+++ b/mobile/apps/photos/lib/services/video_preview_service.dart@@ -47,6 +47,8 @@ import "package:photos/utils/gzip.dart";import "package:photos/utils/network_util.dart";const _maxRetryCount = 3;+const _maxFfmpegOutputLines = 24;+const _maxFfmpegOutputChars = 4000;class VideoPreviewService {final _logger = Logger("VideoPreviewService");@@ -668,11 +670,12 @@ class VideoPreviewService {}} else {final output = playlistGenResult["output"] as String?;- _logger.shout(- "FFmpeg command failed with return code $playlistGenReturnCode",- output ?? "Error not found",+ _logger.warning(+ "FFmpeg command failed with return code $playlistGenReturnCode\n"+ "${_summarizeFfmpegOutput(output)}",);- error = "Failed to generate video preview\nError: $output";+ error =+ "Failed to generate video preview (return code $playlistGenReturnCode)";}if (error == null) {@@ -1441,3 +1444,29 @@ class VideoPreviewService {});}}++String _summarizeFfmpegOutput(String? output) {+ final trimmedOutput = output?.trim();+ if (trimmedOutput == null || trimmedOutput.isEmpty) {+ return "FFmpeg output unavailable";+ }++ final lines = const LineSplitter()+ .convert(trimmedOutput)+ .map((line) => line.trim())+ .where((line) => line.isNotEmpty)+ .toList();+ final summarizedLines = lines.length > _maxFfmpegOutputLines+ ? lines.sublist(lines.length - _maxFfmpegOutputLines)+ : lines;+ var summary = summarizedLines.join("\n");+ if (summary.length > _maxFfmpegOutputChars) {+ summary = summary.substring(summary.length - _maxFfmpegOutputChars);+ }++ final wasTruncated = lines.length > summarizedLines.length ||+ trimmedOutput.length > _maxFfmpegOutputChars;+ return wasTruncated+ ? "FFmpeg output (truncated):\n$summary"+ : "FFmpeg output:\n$summary";+}