[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amarok
Subject:    Re: Mass Convert mp3/m4a/etc to Ogg
From:       Greg Meyer <greg () gkmweb ! com>
Date:       2007-10-27 4:50:35
Message-ID: 200710270050.35374.greg () gkmweb ! com
[Download RAW message or body]

On Friday 26 October 2007, Jeff Mitchell wrote:
> On Friday 26 October 2007, Seb Ruiz wrote:
> > On 27/10/2007, Harrison Metzger <harrisonmetz@gmail.com> wrote:
> > > Hello, I've been a casual Amarok user for about a year. I have a bunch
> > > of audio files in various formats which are a residue from my old
> > > windows days. While my Amarok on Ubuntu can play these files fine,
> > > other programs, like k3b, can't seem to burn them. Even if it could, I
> > > would still like to convert my entire library to ogg. Is this possible
> > > in Amarok? If not, would something like this need to be incorporated
> > > into its codebase, or could a plugin be written, etc? (Does a native
> > > linux program (besides using command line oggenc and mad, faad
> > > commands) even exist?)
> >
> > You can use applications like soundKonverter to do this for you in a
> > batch manner. There are also some scripts which are available which
> > can allow you to do this from within Amarok itself. I'd recommend
> > going with the standalone application though, it would be much more
> > reliable.
> >
> > There are no plans to incorporate any of these sort of features into
> > Amarok.
>
> There's also transkode.  Try both, see what you like.  YMMV as always.
>
TransKode works very nicely.  I've been using it here to make CD's of mp3's 
for my car stereo, and have no problem with it.  It was a little tricky to 
set up until I realized you had to explicitly save a profile.  

Also, here is a little script I wrote to transcode m4a's to ogg's.  It's 
called m4a2ogg and I've attached it here, hopefully you find it useful.  It 
is heavily commented, so you should have no problem reading through it to 
tweak it for your own use.  Make sure you understand it before you try to use 
it as is.  I'd hate for it to screw up your files accidentally.  It obviously 
requires faad and oggenc be installed.

Cheers!

-- 
Greg

["m4a2ogg" (application/x-shellscript)]

#!/bin/bash
# This script is based on a bash script originaly posted to the
# Mandrake-newbie mailing list by Ralph Slooten.  I inquired as to the
# license he was making it available under and he indicated in a 
# response, the GPL.  Here is an excerpt from the post.
#
#	On Wed, 5 May 2004 19:01:03 -0400
#	Greg Meyer <mdklists@gkmweb.com> wrote:
#	
#	> This is a nice little script.  How are you licensing it?  I'd like to
#	> give it to a few other people.
#	
#	GPL ;-) Sure Greg, please feel free to give it to all. It's just a
#	script I hacked together to do exactly the same thing as you asked about
#	... which originally was on my old website. I still have to add it to my
#	'new" one at some stage.
#	
#	Greetings
#	Ralph
#	--
#	http://axljab.homelinux.org/
#
# I mention all this to give proper credit and the GPL is incorporated herein
# by reference http://www.gnu.org/licenses/licenses.html#GPL
# 
# Simple Script to convert m4a's to vorbis files while retaining
# the tag information and saving as vorbis tags

# Set the quality level to be used by the encoder
QUALITY=6		#1-10 (4=100-128kb/s)

# My iriver iMP-350 CD/MP3 player supports ogg vorbis files, but only 
# between a bitrate range of 96-160.  My iFP-799 only supports a
# bitrate range of 96-225.  In order to prevent sections of 
# music tracks from dropping out if the rate temorarily falls outside
# of this range, I set the maximum and and minimum bitrates here.  
# Comment out the following two lines if you don't want to do this.
#MIN=96				#integer, sets the minimum bitrate
#MAX=225			#integer, sets the maximum bitrate


if [ $# -lt 1 ]; then
  echo "        Usage:  `basename $0` <ogg/ogg's>" 1>&2
  exit 1
fi

# My digital music files are stored on a samba server that serves up the
# the files to both Windows and Linux clients.  I have all users connect
# to the samba share as a member of group "mp3", and I want each user
# to be able to manipulate the files (rename, move, etc.) so I need to 
# make sure the umask is set to 002, thus giving the group write 
# permissions to the file. Comment out this section if you don't want to 
# modify your default umask
if [ $( umask ) != "0002" ] ; then
	echo "Checking to see if umask is set properly... No"
	umask 002
	echo "Setting umask to `umask`"
else
        echo "Checking to see if umask is set properly... Yes"
fi

# In order to allow this script to process more than one file, up to 
# the contents of an entire directory, we must start a loop which will
# be executed until there are no more input files. 
while [ -n "$1" ]; do

# Set variables for filename to process and the intermediate wav file
filename="$1"
wavname=$(echo "$filename" | sed -e 's/m4a/wav/g' )

# Extract tag information to a temporary file
faad -i "${filename}" 2> "${filename}".temp

# grep temporary file and set variables for various tag fields
ARTIST=`cat "${filename}.temp" | grep -i "artist:" | cut -d ":" -f2 | cut -c 2-`
ALBUM=`cat "${filename}.temp" | grep -i "album:" | cut -d ":" -f2 | cut -c 2-`
TITLE=`cat "${filename}.temp" | grep -i "title:" | cut -d ":" -f2 | cut -c 2-`
TRACKNUMBER=`cat "${filename}.temp" | grep -i "track:" | cut -d ":" -f2 | cut -c 2-`
DATE=`cat "${filename}.temp" | grep -i "date:" | cut -d ":" -f2 | cut -c 2-`
GENRE=`cat "${filename}.temp" | grep -i "genre:" | cut -d ":" -f2 | cut -c 2-`
ORIG_BR=$(echo $[ (`cat "${filename}.temp" | grep -i "Nominal bitrate" | cut -d ":" \
-f2 | cut -d "." -f1`) ]) # Add a note field to the tag info to prevent this file \
from being  # confused with the original
NOTE="Re-encoded at quality setting ${QUALITY} from an AAC file"

# Remove the temporary file created in the previous step
rm -f "${filename}.temp"

# Extract the file being processed to a temporary wav file.  Note 
# that this temporary wav file is written to the local users ~/tmp so 
# that if the file to be processed is on a network share, the temporary 
# file does not have to be copied across the network twice before it 
# can be re-encoded.  The performance of the re-encoding operation is 
# improved significantly.
echo ""
echo "Decoding original m4a file to temporary wav using faad"
faad "${filename}" -o "${HOME}/tmp/${wavname}"

# Encode the temporary wav file.  We use output filename that builds a 
# separate tree structure to make managing files of different bitrate
# easier. This assumes the directory structure is quality/artist/album,
# so if original files exist in a directory like q6/artist/album,
# output will be written to directory q4/artist/album.  Note this will
# also correct poorly done filenames as long as the tags are accurate.
# This is important for me, since my iFP-799 does not read ogg tags,
# but instead displays the filenames.  Also give some user feedback about
# what we are doing.
echo ""
echo "Encoding to .ogg file using quality setting ${QUALITY}"
echo ""
oggenc	-q "${QUALITY}" \
	-a "${ARTIST}" \
	-l "${ALBUM}" \
	-t "${TITLE}" \
	-N "${TRACKNUMBER}" \
	-d "${DATE}" \
	-c "=${NOTE}" \
	-G "${GENRE}" "$HOME/tmp/$wavname" -o \
"$HOME/transKode/$ARTIST/$ALBUM/$TRACKNUMBER-$TITLE.ogg"  #-G "${GENRE}" \
"$HOME/tmp/$wavname" -o "../../../q$QUALITY/$ARTIST/$ALBUM/$TRACKNUMBER-$TITLE.ogg"  \
#--managed \  #-m "${MIN}" \
	#-M "${MAX}" \
		

	
# Clean up after ourselves by removing the temporary wav file that 
# we made in a previous step.
rm -f "${HOME}/tmp/${wavname}"

# Shift positional parameters by 1 in order to prevent the processing
# of the same file over and over in an endless loop
shift;

# Break out of the loop when there are no more input files to process
done

# Give some user feedback that we are finished with this run.
echo "Done... finished transcoding .m4a to .ogg files using quality setting \
${QUALITY}!"

exit 0



_______________________________________________
Amarok mailing list
Amarok@kde.org
https://mail.kde.org/mailman/listinfo/amarok


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic