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
Aq
LugRadio Presenter
 
Posts: 2233
Joined: Mon Mar 01, 2004 4:38 pm

Help requested on audio encoding

Postby Aq on Fri Oct 05, 2007 9:35 am

All,

I currently (as of s5) encode the show from Jono's master high-quality mp3. I'm not sure I'm doing the encoding right. In particular, there are three things I'd like to address:

1. Some mp3 players play the show mp3s at the wrong rate (sped-up and squeaky) and don't display accurate timings for how long the show is. For an example of this, see the Digg podcast page for LugRadio (go to Digg, click Podcasts at the top, search for "lugradio") and try clicking "listen" on the page for S5E1. The Flash player there plays the episode at the wrong speed.
2. I don't know whether I'm getting the best compromise of file size against audio quality.
3. I don't know how to embed album art in the mp3s and oggs.

To that end, I come to ask for your help. There is a sample clip of Jono's master S5E1 mp3 available at http://audio.lugradio.org/lugradio-sample-clip.mp3. I would currently encode this with the following commands:

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

oggenc -b 56 --resample 32000 --output=$HIGHOGG $WAV # high-quality ogg
oggenc -b 22 --resample 22000 --output=$LOWOGG $WAV # low-quality ogg
lame --abr 56 -S $WAV $HIGHMP3 # high-quality mp3
lame --abr 22 -S $WAV $LOWMP3 # low-quality mp3

(I also add the id3 tags in these commands, but I've stripped that out for clarity)

Here's your chance to help me out. Which settings should I be using? It's most important to stop the squeaky effect in some mp3 players -- I suspect that this is a result of a bug in those mp3 players, but I'd like to have the show work everywhere if possible. Some indication of what else I can do to improve quality or decrease filesize would be good, and if someone already knows how to add the album art then that'd be great!

Thanks in advance for your help, all.

Aq.

lord_rel
New to the freak show
 
Posts: 73
Joined: Tue May 08, 2007 12:28 pm

Re: Help requested on audio encoding

Postby lord_rel on Fri Oct 05, 2007 10:25 am

im not an expert but why are you using mp3 as the base file? transcoding lossy to lossy is bad

ogg enc will work better if you use the -q (with the values -2,-1 or 0) flag as it will use the internal algorithm for deciding the data level or you can use the -m and -M to maximize control
this article probably covers it better
http://wiki.hydrogenaudio.org/index.php ... r_Settings

for encoding with lame
http://wiki.hydrogenaudio.org/index.php ... r_settings

BTW the hashluradio S05E01 sounded awesome with stereo!

User avatar
lofty
Concerningly committed to LugRadio
 
Posts: 514
Joined: Sun May 22, 2005 12:24 am
Location: Lancashire UK

Re: Help requested on audio encoding

Postby lofty on Fri Oct 05, 2007 10:32 am

lord_rel wrote:im not an expert but why are you using mp3 as the base file? transcoding lossy to lossy is bad


On that subject, do you know about flac - free lossless audio codec. It cuts stored file sizes by about half compared to the original wav, without losing any quality.

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 Fri Oct 05, 2007 11:20 am

The speeding up of the audio is a result of the player not being able to cope with different samplerates. Many player can not deal with anything but 44.1khz.

Now, I would not put in the bit rate with -b 56 or 22 use the quality settings of 1, 0 and -1 (yes it exists ;-)). The quality based settings in vorbis are actualy superior to the bitrate settings and in 90% of the cases will have lower filesize with comparable bitrate.

When you resample to 32khz there is no real gain in filesize or bitrate! See below my experiments with various options.
You have file with samplerate and quality setting - file size in bytes - average bitrate.

Code: Select all
lugradio-sample-clip-44.1khz-q-1.ogg 1350282 Average bitrate: 35,911758 kb/s
lugradio-sample-clip-44.1khz-q0.ogg  1837280 Average bitrate: 48,897699 kb/s
lugradio-sample-clip-44.1khz-q1.ogg  2229600 Average bitrate: 59,368585 kb/s
lugradio-sample-clip-44.1khz-56k.ogg 2100683 Average bitrate: 55,921371 kb/s

lugradio-sample-clip-32khz-q-1.ogg  1315620 Average bitrate: 34,987490 kb/s
lugradio-sample-clip-32khz-q0.ogg   1727746 Average bitrate: 45,976959 kb/s
lugradio-sample-clip-32khz-q1.ogg   2089053 Average bitrate: 55,620879 kb/s
lugradio-sample-clip-32khz-56k.ogg  2169949 Average bitrate: 57,777981 kb/s


