Home Latest show Previous shows Presenters Forums Contact FAQ LugRadio Live Map Planet #lugradio

Help requested on audio encoding

General discussion about the LUGRadio shows.

Moderators: mrben, jono, matt, trig

User avatar
MoLE
New to the freak show
 
Posts: 9
Joined: Sun Jun 24, 2007 10:39 am
Location: Australia

Re: Help requested on audio encoding

Postby MoLE on Tue Oct 30, 2007 9:38 pm

Thanks Aq.

spamfree
New to the freak show
 
Posts: 30
Joined: Sat Sep 01, 2007 8:26 pm

Re: Help requested on audio encoding

Postby spamfree on Sun Nov 25, 2007 11:32 pm

Aq,

I just stumbled upon this thread. I am fairly certain that I have determined the problems with MP3s as being form the use of ABR instead of CBR. Please see my post in the other thread

Greatly appreciate your work.

Cheers.

User avatar
R.Smith
Knows their stuff
 
Posts: 183
Joined: Fri Nov 09, 2007 7:40 pm
Location: Cardiff, UK

Re: Help requested on audio encoding

Postby R.Smith on Mon Nov 26, 2007 9:36 pm

spamfree wrote:I have determined the problems with MP3s as being form the use of ABR instead of CBR.

I thought I determined that? :roll:
Image Please support the FSF!

longlife
New to the freak show
 
Posts: 1
Joined: Tue Dec 04, 2007 5:17 am

Re: Help requested on audio encoding

Postby longlife on Tue Dec 04, 2007 5:25 am

Aq wrote:
MoLE wrote:Ok, I'm going to try and recreate the problem for my player - which version of oggenc are you using?

aquarius@lugradio:~$ oggenc -v
OggEnc v1.0.2


I am having the same problem with my iriver T30. The low quality ogg works, the high quality not. I just tested encoding a file with oggenc -q1 ro -q4 on my machine and all of them work fine on my iriver. I am using the oggenc that comes with Fedora 8:

$ oggenc -v
oggenc from vorbis-tools 1.1.1.svn20070412

This seems to be newer than the oggenc you use, so maybe you should use a newer version of vorbis-tools.

User avatar
Aq
LugRadio Presenter
 
Posts: 2233
Joined: Mon Mar 01, 2004 4:38 pm

Re: Help requested on audio encoding

Postby Aq on Tue Dec 04, 2007 11:12 am

longlife wrote:
Aq wrote:
MoLE wrote:Ok, I'm going to try and recreate the problem for my player - which version of oggenc are you using?

aquarius@lugradio:~$ oggenc -v
OggEnc v1.0.2


I am having the same problem with my iriver T30. The low quality ogg works, the high quality not. I just tested encoding a file with oggenc -q1 ro -q4 on my machine and all of them work fine on my iriver. I am using the oggenc that comes with Fedora 8:

$ oggenc -v
oggenc from vorbis-tools 1.1.1.svn20070412

This seems to be newer than the oggenc you use, so maybe you should use a newer version of vorbis-tools.

Aha. That's very useful, indeed. Thanks for that; I'll try and have that fixed for next time. (Hopefully I can find a backport of vorbis-tools for the ancient Debian version that the encoder machine uses :))

infirit
New to the freak show
 
Posts: 10
Joined: Fri Oct 05, 2007 10:31 am

Re: Help requested on audio encoding

Postby infirit on Tue Dec 04, 2007 3:56 pm

Aq wrote:Aha. That's very useful, indeed. Thanks for that; I'll try and have that fixed for next time. (Hopefully I can find a backport of vorbis-tools for the ancient Debian version that the encoder machine uses :))
Maybe.... Libvorbis is actually where the methods for encoding come from and not vorbistools.

The version of libvorbis is more important than the version of the tools. The tools can be build against libvorbis 1.0.2 instead of libvorbis 1.1.1. It is however a fair assumption but it would be wise to check.

spd106
New to the freak show
 
Posts: 1
Joined: Wed Dec 05, 2007 11:50 am

Re: Help requested on audio encoding

Postby spd106 on Wed Dec 05, 2007 12:24 pm

Just a simple suggestion for Album art.

My Samsung YP-Z5F supports Ogg Vorbis, but it doesn't display embedded art from Ogg files. Instead it will use a jpeg file <= 300x300px, with the name albumart.jpg in the same folder as the Ogg files. This is also supported by Rhythmbox, so I can just copy the album folder via UMS.

Perhaps suitable jpeg could be linked to in the downloads section. I'm currently using one I borrowed from the gallery and resized/cropped down to size.

So far I've not had problems playing any of the audio.

User avatar
MoLE
New to the freak show
 
Posts: 9
Joined: Sun Jun 24, 2007 10:39 am
Location: Australia

Re: Help requested on audio encoding

Postby MoLE on Tue Jan 15, 2008 1:10 pm

Ok, I'm trying to duplicate the process that Aq uses to encode the show.

We know he starts with a high quality mp3 (see sample in initial post). We also know he uses oggenc to encode to ogg.

I know (and one other poster has confirmed for iriver models) that the high-quality ogg doesn't work, but the low-quality ogg does.

The missing piece of the puzzle is: Oggenc doesn't accept mp3 as an input format, from the --help page:

Code: Select all
INPUT FILES:
OggEnc input files must currently be 24, 16, or 8 bit PCM WAV, AIFF, or AIFF/C
files, 32 bit IEEE floating point WAV, and optionally FLAC or Ogg FLAC. Files
  may be mono or stereo (or more channels) and any sample rate.
Alternatively, the --raw option may be used to use a raw PCM data file, which
must be 16 bit stereo little-endian PCM ('headerless wav'), unless additional
parameters for raw mode are specified.
You can specify taking the file from stdin by using - as the input filename.
In this mode, output is to stdout unless an output filename is specified
with -o


Anyone have any ideas which tool Aq might use to convert from mp3 --> wav /flac. A quick aptitude search in Ubuntu doesn't reveal any obvious commandline tools.

I've tested oggenc -q 3 on several flac files of my own which all play fine on my ogg player.

What I'm getting to in a painfully slow way is - perhaps the problem lies with the first step rather than the last one.

I suspect I'm such a n00b that the answer is obvious to everyone else, but I have to pose the question anyway.

User avatar
Aq
LugRadio Presenter
 
Posts: 2233
Joined: Mon Mar 01, 2004 4:38 pm

Re: Help requested on audio encoding

Postby Aq on Tue Jan 15, 2008 1:17 pm

MoLE wrote:Ok, I'm trying to duplicate the process that Aq uses to encode the show.

Then it would be useful to you to have my encoding script, I suspect. :)

Code: Select all
# Encode the LugRadio master to the four formats and do everything else
# to allow release, other than actually releasing the episode
# sil, August 2007

STARTTIME=$(date +%s)
CURDIR=$(dirname $0)
cd $CURDIR
LOG=output.log

echo Please wait...doing initial checks...

echo -------------------------------------------------|tee -a $LOG
echo Begin new encode as requested by $(whoami) at $(date)|tee -a $LOG
echo -------------------------------------------------|tee -a $LOG

# First, find an mp3 file in this folder. There should be one and only one.
MP3COUNT=$(ls *.mp3 | wc -l)
if [ "$MP3COUNT" != "1" ]; then
  echo "There should be one and only one mp3 file in this folder."|tee -a $LOG
  echo "Please remove all files other than the latest one and run this again."|tee -a $LOG
  echo "Terminating."|tee -a $LOG
  exit
fi

MASTER=$(ls *.mp3)
echo Working with master file $MASTER |tee -a $LOG

# work out the details of this file
SEASON=$(python details.py --season $(basename $MASTER))
EPISODE=$(python details.py --episode $(basename $MASTER))
RELEASEDATE=$(python details.py --releasedate $(basename $MASTER))

# Check that it succeeded; the python script prints FAIL if something went wrong
if $(echo lugradio-s{$SEASON}{e$EPISODE}-{$RELEASEDATE}-low.mp3 | grep -q FAIL > /dev/null); then
  echo "Something went wrong with getting the season/episode details."|tee -a $LOG
  echo The output I got was lugradio-s${SEASON}e${EPISODE}-${RELEASEDATE}-low.mp3 | tee -a $LOG
  echo "Terminating."|tee -a $LOG
  exit
fi

WAV=$(basename $MASTER .mp3).wav
echo Decompressing the master to $WAV|tee -a $LOG
# Encode the master to a wav file
lame -S --decode $MASTER $WAV|tee -a $LOG

HIGHOGG=lugradio-s${SEASON}e${EPISODE}-${RELEASEDATE}-high.ogg
HIGHMP3=lugradio-s${SEASON}e${EPISODE}-${RELEASEDATE}-high.mp3
LOWOGG=lugradio-s${SEASON}e${EPISODE}-${RELEASEDATE}-low.ogg
LOWMP3=lugradio-s${SEASON}e${EPISODE}-${RELEASEDATE}-low.mp3

echo Encoding to high ogg $HIGHOGG|tee -a $LOG
oggenc -q3 --output=$HIGHOGG \
       -t "Episode $EPISODE" -l "Season $SEASON" -a "LugRadio" \
       -G "Spoken word" -d $(date +%Y) \
       $WAV

echo Encoding to low ogg $LOWOGG|tee -a $LOG
oggenc --quality=-1 --output=$LOWOGG  \
       -t "Episode $EPISODE" -l "Season $SEASON" -a "LugRadio" \
       -G "Spoken word" -d $(date +%Y) \
       $WAV

echo Encoding to high mp3 $HIGHMP3|tee -a $LOG
lame -m m -b 64 -k -S \
     --tt "Episode $EPISODE" --ta "LugRadio" \
     --tl "Season $SEASON" --tn $EPISODE --tg "Other" --ty $(date +%Y) \
     $WAV $HIGHMP3

echo Encoding to low mp3 $LOWMP3|tee -a $LOG
lame -m m -b 32 -k -S  \
     --tt "Episode $EPISODE" --ta "LugRadio" \
     --tl "Season $SEASON" --tn $EPISODE --tg "Other" --ty $(date +%Y) \
     $WAV $LOWMP3

echo Removing intermediate files|tee -a $LOG
rm $WAV

echo Checking file sizes look OK|tee -a $LOG
if $(python checkFileSize.py $LOWOGG $MASTER 20 | grep -q FAIL > /dev/null); then
  echo The file size for the low ogg is outside what looks reasonable.|tee -a $LOG
  echo Terminating.|tee -a $LOG
  exit
fi
if $(python checkFileSize.py $HIGHOGG $MASTER 50 | grep -q FAIL > /dev/null); then
  echo The file size for the high ogg is outside what looks reasonable.|tee -a $LOG
  echo Terminating.|tee -a $LOG
  exit
fi
if $(python checkFileSize.py $HIGHMP3 $MASTER 50 | grep -q FAIL > /dev/null); then
  echo The file size for the high mp3 is outside what looks reasonable.|tee -a $LOG
  echo Terminating.|tee -a $LOG
  exit
fi
if $(python checkFileSize.py $LOWMP3 $MASTER 20 | grep -q FAIL > /dev/null); then
  echo The file size for the low mp3 is outside what looks reasonable.|tee -a $LOG
  echo Terminating.|tee -a $LOG
  exit
fi

echo Creating check files for us to listen to|tee -a $LOG

for f in 0 1 2 3 4 5; do
  mp3splt $HIGHMP3 ${f}1.00 ${f}1.04 -o high-$f || \
  (echo High mp3 split failed at ${f}1.00 && exit) | tee -a $LOG;
done
if [ ! -f high-5.mp3 ]; then
  echo Split of high mp3 failed because high-5.mp3 does not exist | tee -a $LOG
  exit
