Convert MP4 To MP3 Linux Bash Script
Page 1 of 1
Convert MP4 To MP3 Linux Bash Script
Convert MP$ To MP3 Linux Bash Script
mp4tomp3
Usage
run mp4tomp3 and pass the source and destination folder paths as command arguments
If script is in another directory:
If script is in the same directory
Dependencies
ffmpeg
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To Execute:
Test:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code:
Box Backup
Box Backup:
app.box.com/s/8is8va0ndygja9zod0saupnim0g08exw
Original Link
https://github.com/Prince-of-Persia/mp4tomp3
mp4tomp3
- Code:
Automatically convert *.mp4 to *.mp3
Usage
run mp4tomp3 and pass the source and destination folder paths as command arguments
If script is in another directory:
- Code:
./mp4tomp3.sh /PATH/TO/SOURCE /PATH/TO/DESTINATION
If script is in the same directory
- Code:
./mp4tomp3.sh /PATH/TO/SOURCE /PATH/TO/DESTINATION
Dependencies
- Code:
sudo apt install -y ffmpeg
ffmpeg
- Code:
git clone https://github.com/Prince-of-Persia/mp4tomp3.git
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To Execute:
- Code:
sudo chmod +x *.sh
Test:
- Code:
./mp4tomp3.sh /home/jay/Documents/Convert/test /home/jay/Documents/Convert/output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Code:
- Code:
#needs ffmpeg installed
cp -a /$1/. /$2/ #copy the whole dir from src to dest
#cd $2 #change dir to dest
cd $2
#convert *.mp4 to *.mp3
#find . -name "*.mp4" -exec bash -c 'var=${1%.mp4}; var=${var#*/};ffmpeg -i "${1#*/}" -vn -acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 "$dest/$var".mp3' - '{}' \;
find . -name "*.mp4" -exec bash -c 'ffmpeg -i "$1" -vn -acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 "${1%.mp4}".mp3' - '{}' \;
echo "Cleaning up"
find . -name "*.mp4" -exec bash -c 'var=${1%.mp4}; var=${var#*/}; rm "${1#*/}"' - '{}' \;
Box Backup
Box Backup:
app.box.com/s/8is8va0ndygja9zod0saupnim0g08exw
Original Link
https://github.com/Prince-of-Persia/mp4tomp3
Re: Convert MP4 To MP3 Linux Bash Script
Example 2
Code:
Code:
- Code:
#!/bin/bash
#
# jnet.forumotion.com/t1461-convert-mp4-to-mp3-linux-bash-script#2292
# Usage Example
# ./Convert.sh
#
#
search_dir="files_in"
# Starting
echo "Files In:"
ls files_in/
read -p "Are you sure (Files will be Converted From MP4 To MP3)? " -n 1 -r
if [[ $REPLY =~ ^[Yy]$ ]]
then
#
for file in "$search_dir"/*
do
# echo "$file"
ffmpeg -i "$file" -b:a 192K -vn "$file".mp3
# Now Report
cd $search_dir
# Move all mp3 to out Folder!
mv *.mp3* ../out/
# Done
cd ..
clear
echo "All Done. Files In Out Folder!"
done
fi
#
ls out/
Re: Convert MP4 To MP3 Linux Bash Script
Notes:
You will need the 2 folders!
You will need the 2 folders!
- Code:
sudo chmod +x *.sh
- Code:
./Convert.sh
Similar topics
» Linux BASH Script Running Commands and Functions From Bash Script and saving to varables
» Mass Convert All M4a To MP3 Music Script For Linux
» Mass Convert All MP4 & Webm To MP3 Music Script For Linux
» Linux Bash Dog Age Calculator Script
» BASH Linux Talking IP Script
» Mass Convert All M4a To MP3 Music Script For Linux
» Mass Convert All MP4 & Webm To MP3 Music Script For Linux
» Linux Bash Dog Age Calculator Script
» BASH Linux Talking IP Script
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum