From 613237bdb989cbce2bb22dc4d2c9b1ba387a4920 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 9 Apr 2026 06:30:50 +0000 Subject: [PATCH] fix: hide quality slider and skip re-compression for GIF-to-MP4 The GIF converter already produces a well-compressed H.264 MP4, so re-compressing via VideoCompressionHelper is wasteful and can inflate file size. Hide the quality slider in the upload UI when GIF-to-MP4 is enabled and skip the video compression step in MediaCompressor. https://claude.ai/code/session_018sKCM3VNWtfPMZSYVWWD4w --- .../amethyst/service/uploads/MediaCompressor.kt | 13 ++----------- .../note/creators/uploads/ImageVideoDescription.kt | 2 +- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/uploads/MediaCompressor.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/uploads/MediaCompressor.kt index ace758a23..f899c583c 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/uploads/MediaCompressor.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/uploads/MediaCompressor.kt @@ -51,21 +51,12 @@ class MediaCompressor { ): MediaCompressorResult { checkNotInMainThread() - // Convert GIF to MP4 if requested (before quality check, since this is a format conversion) + // Convert GIF to MP4 if requested. The GIF converter already produces a well-compressed + // H.264 MP4 so no additional video compression step is needed. if (convertGifToMp4 && contentType?.contains("gif", ignoreCase = true) == true) { Log.d("MediaCompressor") { "Converting GIF to MP4" } val converted = GifToMp4Converter.convert(uri, applicationContext) if (converted != null) { - // Optionally compress the resulting video - if (mediaQuality != CompressorQuality.UNCOMPRESSED) { - return VideoCompressionHelper.compressVideo( - converted.uri, - converted.contentType, - applicationContext, - mediaQuality, - useH265, - ) - } return converted } Log.w("MediaCompressor") { "GIF to MP4 conversion failed, uploading as original GIF" } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt index 4dc9bf4e4..5b9960697 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt @@ -271,7 +271,7 @@ fun ImageVideoDescription( val firstMedia = uris.first().media - if (firstMedia.isVideo() == true || firstMedia.isImage() == true) { + if ((firstMedia.isVideo() == true || firstMedia.isImage() == true) && !convertGifToMp4) { Row( verticalAlignment = Alignment.CenterVertically, modifier =