Skip to content

Commit c0d57e0

Browse files
Check if env value is also black for fallback value usage
Also renamed the ARG to VIDEO_BITRATE_LIMIT
1 parent b60d3ac commit c0d57e0

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

Railway.dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ FROM rob93c/stickerify:$DOCKER_TAG
33
ARG STICKERIFY_TOKEN
44
ARG LOG_LEVEL
55
ARG CONCURRENT_PROCESSES
6-
ARG VIDEO_BUFFER_SIZE
6+
ARG VIDEO_BITRATE_LIMIT
77
ENV STICKERIFY_TOKEN=$STICKERIFY_TOKEN \
88
LOG_LEVEL=$LOG_LEVEL \
99
CONCURRENT_PROCESSES=$CONCURRENT_PROCESSES \
10-
VIDEO_BUFFER_SIZE=$VIDEO_BUFFER_SIZE
10+
VIDEO_BITRATE_LIMIT=$VIDEO_BITRATE_LIMIT

src/main/java/com/github/stickerifier/stickerify/media/MediaHelper.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public final class MediaHelper {
5656
private static final int WEBP_ANIMATION_BIT_MASK = 0x02;
5757
private static final String WEBP_EXTENDED_FILE_FORMAT = "VP8X";
5858

59-
private static final String VIDEO_BUFFER_SIZE = getVideoBufferSize();
59+
private static final String VIDEO_BITRATE_LIMIT = getVideoBitrateLimit();
6060

6161
/**
6262
* Based on the type of passed-in file, it converts it into the proper media.
@@ -480,17 +480,17 @@ private static File convertToWebm(File file) throws MediaException, InterruptedE
480480
"-c:v", "libvpx-" + VP9_CODEC,
481481
"-row-mt", "1",
482482
"-threads", "2",
483-
"-b:v", VIDEO_BUFFER_SIZE,
484-
"-maxrate", VIDEO_BUFFER_SIZE,
485-
"-bufsize", VIDEO_BUFFER_SIZE,
483+
"-b:v", VIDEO_BITRATE_LIMIT,
484+
"-maxrate", VIDEO_BITRATE_LIMIT,
485+
"-bufsize", VIDEO_BITRATE_LIMIT,
486486
"-qmin", "25",
487487
"-qmax", "63",
488488
"-g", "120",
489489
"-auto-alt-ref", "0",
490490
"-pix_fmt", "yuv420p",
491491
"-t", String.valueOf(MAX_VIDEO_DURATION_SECONDS),
492492
"-an",
493-
"-enc_time_base", "1/1000", // solves issues related to highly precise fps count
493+
"-enc_time_base", "1/1000",
494494
"-passlogfile", logPrefix
495495
};
496496

@@ -530,10 +530,10 @@ private static String[] buildFfmpegCommand(String[] baseCommand, String... addit
530530
return commands;
531531
}
532532

533-
private static String getVideoBufferSize() {
534-
var videoBufferSize = System.getenv("VIDEO_BUFFER_SIZE");
533+
private static String getVideoBitrateLimit() {
534+
var value = System.getenv("VIDEO_BITRATE_LIMIT");
535535

536-
return videoBufferSize == null ? "600K" : videoBufferSize;
536+
return value == null || value.isBlank() ? "600K" : value;
537537
}
538538

539539
private MediaHelper() {

0 commit comments

Comments
 (0)