How to Increase All Videos Sound and Possibly to Preform any Desired Change other than Volume Change


 

I lots of videos that required to level up the sound because of poor audio capture specially on thous videos i did in the beginning or my video creation journey, so i had 2 options in mind:


1- Adjust the audio using the Video Editor App that will require opening it one by one, exporting each file and running optimization later to decrease the video size, and that will take hours and and maybe days

2- Find a batch processing app, which i didnt find any

3- Write a Bash script that will do the job looping in all folders and replacing the old files, which i did successfully and here is he code below:


#!/bin/bash
#Videso Batch Process | Increase Volume
find $pwd -not -path '*/parts/*' -and \( -name "*.mp4" -or -name "*.m4v" \) | while read ffile; do
    # Get Full Path
    ffile=$(cd "$(dirname "$ffile")"; pwd -P)/$(basename "$ffile")
    #echo "Input:"$ffile
    f_loc="$(dirname "$ffile")"
    #echo "Path:"$f_loc
    f_name="$(basename "$ffile")"
    f_name="${f_name%%.*}"
    echo "Name:"$f_name
    f_ext="${ffile##*.}"
    #echo "Extention:"$f_ext
    f_name_new="${f_loc}/${f_name}-new.${f_ext}"
    #echo "New File:    "$f_name_new

    # Run Command
    ffmpeg -loglevel panic -nostdin -i "${ffile}" -vcodec copy -af "volume=20dB" -f mp4 "${f_loc}/new-${f_name}.${f_ext}"
    mv "${f_loc}/${f_name}.${f_ext}" "/home/saleh/Videos/${f_name}.${f_ext}"
    mv "${f_loc}/new-${f_name}.${f_ext}" "${f_loc}/${f_name}.${f_ext}"
done

Comments