diff options
author | Christian Schneppe <christian@pix-art.de> | 2017-01-29 12:19:11 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2017-01-29 12:19:11 +0100 |
commit | 5a0ef63132ced4e6ac9b3aad28f155dc976ed50b (patch) | |
tree | a1c5fa5174d61403699ccb258605e4ba6a376ead | |
parent | 79d6f57d72ccde93721d26c0e3131b5f9ac66dca (diff) |
change video filename and lower bitrate for smaller files
-rw-r--r-- | src/main/java/de/pixart/messenger/Config.java | 2 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/XmppConnectionService.java | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/Config.java b/src/main/java/de/pixart/messenger/Config.java index 058e3a85e..fcd5948b0 100644 --- a/src/main/java/de/pixart/messenger/Config.java +++ b/src/main/java/de/pixart/messenger/Config.java @@ -77,6 +77,8 @@ public final class Config { public static final int IMAGE_QUALITY = 75; public static final int IMAGE_MAX_SIZE = 1 * 1024 * 1024; // 1 MiB + public static final int VIDEO_BITRATE = 2 * 1000 * 1000; // 2 Mbps; default = 8 Mbps + public static final int DEFAULT_ZOOM = 15; //for locations public static final int MESSAGE_MERGE_WINDOW = 20; diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 35fb22a3f..1c7118f0f 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -59,6 +59,7 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Collection; import java.util.Collections; +import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; @@ -497,7 +498,8 @@ public class XmppConnectionService extends Service { private void processAsVideo() throws FileNotFoundException { Log.d(Config.LOGTAG, "processing file as video"); - message.setRelativeFilePath(message.getUuid() + ".mp4"); + SimpleDateFormat fileDateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US); + message.setRelativeFilePath(fileDateFormat.format(new Date(message.getTimeSent())) + "_" + message.getUuid().substring(0, 4) + "_komp.mp4"); final DownloadableFile file = getFileBackend().getFile(message); file.getParentFile().mkdirs(); ParcelFileDescriptor parcelFileDescriptor = getContentResolver().openFileDescriptor(uri, "r"); @@ -543,7 +545,7 @@ public class XmppConnectionService extends Service { } }; MediaTranscoder.getInstance().transcodeVideo(fileDescriptor, file.getAbsolutePath(), - MediaFormatStrategyPresets.createAndroid720pStrategy(), listener); + MediaFormatStrategyPresets.createAndroid720pStrategy(Config.VIDEO_BITRATE), listener); } @Override |