#!/bin/bash

# Iterate over all mp4 files in the current directory
for file in *.mp4; do
    # Check if the file exists
    if [ -f "$file" ]; then
        # Get the filename without extension
        filename=$(basename -- "$file")
        filename_no_ext="${filename%.*}"

        # Recode the audio using ffmpeg
        ffmpeg -i "$file" -c:v copy -c:a aac "${filename_no_ext}_recoded.mp4"

        # Optional: Delete the original file if you want
        # rm "$file"
    fi
done

