Skip to content

Instantly share code, notes, and snippets.

@martinbowling
Last active March 2, 2023 20:20
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 martinbowling/b54c1e7eb31cd62c6376a781fc6a4455 to your computer and use it in GitHub Desktop.
Save martinbowling/b54c1e7eb31cd62c6376a781fc6a4455 to your computer and use it in GitHub Desktop.
AVI to MP4
@echo off
set input_folder=C:\path\to\avi\files
if not exist "%input_folder%\converted" mkdir "%input_folder%\converted"
for %%f in ("%input_folder%\*.avi") do (
ffmpeg -i "%%f" -c:v libx264 -c:a aac -b:a 192k "%input_folder%\converted\%%~nf.mp4"
move "%%f" "%input_folder%\converted"
)
echo Conversion complete.
#!/bin/bash
# Specify the folder containing the .avi files
input_folder="/path/to/avi/files"
# Create the subfolder for the converted files if it doesn't exist
if [ ! -d "${input_folder}/converted" ]; then
mkdir "${input_folder}/converted"
fi
# Convert each .avi file to .mp4 and move it to the subfolder
for file in "${input_folder}"/*.avi; do
if [ -f "$file" ]; then
ffmpeg -i "$file" -c:v libx264 -c:a aac -b:a 192k "${input_folder}/converted/$(basename "${file/.avi/.mp4}")"
mv "$file" "${input_folder}/converted"
fi
done
echo "Conversion complete."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment