diff options
| author | Raymaekers Luca <luca@spacehb.net> | 2025-05-07 17:18:36 +0200 |
|---|---|---|
| committer | Raymaekers Luca <luca@spacehb.net> | 2025-05-07 17:18:36 +0200 |
| commit | d7749a064a28c3c7a11a8791a8b7bc0036fe617a (patch) | |
| tree | baf959fb24b5162186ea6c2efbabe8ca35054a36 /bin/extra/discord_compress | |
| parent | 8b5fc81d97642088f99807f171244d17ef7258b0 (diff) | |
checkpoint
Diffstat (limited to 'bin/extra/discord_compress')
| -rwxr-xr-x | bin/extra/discord_compress | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/bin/extra/discord_compress b/bin/extra/discord_compress deleted file mode 100755 index eacc364..0000000 --- a/bin/extra/discord_compress +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -# Compresses a video to a target size, for configuration see VARIABLES -# From: https://trac.ffmpeg.org/wiki/Encode/H.264#Two-PassExample -# -# $1: input file - -# VARIABLES -video_codec="libx264" -audio_codec="aac" -audio_bitrate="96" -target_size="8" - -MEGABIT="8388" - -# Main - -input="$1" -if [ -z "$input" ] -then - >&2 printf 'Usage: discord_compress <input>\n' - exit 1 -fi - -duration="$(date -u -d @"$(ffprobe -show_entries format=duration -v quiet -of csv="p=0" -i "$input")" +'%s')" - -video_bitrate="$(((target_size * MEGABIT / duration) - audio_bitrate))" -[ "$video_bitrate" ] || exit 1 - -common_args="-hide_banner -v quiet -stats -y -hwaccel auto -i $input -c:v $video_codec -b:v ${video_bitrate}K" - -set -ex - -ffmpeg $common_args -pass 1 -an -f null /dev/null -ffmpeg $common_args -pass 2 -c:a "$audio_codec" -b:a "${audio_bitrate}K" compressed_"${input%.*}".mp4 - -rm -f ffmpeg2pass*.log* |
