Skip to content

Instantly share code, notes, and snippets.

@MisterSirCode
Created January 13, 2023 05:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MisterSirCode/8256289300b02a5764525cebb007fd66 to your computer and use it in GitHub Desktop.
Save MisterSirCode/8256289300b02a5764525cebb007fd66 to your computer and use it in GitHub Desktop.
Bulk converts movies for my jellyfin server. Converts them all into a universal h.264 mp4 aac web format that should (theoretically) run on any device. It accepts any FFMPEG-capable format, and it will automatically skip conversion if the output file already exists, to save time.
#!/bin/bash
shopt -s globstar
src_dir="MoviesSource"
dest_dir="Movies"
mkdir "$dest_dir"
for f in "${src_dir}"/**/*.*; do
name=${f##*/}
ffmpeg -n -i "$f" -c:v libx264 -preset slower -pix_fmt yuv420p -movflags faststart -c:a aac -ar 44100 -b:a 256k -f mp4 "${dest_dir}/${name%.*}.mp4"
done
@MisterSirCode
Copy link
Author

Do not use this for non-english shows. Im working on a separate script for remuxing anime

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment