0

Im attempting to make a wave video script in bash that allows the user to input an audio file and a background and displaying a wave filter over that image, and 1 that has a border around it so it doesnt look look so ugly being overlayed on the video. My solution to getting this border is adding another show waves filter first that is bigger than the second show waves filter. Getting 1 wave filter was relatively easy and I was able to do that without much a problem.

function designwavevideo() {
        outputpath="/storage/emulated/0/Pictures/Wave Audio Videos/"
        read -p "Enter Audio File: " audiofile
        read -p "Enter Background File: " backgroundfile
        backgroundwidth=$(ffprobe -v error -select_streams v -show_entries stream=width -of csv=p=0:s=x "$backgroundfile")
        backgroundheight=$(ffprobe -v error -select_streams v -show_entries stream=height -of csv=p=0:s=x "$backgroundfile")
        # read -p "Enter Border Wave Thickness:" borderwavethickness
        read -p "Output File Name:" outputfilename
        let widthwavethickness=$backgroundwidth+$borderwavethickness
        let heightwavethickness=$backgroundheight+$borderwavethickness
        ffmpeg -y -i "${audiofile}" -i "${backgroundfile}" -threads 16  -filter_complex "[0:a]aformat=channel_layouts=mono,showwaves=size=${backgroundwidth}x${backgroundheight}:mode=cline:rate=25:draw=full:colors=#43fa62[v];[1:v][v]overlay=format=auto:x=(W-w)/2:y=(H-h)/2,format=yuv420p[outv]" -map "[outv]" -c:a aac -map 0:a -c:v libx264 -crf 28 -preset veryslow -b:v 0 -shortest "${outputpath}${outputfilename}"
}

But Adding 2 waves to the same video is proving to be a bit complicated for me. As shown by the snippet below. I tried to add another wave filter and set the overlays but that dint work so now I hit a stump and im not quite sure how to go about fixing this.

function designwavevideo() {
        outputpath="/storage/emulated/0/Pictures/Wave Audio Videos/"
        read -p "Enter Audio File: " audiofile
        read -p "Enter Background File: " backgroundfile
        backgroundwidth=$(ffprobe -v error -select_streams v -show_entries stream=width -of csv=p=0:s=x "$backgroundfile")
        backgroundheight=$(ffprobe -v error -select_streams v -show_entries stream=height -of csv=p=0:s=x "$backgroundfile")
        read -p "Enter Border Wave Thickness:" borderwavethickness
        read -p "Output File Name:" outputfilename
        let widthwavethickness=$backgroundwidth+$borderwavethickness
        let heightwavethickness=$backgroundheight+$borderwavethickness
        ffmpeg -y -i "${audiofile}" -i "${backgroundfile}" -threads 16 -filter_complex "[0:a]aformat=channel_layouts=mono,showwaves=size=${widthwavethickness}x${heightwavethickness}:mode=cline:rate=25:draw=full:colors=#000000[v1];[0:a]aformat=channel_layouts=mono,showwaves=size=${backgroundwidth}x${backgroundheight}:mode=cline:rate=25:draw=full:colors=#43fa62[v2];[1:v][0][v1]overlay=format=auto[o1];[o1][v2]overlay=format=auto[o1]" -map "[outv]" -c:a aac -map 0:a -c:v libx264 -crf 28 -preset veryslow -b:v 0 -shortest "${outputpath}${outputfilename}"
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.