LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 01-15-2010, 05:04 AM   #1
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Exclamation ffmpeg: vorbis vs. libvorbis


I'm not asking for help here, just documenting something I just discovered.

Yesterday I wanted to batch-convert a bunch of old wma files to ogg vorbis. Not wanting to go through intermediate wav files, I tried to use ffmpeg to do it in one go. I first tried using the following command (in a loop, which I won't print here).

Code:
ffmpeg -i $file -f ogg -acodec vorbis -ab 192k outputdir/$file
"vorbis" turns out to be the built-in libavc implementation of the codec. In the process I discovered that the -ab value is always ignored. No matter what value you put, the output is always the default 64k (average, but of course it's vbr). You can however use the poorly-documented -aq option to set the audio quality used. The values don't correspond to the oggenc values though, being a number ranging from 10-100 (or more, I don't know what the maximum is). It's not exactly clear what number corresponds to what average bitrate, so you have to experiment. ~30 seems to give you an average-rate file, while anything above 60 is probably overkill.

Switching to the external libvorbis gave me more flexibility, although at a cost of much longer encoding times (note that ffmpeg must have been compiled with libvorbis support first).
Code:
ffmpeg -i $file -f ogg -acodec libvorbis -ab 192k outputdir/$file

ffmpeg -i $file -f ogg -acodec libvorbis -aq 6 outputdir/$file
I could use both -ab and -aq (with the numbers corresponding to the oggenc values), with no problems. ffmpeg does display some wrong values in it's output text, however.

In addition, there's one more difference. The vorbis (libavc) codec provides an entry in the header of the ogg container reporting the average bitrate, but it doesn't appear to provide a similar bitrate header in the vorbis stream itself. Some programs may not report the bitrate value because of this.

libvorbis provides both headers, avoiding that problem.

So to summarize, libvorbis appears to be a better codec choice than vorbis.
 
Old 01-26-2010, 05:46 PM   #2
jis
LQ Newbie
 
Registered: Jan 2009
Distribution: Xubuntu
Posts: 13

Rep: Reputation: 0
I tried libvorbis encoder by ffmpeg for converting some FLAC file to Vorbis. I found out that if you use both -aq and -ab with it, the encoding is done using the -aq setting, which sets bitrate accordingly. I suppose it uses this table: http://en.wikipedia.org/wiki/Vorbis#Technical_details (though sizes of files encoded using either -aq 8 or -ab 256k did not match exactly, but were relatively close.)

If you use -aq setting with libvorbis, there is no big difference in encoding times, when compared to vorbis. But if you use -ab setting, encoding time more than doubles. I don't see any advantage in using the -ab setting.

I tried playing the converted files by alsaplayer and VLC. ffmpeg doesn't seem to transfer audio tags, such as author and title VLC can read more metadata from the files encoded by libvorbis. VLC gives very different results for the track duration: It can not give track duration for the file encoded by vorbis, gives 3 m 35 s for the one encoded by libvorbis using the aq argument, gives 3 m 33 s for the one encoded by libvorbis using the ab argument, and for the original flac it gives 3 m 16 s. In alsaplayer there are less differences: the duration of the file encoded by libvorbis is 3 m 15 s whereas the original and the one encoded by vorbis are 3 m 16 s, which could be a rounding error, I guess.

Finally, here are the versions of the programs used:

FFmpeg version SVN-r19352-4:0.5+svn20090706-2ubuntu2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: --extra-version=4:0.5+svn20090706-2ubuntu2 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --disable-stripping --disable-vhook --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include --enable-shared --disable-static
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 0 / 52.20. 0
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 4. 0 / 0. 4. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Oct 13 2009 22:15:16, gcc: 4.4.1

VLC media player 1.0.2 Goldeneye

alsaplayer 0.99.80

I don't know if this is relevant, but the libvorbisenc2 package version is 1.2.0.dfsg-6ubuntu0.1 here in Xubuntu 9.10.
 
Old 02-15-2010, 06:52 AM   #3
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
If you want, supposedly this modified libvorbis produces better quality:
http://www.geocities.jp/aoyoume/aotuv/
 
Old 02-15-2010, 05:11 PM   #4
jis
LQ Newbie
 
Registered: Jan 2009
Distribution: Xubuntu
Posts: 13

Rep: Reputation: 0
Quote:
Originally Posted by H_TeXMeX_H View Post
If you want, supposedly this modified libvorbis produces better quality:
http://www.geocities.jp/aoyoume/aotuv/
At which compression levels you can actually hear the difference in quality?
 
Old 02-16-2010, 05:16 AM   #5
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
See:
http://en.wikipedia.org/wiki/Vorbis#Listening_tests
 
Old 02-16-2010, 05:53 AM   #6
jis
LQ Newbie
 
Registered: Jan 2009
Distribution: Xubuntu
Posts: 13

Rep: Reputation: 0
The tests were made in year 2005. After that there has been new releases of the encoders.
 
Old 02-16-2010, 05:57 AM   #7
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Well then you gotta do your own tests. I can always notice it, except with lossless codecs like flac.
 
Old 02-16-2010, 06:29 AM   #8
jis
LQ Newbie
 
Registered: Jan 2009
Distribution: Xubuntu
Posts: 13

Rep: Reputation: 0
I doubt you can.
 
Old 02-16-2010, 06:47 AM   #9
jis
LQ Newbie
 
Registered: Jan 2009
Distribution: Xubuntu
Posts: 13

Rep: Reputation: 0
The improvements in alternative vorbis encoders are periodically merged back into the reference codebase (according to http://en.wikipedia.org/wiki/Vorbis).
 
Old 02-17-2010, 03:23 AM   #10
jis
LQ Newbie
 
Registered: Jan 2009
Distribution: Xubuntu
Posts: 13

Rep: Reputation: 0
Anyway, it is good that some people try to develop better encoders.
 
Old 02-17-2010, 05:25 AM   #11
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Quote:
Originally Posted by jis View Post
The improvements in alternative vorbis encoders are periodically merged back into the reference codebase (according to http://en.wikipedia.org/wiki/Vorbis).
It's true, they do say:

Quote:
Beta2 was adopted as a part of Vorbis 1.1 of Xiph.Org
on the aoTuV site, but that's an old version of aoTuV, so probably there have been advances in aoTuV since then.

As for me not noticing lossy audio, I do notice it, ALWAYS with mp3, ALWAYS ! With vorbis I notice it less, and for some songs not at all, same with aac, which is also quite good. When using flac I cannot notice the difference (it's lossless anyway). Trust me I do notice them, maybe you haven't tried the right type of music. Each codec is better at certain kinds of music, and some songs you can always notice loss.

P.S. You also need good speakers to notice it, if you speakers are laptop speakers, well then you can imagine you will not notice any difference.

Last edited by H_TeXMeX_H; 02-17-2010 at 05:26 AM.
 
  


Reply

Tags
bitrate, ffmpeg, ogg, vorbis



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Help me in installing ffmpeg, ffmpeg-PHP, Mplayer, Mencoder, flv2tool, LAME MP3 Encod mitesh.ever Red Hat 5 05-16-2009 12:14 PM
Does the latest version of ffmpeg not work with ffmpeg-php? whitey4900 Linux - Software 0 08-04-2008 05:16 PM
vorbis-tools 1.1.1 & libvorbis 1.1.1 on Debian Sarge? Molly Debian 1 08-21-2005 07:56 PM
Compiling - Installing Vorbis...libvorbis Quasaur Linux - Software 2 11-29-2003 02:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:57 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration