@@ -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