Sign in to follow this  
argate7

Script to convert mp4 to mp3

Recommended Posts

Here we are...

 

I had a problem with my mp4s that i wanted to convert them in mp3 and then synchronize them with ds audio. Synchronization was not working and that's the reason that i have a command to do this because i hadn't the new songs on my iphone.

 

#!/bin/bash
for file in /volume1/music/*
do
mv "$file" "${file// /_}"
done
MP4FILE=$(ls /volume1/music/ |sed -e 's/ /_/g')
for filename in $MP4FILE
do
if echo "$filename" | grep -q '.mp4$';
then
name=`echo "$filename" | sed -e "s/.mp4$//g"`
 ffmpeg -i /volume1/music/$filename -b:a 192K -vn /volume1/music/$name.mp3
  rm /volume1/music/$filename
  ../../usr/syno/bin/synoindex -a ../../volume1/music/$name.mp3
  else
   echo "problem"
   fi
   done

 

What does this one do??

It search for all mp4 files of my folder music under volume1. Then i convert all the blank spaces of the mp4's title to undescores.

After that i convert them to mp3 files and then i delete the mp4 files of my folder. If everything will be OK, i execute a command to synchronize the audio station with the help of synoindex.

 

I hope that this one will help some people who want something like this!!

 

Have a nice day!!

Share this post


Link to post
Share on other sites
Sign in to follow this