BASH Post Services

Viewing: 1746922393_360mp4.sh

Try wget https://bash.commongrounds.cc/uploads/1746922393_360mp4.sh from the console

Raw File Link

#!/bin/bash

# Check if input file is provided
if [ $# -ne 1 ]; then
    echo "Usage: $0 input_video"
    exit 1
fi

INPUT_FILE="$1"
OUTPUT_FILE="${INPUT_FILE%.*}_downsized.mp4"

# Check if input file exists
if [ ! -f "$INPUT_FILE" ]; then
    echo "Error: Input file '$INPUT_FILE' not found"
    exit 1
fi

# Check if ffmpeg is installed
if ! command -v ffmpeg &> /dev/null; then
    echo "Error: ffmpeg is not installed"
    exit 1
fi

# Downsize video to 360p, 15fps, mono audio at 128kbps
ffmpeg -i "$INPUT_FILE" \
    -vf "scale=-2:360" \
    -r 15 \
    -c:v libx264 \
    -preset fast \
    -c:a mp3 \
    -ac 1 \
    -b:a 128k \
    -y \
    "$OUTPUT_FILE"

# Check if conversion was successful
if [ $? -eq 0 ]; then
    echo "Video successfully downsized to: $OUTPUT_FILE"
else
    echo "Error: Video conversion failed"
    exit 1
fi
BASH to Home