Not sure if bug - Ogg Vorbis playback stops prematurely

Just starting out? Need help? Post your questions and find answers here.
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Not sure if bug - Ogg Vorbis playback stops prematurely

Post by Crusiatus Black »

Hi all,

I have been playing several different Ogg Vorbis audio tracks with the PB 5.21 LTS included Sound library using the OggDecoder. I found something peculiar, when Ogg Vorbis files are played which have a logical bitstream with a serial number valued '0', it doesn't play the song completely. These songs do properly play in VLC Media Player and vorbis-tools decode them properly as well, however PureBasic seems to cut them at 06:02 if there duration is longer than this value.

I can't share the problematic files here due to copyright infringement, because I tested this on music from games.

Here's some analytic information about the four files I tested on, surprisingly, both files for which ogginfo from vorbis-tools warns do not play well in PureBasic. Bitstream serial number 0 is legal though, so it should play properly.

Code: Select all

All files play or decode properly in VLC Media Player and Vorbis-Tools.
Files noted with "FAILS" fail to play fully in PureBasic 5.21 LTS, as
the duration is detected to be 06:02. Coincidentally both these files
have a bitstream serial number 0 for the primary stream.
Files noted with "WORKS" work properly in PureBasic 5.21 LTS

FAILS: 9AA.ogg - A track from the game "GoatSimulator"
	- Duration: 7:30, PB 5.21 detects 06:02
	- First bitstream has serial number 0. Vorbis Tools notes that it is legal, but it may cause problems
	  in some tools (as it seems to be doing in PureBasic 5.21 LTS' sound library
	- Vendor: Xiph.Org libVorbis I 20101101 (Schaufenugget)
	- Version: 0 (correct)
	- Channels: 2
	- Rate: 44100
	- Nominal bitrate: 104 kb/s
	- Upper bitrate: not set
	- Lower bitrate: not set
	- User comments section: ENCODER=UnrealEngine3
	- Vorbis stream 1:
		- Total data length: 5691131 bytes
		- Playback length (from vorbis tools): 7m:30.063s
		- Avarage bitrate: 101,161348 kb/s

FAILS: 332ECD.ogg - A track from the game "GoatSimulator"
	- Duration: 6:10, PB 5.21 detects 06:02 (again, coincidence?)
	- First bitstream has serial number 0. Vorbis Tools notes that it is legal, but it may cause problems
	  in some tools (as it seems to be doing in PureBasic 5.21 LTS' sound library
	- Vendor: Xiph.Org libVorbis I 20101101 (Schaufenugget)
	- Version: 0 (correct)
	- Channels: 2
	- Rate: 44100
	- Nominal bitrate: 104 kb/s
	- Upper bitrate: not set
	- Lower bitrate: not set
	- User comments section: ENCODER=UnrealEngine3
	- Vorbis stream 1:
		- Total data length: 4658097 bytes
		- Playback length (from vorbis tools): 6m:10.758s
		- Avarage bitrate: 100,509528 kb/s

WORKS: DirgeDefective1.ogg - A track from the game "Killing Floor"
	- Duration: 02:19, PB 5.21 detects 02:19
	- vorbis-tools does not warn about first bitstream having serial number 0
	- Vendor: BS; Lancer(SSE) [20060331] (based on aoTuV b4b [20051117])
	- Version: 0 (correct)
	- Channels: 2
	- Rate: 44100
	- Nominal bitrate: 128 kb/s
	- Upper bitrate: not set
	- Lower bitrate: not set
	- Vorbis stream 1:
		- Total data length: 2387580 bytes
		- Playback length (from vorbis tools): 2m:19.184s
		- Avarage bitrate: 100,509528 kb/s

WORKS: whistle.ogg - A sound from a similar bugreport for FireFox
	- Duration: 00:00.721, PB 5.21 plays it completely
	- vorbis-tools does not warn about first bitstream having serial number 0
	- Vendor: AO; aoTuV r1 [20051117] (based on Xiph.Org's libVorbis)
	- Version: 0 (correct)
	- Channels: 1
	- Rate: 24000
	- Nominal bitrate: 45,111 kb/s
	- Upper bitrate: not set
	- Lower bitrate: not set
	- Vorbis stream 1:
		- Total data length: 4746 bytes
		- Playback length (from vorbis tools): 0m:00.721s
		- Avarage bitrate: 52,590293 kb/s
If a developer wants me to send these four ogg vorbis files to them in a zip, let me know. I would like to know if anyone else had an issue like this before and if they have a fix. For example, programmatically changing the bitstream serial. I tried this, but it seems to be causing gaps in the format.

Cheers

Edit - See next post for additional information
Last edited by Crusiatus Black on Mon Jul 07, 2014 12:27 pm, edited 1 time in total.
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Re: Not sure if bug - Ogg Vorbis playback stops prematurely

Post by Crusiatus Black »

Addition: it doesn't seem to be related to the bitstream serial number. I've downloaded "4T Thieves - Mists of Time" from http://www.vorbis.com/music/ - and it appears that PureBasic also detects this track to be 06:02 long. The track actually is 06:40 long. I'm now assuming that this is a bug.

ogginfo output:

Code: Select all

New logical stream (#1, serial: 000017df): type vorbis
Vorbis headers parsed for stream 1, information follows...
Version: 0
Vendor: Xiph.Org libVorbis I 20020713
Channels: 2
Rate: 44100

Nominal bitrate: 128,003000 kb/s
Upper bitrate not set
Lower bitrate not set
User comments section follows...
        TITLE=Mists of Time - 4T
        ARTIST=4T Thieves
        ALBUM=Favorite Things
        DATE=2002
        COMMENT=http://www.kahvi.org
        TRACKNUMBER=10
Vorbis stream 1:
        Total data length: 5812396 bytes
        Playback length: 6m:40.000s
        Average bitrate: 116,247920 kb/s
Logical stream 1 ended
Both CatchSound and LoadSound produce the same results, test code:

Code: Select all

UseOGGSoundDecoder()

If(Not InitSound())
  Debug "InitSound() failed"
  End 
EndIf 

Procedure.s durationString(Time)
  Time/1000
  sec=Time%60:Time/60
  min=Time%60:Time/60
  ProcedureReturn RSet(Str(Time),2,"0")+":"+RSet(Str(min),2,"0")+":"+RSet(Str(sec),2,"0")
EndProcedure

;CatchSound(0, ?song_s, (?song_e - ?song_s))
LoadSound(0, "Mists_of_Time-4T.ogg")
totalDuration.s = durationString(SoundLength(0, #PB_Sound_Millisecond))
PlaySound(0)

While(SoundStatus(0) <> #PB_Sound_Stopped)
  Debug durationString(GetSoundPosition(0, #PB_Sound_Millisecond)) + " / " + totalDuration
  Delay(1000)
Wend 

DataSection
  song_s:
    ;IncludeBinary "DirgeDefective1.ogg"
    ;IncludeBinary "332ECD.ogg"
    IncludeBinary "Mists_of_Time-4T.ogg"
  song_e:
    Data.i 0
EndDataSection
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Re: Not sure if bug - Ogg Vorbis playback stops prematurely

Post by Crusiatus Black »

Can anyone confirm by using the track mentioned in the previous post (link to download page included) and the test code?
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
LuCiFeR[SD]
666
666
Posts: 1033
Joined: Mon Sep 01, 2003 2:33 pm

Re: Not sure if bug - Ogg Vorbis playback stops prematurely

Post by LuCiFeR[SD] »

I've had this problem myself in the past.... I suspect that it is a bug, but never reported it as I wasn't sure if it was a faulty ogg file. but using your test code and ogg file, I too can confirm your findings.

The only way I have found to play the file properly is to use the #PB_Sound_Streaming flag... but that stops us from using get sound position etc.
User avatar
Crusiatus Black
Enthusiast
Enthusiast
Posts: 389
Joined: Mon May 12, 2008 1:25 pm
Location: The Netherlands
Contact:

Re: Not sure if bug - Ogg Vorbis playback stops prematurely

Post by Crusiatus Black »

LuCiFeR[SD] wrote:I've had this problem myself in the past.... I suspect that it is a bug, but never reported it as I wasn't sure if it was a faulty ogg file. but using your test code and ogg file, I too can confirm your findings.

The only way I have found to play the file properly is to use the #PB_Sound_Streaming flag... but that stops us from using get sound position etc.
Thank you for testing and confirming the issue! This indeed sounds like a bug, considering all .ogg files I have tested with a length longer than 06:02 stop playing at 06:02. I have no idea why this is happening, and using the PB_Sound_Streaming flag is a no-go because I need the position...

Hopefully the dev team will know what is causing this :)
Image
Bas Groothedde,
Imagine Programming

I live in a philosophical paradoxal randome filled with enigma's!
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Not sure if bug - Ogg Vorbis playback stops prematurely

Post by collectordave »

Just writing a very simple .ogg player with PB and came across this. Is it still a problem?
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
collectordave
Addict
Addict
Posts: 1309
Joined: Fri Aug 28, 2015 6:10 pm
Location: Portugal

Re: Not sure if bug - Ogg Vorbis playback stops prematurely

Post by collectordave »

It is still a problem reported as a bug on windows here viewtopic.php?f=4&t=73243

Shorter songs are no bother plus the longer ones still play on other devices all the way through.

regards

CD
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
Post Reply