Elektrine lite

← Feed

@db2@lemmy.world

Post #2176277

2026-02-23 05:23 UTC

Definitely not the same lol Mine uses ffmpeg to change the resolution, it doesn't so much care about file sizes. It could be a one-liner if you only ever feed it a single file to manipulate..

Replies (1)

  • @0t79JeIfK01RHyzo@lemmy.ml 2026-02-23 06:33

    I might add one for scaling. I just don't use it as frequently as trying to meet a file size limit. The scaling is also much easier to remember ```bash ffmpeg -i in.mp4 -vf "scale=600:-1" -an out.mp4 ``` It does get complicated though, when scaling many videos and images, I've used something like the following in the past ```bash find . -exec ffmpeg -i {} -vf "scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:-1:-1:color=black" {}.mp4 \; ``` Those were the only two that showed up when I typed `history | grep scale`. ::: spoiler after commenting, I also added a new video file resizer. It works significantly better than the one I previously posted. It's also copied from stackoverflow. ```bash bitrate="$(awk "BEGIN {print int($2 * 1024 * 1024 * 8 / $(ffprobe \ -v error \ -show_entries format=duration \ -of default=noprint_wrappers=1:nokey=1 \ "$1" \ ) / 1000)}")k" ffmpeg \ -y \ -i "$1" \ -c:v libx264 \ -preset medium \ -b:v $bitrate \ -pass 1 \ -an \ -f mp4 \ /dev/null \ && \ ffmpeg \ -i "$1" \ -c:v libx264 \ -preset medium \ -b:v $bitrate \ -pass 2 \ -an \ "${1%.*}-$2mB.mp4" ``` :::

    Open ##2176278