iiitl / bash-practice-repo-24

0 stars 35 forks source link

Added script for Music_extract #146

Closed Priyanshu-2005 closed 5 months ago

Priyanshu-2005 commented 5 months ago

Fixes #91 Added script for Music_extract

Before Running the script Command used tree image

On running the script Command used bash <filename> <directory name> image

After running the script Command used tree image

Explanation of code if [ "$#" -ne 1 ]; then Checks if the number of argument is not equal to one then asks user to enter directory name as argument

input_directory="$1" Stores the input in the input variable

declare -a mp4_files=() Declaring an empty arrray

while IFS= read -r -d '' file; do Reads the output of find command as input and for each mp4 file it adds it into the mp4 array

for mp4_file in "${mp4_files[@]}"; do Iterates through the array

ffmpeg -i "$mp4_file" -vn -acodec libmp3lame -q:a 2 "$output_file" Extracts the mp4 file to mp3 and add them to the same location

Kindly look into the Pull Request

rootCircle commented 5 months ago

LGTM :+1: Accepted! Thanks for your contribution!