Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an ffmpeg script to normalize video #13061

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions scripts/normalize-video.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# This script takes an input video path (relative is fine) and converts it to H.264 MP4 format with AAC audio,
# downscaling to 1200-pixel max-width where necessary. Converted files are written to ${filename}-${video_codec}.${extension}.
# Originals are left not modified.
#
# Requires ffmpeg: https://ffmpeg.org/download.html

filename=$(basename $1)
path=$(dirname $1)
video_codec="h264"
audio_codec="aac"
max_width="1200"
extension="mp4"

ffmpeg -i "${1}" -vcodec "$video_codec" -acodec "$audio_codec" -crf 18 -vf "scale=${max_width}:-1" "${path}/$(echo ${filename%.*})-${video_codec}.${extension}"
Loading