VLC displays wrong duration (length) of vorbis file

For questions and discussion that is NOT (I repeat NOT) specific to a certain Operating System.
MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

VLC displays wrong duration (length) of vorbis file

Postby MartinT » 08 May 2007 10:49

Is there any chance to display right duration(length) info of vorbis file? Winamp has no problem with this, so i think it must use some other information to display right lengt of file.

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 08 May 2007 11:07

In a 3:30 tune I'm seeing about a 1 second variance between various players including VLC. What are you seeing?

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 08 May 2007 14:32

I see different variance e. g. 2:34 song looks in VLC like 2:41 song. Other 1:22 song looks in VLC like 1:02 song atc. So differences are more than 1s in both directions.

Playback is without problems but at the end of song status bar looks like: 1:22/1:02.

EDIT:
I think VLC uses wrong algorithm to calculate vorbis length.
e. g.
file size: 753924B
average bitrate: 72kbps = 9kBps
nominal bitrate: 96kbps = 12kBps
753924/1024 = 736,254kB/9 = 81,806s = 1:21,806 (right value)
753924/1024 = 736,254kB/12 = 61,356 = 1:01,345 (bad value)

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 08 May 2007 18:23

I see different variance e. g. 2:34 song looks in VLC like 2:41 song. Other 1:22 song looks in VLC like 1:02 song atc. So differences are more than 1s in both directions.

Playback is without problems but at the end of song status bar looks like: 1:22/1:02.

EDIT:
I think VLC uses wrong algorithm to calculate vorbis length.
e. g.
file size: 753924B
average bitrate: 72kbps = 9kBps
nominal bitrate: 96kbps = 12kBps
753924/1024 = 736,254kB/9 = 81,806s = 1:21,806 (right value)
753924/1024 = 736,254kB/12 = 61,356 = 1:01,345 (bad value)
Hmmm... Are you able to found where the bug is ?
Are some bitrates correct ?
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 08 May 2007 19:14

The bit rate of the file I just tried is 255 kb/s, with a file size of 6574025 and it is showing total time of 3:25 if that's helpful.

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 08 May 2007 19:24

I don`t know. I dont`t like code reading. But i found this API documentation for developers: http://www.xiph.org/vorbis/doc/vorbisfile/fileinfo.html So information about average bitrate or total length of vorbis file is available via this functions.
EDIT: Maybe algorithm use nominal bitrate instead of average bitrate to calculate vorbis length.
Last edited by MartinT on 08 May 2007 19:41, edited 2 times in total.

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 08 May 2007 19:34

The bit rate of the file I just tried is 255 kb/s, with a file size of 6574025 and it is showing total time of 3:25 if that's helpful.
255 nominal or average? nominal != average

Right length for 255kb/s average bit rate is 3:21,41.

DJ
Cone Master
Cone Master
Posts: 8206
Joined: 01 Jan 2006 04:30
Location: Koloa, Hawaii USA

Postby DJ » 09 May 2007 08:10

Vorbis is always VBR as it can't be made to be CBR. The bitrate quoted is what is reported in VLC and I have always assumed this to be ABR. MPC says this same file is 3:26. This is using the Haali front end for OGG/OGM and CoreVorbis.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Postby Jean-Baptiste Kempf » 09 May 2007 10:20

Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 09 May 2007 18:30

Vorbis is always VBR as it can't be made to be CBR. The bitrate quoted is what is reported in VLC and I have always assumed this to be ABR. MPC says this same file is 3:26. This is using the Haali front end for OGG/OGM and CoreVorbis.
I know, that vorbis is always VBR. Nominal bitrate specifies approximate quality. So final audio file will have ABR approximately as nominal. Sometimes higher, sometimes lower. So if you calculate song lengt nominal bitrate is irrelevant.

But in VLC is displayed only nominal bitrate. As i showed in calculation above.

MartinT
Blank Cone
Blank Cone
Posts: 15
Joined: 02 Jan 2007 11:29

Postby MartinT » 09 May 2007 18:31

I think that i found problem in source code, but i`m not so good in C programming to fix it.

possibly here is explanation:
http://www.xiph.org/vorbis/doc/vorbisfile/fileinfo.html
VLC uses function "ov_info()" to get "vorbis_info" structure that contains nominal bitrate info in variable "bitrate_nominal"
But there is also function "ov_bitrate()" that returns average bitrate or
function "ov_time_total()" that returns total time length in seconds of a physical or logical seekable bitstream.


Return to “General VLC media player Troubleshooting”

Who is online

Users browsing this forum: No registered users and 11 guests