How to convert all my audios into mp4 at once
I'm using Qnap NAS and recently I came to want to play all the media in living room at home. What is the best appliance?
Actually, there is a long story.
Apple TV? No it plays media only in my iPhone. And Wi-fi at home isn't good when a microwave is working.
Chromecast? was not a good idea for similar reasons.
Purchase a new network media player? No. It doesn't play ALAC, in which most of my audio files are encoded. Ones play ALAC cost 1,000 - 2,000 dollars. And those expensive ones do not look playing videos.
Finally I chose Sony PlayStation 3, which I bought several years ago. And since it doesn't play ALAC/FLAC, I need to convert thousands of my files.
Is there good solution in Linux? I couldn't find it. 'SoundConverter' looked nice, but it didn't understand ALAC. And only writes MP3 not MP4 (PS3 plays both, but I liked the latter).
Anyway I wrote a command line below to perform conversion from my audios to mp4 format.
export destroot="/mnt/livius/Qmultimedia/PS3/Music" && \ export srcroot="/mnt/livius/Qmultimedia/iTunes/iTunes Media/Music" && \ find "$srcroot" \ -type f \ -exec \ sh -c '\ export fname="${1#/*Music/}" && \ export destdir="$destroot/$(dirname "${fname}")" && \ mkdir -p "$destdir" && \ /usr/bin/avconv -y -i \ "$srcroot/$fname" \ -vn -acodec libvo_aacenc -b:a 320k -ac 2 -ar 48000 -b:a 320k \ "$destroot/${fname%.*}.mp4" \ ' \ "Convert all my music into MP4" {} \;