fi
mpgjoin --force high-1.mp3 MP3CLICK high-2.mp3 MP3CLICK high-3.mp3 MP3CLICK \
                high-4.mp3 MP3CLICK high-5.mp3 -o check-high.mp3 | tee -a $LOG
rm high-?.mp3
for f in 0 1 2 3 4 5; do
  mp3splt $LOWMP3 ${f}1.00 ${f}1.04 -o low-$f | tee -a $LOG;
done
if [ ! -f low-5.mp3 ]; then
  echo Split of low mp3 failed because low-5.mp3 does not exist | tee -a $LOG
  exit
fi
mpgjoin --force low-1.mp3 MP3CLICK low-2.mp3 MP3CLICK low-3.mp3 MP3CLICK \
                low-4.mp3 MP3CLICK low-5.mp3 -o check-low.mp3 | tee -a $LOG
rm low-?.mp3

# get the number of the most recently released episode
LASTEP=$(HEAD http://www.lugradio.org/episodes/latest -UuSse | grep "200 OK" | \
  cut -d" " -f2 | cut -d"/" -f5)
NEXTEP=$(($LASTEP+1))
TOTALTIME=$(( $(date +%s) - $STARTTIME ))
sed "s/SERIES/$SEASON/g;s/EPISODE/$EPISODE/g;s/EPNO/$NEXTEP/g;s/TIME/$TOTALTIME/
g" mail-done-message | \
  mail -s "Encoding done" show@lugradio.org

echo Finished at $(date)  | tee -a $LOG


Hope that helps...

User avatar
R.Smith
Knows their stuff
 
Posts: 183
Joined: Fri Nov 09, 2007 7:40 pm
Location: Cardiff, UK

Re: Help requested on audio encoding

Postby R.Smith on Tue Jan 15, 2008 1:19 pm

MoLE wrote:Anyone have any ideas which tool Aq might use to convert from mp3 --> wav /flac. A quick aptitude search in Ubuntu doesn't reveal any obvious commandline tools.


Aq currently uses LAME to decode the .mp3 back to .wav for conversion to Vorbis, according to his first post in this thread:

Aq wrote:(decode mp3 to wav with lame -S --decode $MASTER $WAV)


Personally, I suspect the resampling for the Vorbis encoding is the problem but I don't have a physical device that plays Vorbis files to check. Perhaps just encoding at a smaller bitrate would be best, leaving out the resampling altogether.

Edit: Interesting. After looking at Aq's encoding script I notice that the resampling no longer occurs during the .mp3/Vorbis encoding. Does Jono modify the sample rate for the master .mp3?
Image Please support the FSF!

User avatar
MoLE
New to the freak show
 
Posts: 9
Joined: Sun Jun 24, 2007 10:39 am
Location: Australia

Re: Help requested on audio encoding

Postby MoLE on Tue Jan 15, 2008 2:47 pm

Please feel free to ignore me as I'm obviously a gimp who can't read Aq's initial post. I blame the scary $VARIBLES $IN $CAPS.

I think I've nailed the problem by comparing the ogginfo of the various high-quality oggs of the show that I know do work with those I know don't work.

I think the problem is in the sampling rate.

Known broken ogg file (for my iriver player).

Code: Select all
mole@ubuntu-laptop:~/temp$ ogginfo lugradio-s05e01-240907-high.ogg
Processing file "lugradio-s05e01-240907-high.ogg"...

