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
This commit is contained in:
Claude
2026-04-09 06:30:50 +00:00
committed by davotoula
parent a9978277a3
commit 613237bdb9
2 changed files with 3 additions and 12 deletions
@@ -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" }
@@ -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 =