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:
+2
-11
@@ -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" }
|
||||
|
||||
+1
-1
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user