Closed Priyanshu-2005 closed 5 months ago
Fixes #91 Added script for Music_extract
Before Running the script Command used tree
tree
On running the script Command used bash <filename> <directory name>
bash <filename> <directory name>
After running the script Command used tree
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
if [ "$#" -ne 1 ]; then
input_directory="$1" Stores the input in the input variable
input_directory="$1"
declare -a mp4_files=() Declaring an empty arrray
declare -a mp4_files=()
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
while IFS= read -r -d '' file; do
for mp4_file in "${mp4_files[@]}"; do Iterates through the array
for mp4_file in "${mp4_files[@]}"; do
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
ffmpeg -i "$mp4_file" -vn -acodec libmp3lame -q:a 2 "$output_file"
Kindly look into the Pull Request
LGTM :+1: Accepted! Thanks for your contribution!
Fixes #91 Added script for Music_extract
Before Running the script Command used
tree
On running the script Command used
bash <filename> <directory name>
After running the script Command used
tree
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 argumentinput_directory="$1"
Stores the input in the input variabledeclare -a mp4_files=()
Declaring an empty arrraywhile 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 arrayfor mp4_file in "${mp4_files[@]}"; do
Iterates through the arrayffmpeg -i "$mp4_file" -vn -acodec libmp3lame -q:a 2 "$output_file"
Extracts the mp4 file to mp3 and add them to the same locationKindly look into the Pull Request