LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   ffmpeg: vorbis vs. libvorbis (https://www.linuxquestions.org/questions/linux-software-2/ffmpeg-vorbis-vs-libvorbis-782346/)

David the H. 01-15-2010 05:04 AM

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.

jis 01-26-2010 05:46 PM

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.

H_TeXMeX_H 02-15-2010 06:52 AM

If you want, supposedly this modified libvorbis produces better quality:
http://www.geocities.jp/aoyoume/aotuv/

jis 02-15-2010 05:11 PM

Quote:

Originally Posted by H_TeXMeX_H (Post 3864263)
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?

H_TeXMeX_H 02-16-2010 05:16 AM

See:
http://en.wikipedia.org/wiki/Vorbis#Listening_tests

jis 02-16-2010 05:53 AM

The tests were made in year 2005. After that there has been new releases of the encoders.

H_TeXMeX_H 02-16-2010 05:57 AM

Well then you gotta do your own tests. I can always notice it, except with lossless codecs like flac.

jis 02-16-2010 06:29 AM

I doubt you can.

jis 02-16-2010 06:47 AM

The improvements in alternative vorbis encoders are periodically merged back into the reference codebase (according to http://en.wikipedia.org/wiki/Vorbis).

jis 02-17-2010 03:23 AM

Anyway, it is good that some people try to develop better encoders.

H_TeXMeX_H 02-17-2010 05:25 AM

Quote:

Originally Posted by jis (Post 3865494)
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.


All times are GMT -5. The time now is 10:04 PM.