oggenc should be able to encode directly from flac so why not use that instead of a mp3 file? This will reduce the quality loss. In its highest compression mode it will reduce it approximately to 50% of it's original filesize.

The speeding up effect is mostly noticeable for vorbis files as many player do not implement it well (only 44.1khz). Mp3 in general is better implemented in players so this would not happen too much but expect it on VERY cheap mp3 players. Personally I would not bother putting up an MP3 file :mrgreen:

So as a last note I would not resample to either 22 or 32 khz. Although 22khz will provide much lower bitrates and filesizes at the cost of a lot of quality. Why not get the statistics from the downloads and see how many are actually downloading the 22khz files?
Last edited by infirit on Fri Oct 05, 2007 12:26 pm, edited 3 times in total.

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 Fri Oct 05, 2007 11:24 am

lord_rel wrote:im not an expert but why are you using mp3 as the base file? transcoding lossy to lossy is bad
If you have trained ears like audio professionals you will hear the difference but 80% of the people do not. Also sound is very subjective, what I find acceptable to listen to for other will be a horrible experience ;-)

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 Fri Oct 05, 2007 11:27 am

Aq wrote:3. I don't know how to embed album art in the mp3s and oggs.

There are very few players that support the embeded images in mp3 and it is not supported in ogg at all.

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

Re: Help requested on audio encoding

Postby Aq on Fri Oct 05, 2007 1:26 pm

infirit wrote:
Aq wrote:3. I don't know how to embed album art in the mp3s and oggs.

There are very few players that support the embeded images in mp3 and it is not supported in ogg at all.

Ah, but having an embedded picture doesn't degrade the experience for those that don't support it, and it's a nice easter egg for those that do; of the three players I've used recently (Totem, the Archos PMA400, the Nokia E50) two of them supported embedded album art.

Aq.

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 Fri Oct 05, 2007 1:47 pm

Aq wrote:Ah, but having an embedded picture doesn't degrade the experience for those that don't support it, and it's a nice easter egg for those that do; of the three players I've used recently (Totem, the Archos PMA400, the Nokia E50) two of them supported embedded album art.

Then look at EyeD3 (written in python so you can import it 8)) as this supports tagging images. You will have to fiddle with TYPE for it to show in the player.

edit: I forgot to add that there probably are size constraints (width/height) in the player, so keep it at 256x256 or 64x64 exactly.
Code: Select all
--add-image=IMG_PATH:TYPE[:DESCRIPTION]
                          Add an image to the tag.  The description and type
                          optional, but when used, both ':' delimiters must be
                          present.  The type MUST be an string that corresponds to
                          one given with --list-image-types. If the IMG_PATH value
                          is empty the APIC frame with TYPE is removed.

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

Re: Help requested on audio encoding

Postby Aq on Fri Oct 05, 2007 2:14 pm

Wow, this is hugely useful. Thanks, infirit!

Aq.

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

Re: Help requested on audio encoding

Postby Aq on Fri Oct 05, 2007 2:21 pm

infirit wrote:Now, I would not put in the bit rate with -b 56 or 22 use the quality settings of 1, 0 and -1 (yes it exists ;-)). The quality based settings in vorbis are actualy superior to the bitrate settings and in 90% of the cases will have lower filesize with comparable bitrate.

Good suggestion. I'll start doing that for the ogg vorbis files.

infirit wrote:oggenc should be able to encode directly from flac so why not use that instead of a mp3 file?

The main reason is that we don't *have* a FLAC file. Jono would have to produce one, and Cubase (which he uses) apparently doesn't support output as FLAC, which means that he'd have to output to wav and then encode to flac with some other program before uploading, and that's extra work for him that I don't want him to have to do. I know that there'll be a slight loss of quality through making the master a lossy mp3, but it's set to pretty high quality settings; I'd like to try making our distributed MP3s from both the master mp3 and a master flac and then put people through an ABX test to see if it makes any difference ;-)

infirit wrote:The speeding up effect is mostly noticeable for vorbis files as many player do not implement it well (only 44.1khz). Mp3 in general is better implemented in players so this would not happen too much but expect it on VERY cheap mp3 players. Personally I would not bother putting up an MP3 file :mrgreen:

So as a last note I would not resample to either 22 or 32 khz. Although 22khz will provide much lower bitrates and filesizes at the cost of a lot of quality. Why not get the statistics from the downloads and see how many are actually downloading the 22khz files?

I am sympathetic to the no-mp3-at-all argument, but I fear that although our audience would be much more committed to my free software ideals, there'd only be about 500 of them :) A substantial proportion of our audience downloads the low-quality mp3, because if you've only got a small cheap flash-based mp3 player with 512MB or 1GB of storage (the sort of thing that you can buy for £20) then a 50MB higih-quality mp3 is a substantial fraction of your total disc space. If we removed anything it'd be the low-quality ogg, since no-one's walking around with a 512MB player that can play oggs. :)

Aq.

User avatar
msemtd
Knows their stuff
 
Posts: 195
Joined: Thu Feb 24, 2005 10:19 am
Location: Nottingham

Re: Help requested on audio encoding

Postby msemtd on Fri Oct 05, 2007 3:41 pm

No way! I just tackled the sample rate problem for my Sony MP3 walkman and was back on the forums here to see if anyone else was having a problem with s05e01...
from http://www.tecspy.com/sonymp3
Code: Select all
Update: Friday 05 Oct 2007
now running version 13
Found that the latest lugradio episode (s05e01) runs too fast when copied to the player: hosted by Pinky & Perky! this seems to be due to the sampling frequency which seems to be 32000 Hz instead of the more typical 44100 Hz...
Quick workaround: convert to wav file...
mpg123 -w lugradio-s05e01.wav lugradio-s05e01-240907-high.mp3
then re-encode at 44.1kHz...
michael@fs1:~/sound/bashpodder$ lame -h -cbr --resample 44.1 lugradio-s05e01.wav lugradio-s05e01.mp3
And now it's all fine!
Michael Erskine
Nottingham GNU/Linux Users Group

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 Fri Oct 05, 2007 3:43 pm

Aq wrote:A substantial proportion of our audience downloads the low-quality mp3, because if you've only got a small cheap flash-based mp3 player with 512MB or 1GB of storage (the sort of thing that you can buy for £20) then a 50MB higih-quality mp3 is a substantial fraction of your total disc space.

To stop lame from resampling to 32 and 22khz pass it the -k option and avoid the speedup. I tested some preset options in lame which you might want to try.

Code: Select all
44.1khz (original samplerate)
lame --preset 56 -k <infile> <outfile> (file size 2070282)
lame --preset 22 -k <infile> <outfile> (file size 1221216)

32khz
lame --preset 56 --resample 32 <infile> <outfile> (file size 2097072)
lame --preset 22 --resample 32 <infile> <outfile> (file size 1210608)

22khz
lame --preset 56 --resample 22 <infile> <outfile> (file size 2066023)
lame --preset 22 --resample 22 <infile> <outfile> (file size 853450)

Again you see that resamplig to 32khz is not impacting bitrate/filesize that much when using abr. Only on 22khz and 22 KB/s there is a real difference in filesize when resampling.

For me anything encoded at 22 KB/s is horrible but 56 KB/s is still acceptable for voice.

Hope this helps :-)

lord_rel
New to the freak show
 
Posts: 73
Joined: Tue May 08, 2007 12:28 pm

Re: Help requested on audio encoding

Postby lord_rel on Fri Oct 05, 2007 3:50 pm

from what i read about cubase it supports ogg as well so he could send you a -q10 ogg file which is very high quality if he cant use a drag and drop frontend to flac (flacdrop)

easytag supports adding an embedded cover to mp3

as it wasnt mentioned before the -q flag supports more specific tweaks such as 2.5 or 1.2

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 Fri Oct 05, 2007 3:57 pm

msemtd wrote:[code]
Found that the latest lugradio episode (s05e01) runs too fast when copied to the player: hosted by Pinky & Perky! this seems to be due to the sampling frequency which seems to be 32000 Hz instead of the more typical 44100 Hz...
I really do not understand why the player manufacturers (especially a large company like sony) do not implement samplerate conversions in their players :? Even worse they do not mention it anywhere on the website or the manual :evil:

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

Re: Help requested on audio encoding

Postby Aq on Fri Oct 05, 2007 4:30 pm

lord_rel wrote:from what i read about cubase it supports ogg as well so he could send you a -q10 ogg file which is very high quality

The master mp3 is already very high quality. There's no point in doing *different* lossy compression; if we bother to fix this (pretty insignificant) step in the encoding process, we'll go to lossless compression like FLAC for the master, not a different lossy file format.

Aq.

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest

cron