New logical stream (#1, serial: 1eeabebc): type vorbis
Vorbis headers parsed for stream 1, information follows...
Version: 0
Vendor: Xiph.Org libVorbis I 20050304
Channels: 1
Rate: 32000

Nominal bitrate: 56.000000 kb/s
Upper bitrate not set
Lower bitrate not set
User comments section follows...
        title=Episode 01
        artist=LugRadio
        genre=Spoken word
        date=2007
        album=Season 05
Vorbis stream 1:
        Total data length: 29220254 bytes
        Playback length: 67m:12.523s
        Average bitrate: 57.969167 kb/s
Logical stream 1 ended


Known working ogg file.

Code: Select all
mole@ubuntu-laptop:~/temp$ ogginfo lugradio-s04e16-090407-high.ogg
Processing file "lugradio-s04e16-090407-high.ogg"...

New logical stream (#1, serial: 091406f9): type vorbis
Vorbis headers parsed for stream 1, information follows...
Version: 0
Vendor: Xiph.Org libVorbis I 20050304
Channels: 1
Rate: 48000

Nominal bitrate: 48.000000 kb/s
Upper bitrate not set
Lower bitrate not set
User comments section follows...
        TITLE=Season 04 Episode 16
        ARTIST=LugRadio
        ALBUM=04
        DATE=2007
        GENRE=Speech
        DESCRIPTION=www.lugradio.org
        COMMENT=www.lugradio.org
        =www.lugradio.org
Vorbis stream 1:
        Total data length: 33613692 bytes
        Playback length: 88m:43.076s
        Average bitrate: 50.517687 kb/s
Logical stream 1 ended


I also noticed the sampling rate of the latest episode (s05e09) is 44100, so I'm going to test that & see if it works.

I was suprised how old the libvorbis encoder was too.

User avatar
Aq
LugRadio Presenter
 
Posts: 2233
Joined: Mon Mar 01, 2004 4:38 pm

Re: Help requested on audio encoding

Postby Aq on Tue Jan 15, 2008 3:24 pm

MoLE wrote:I also noticed the sampling rate of the latest episode (s05e09) is 44100, so I'm going to test that & see if it works.

This is really useful stuff you're doing here, I have to say, and thanks. I'll be highly interested in the results of your tests: if you can tell me which command lines I should use to encode both the high ogg and the low ogg and have them both work, I'll be very grateful (and I'll start doing it immediately!)

User avatar
MoLE
New to the freak show
 
Posts: 9
Joined: Sun Jun 24, 2007 10:39 am
Location: Australia

Re: Help requested on audio encoding

Postby MoLE on Tue Jan 15, 2008 3:40 pm

Aq wrote:This is really useful stuff you're doing here, I have to say, and thanks.


Thanks for the encouragement Aq, I'll keep working on it.

User avatar
R.Smith
Knows their stuff
 
Posts: 183
Joined: Fri Nov 09, 2007 7:40 pm
Location: Cardiff, UK

Re: Help requested on audio encoding

Postby R.Smith on Tue Jan 15, 2008 4:56 pm

Aq wrote:...if you can tell me which command lines I should use to encode...


Aq, the funny thing is that your encoding script no longer seems be adjusting the sample rate any more (compared to your initial post in this thread) and the commands you are passing to oggenc via that script are, if I'm reading it correctly, sane. If, as I originally surmised, the sample rate is the problem, we need to find out where it's being altered. Which makes me wonder whether the sample rate is modified when Jono encodes the master mp3.

Edit: I have a possible clue:

LAME man page wrote:LAME will automatically resample the input file to one of the supported MP3 samplerates if necessary.


I suspect that when the master .mp3 is encoded prior to being sent to Aq, LAME is doing some up/down sampling of the original .wav file.
Image Please support the FSF!

User avatar
Aq
LugRadio Presenter
 
Posts: 2233
Joined: Mon Mar 01, 2004 4:38 pm

Re: Help requested on audio encoding

Postby Aq on Tue Jan 15, 2008 5:29 pm

R.Smith wrote:
Aq wrote:...if you can tell me which command lines I should use to encode...


Aq, the funny thing is that your encoding script no longer seems be adjusting the sample rate any more (compared to your initial post in this thread) and the commands you are passing to oggenc via that script are, if I'm reading it correctly, sane.

I took the advice given earlier in this thread (and another) and altered the commands I use to encode, so the script has changed since this thread started. The posted script above is the current one.

PreviousNext

Return to General Discussion

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest

cron