[Vorbis] [Vorbis-dev] Zero length reported.

Philipp Schafft phschafft at de.loewenfelsen.net
Tue Apr 11 08:25:37 UTC 2017


Good morning,

On Tue, 2017-04-11 at 09:15 +0100, Jim Credland wrote:
> Okay - so I stepped through the code slowly this morning making notes
> as I went. 
> 
> And I can see what’s wrong.  The last Ogg header of the troublesome
> file contains -1 as the granule position.  The spec says this has a
> special meaning "A special value of '-1' (in two's complement)
> indicates that no packets finish on this page."
> 
> 4F 67 67 53 00 04 FF FF FF FF FF FF FF FF 16 A2 F3 7C 10 00 00 00 D1
> 4A 44 5E 00
> 
> And the files that play correctly do not have this problem:
> 
> 4F 67 67 53 00 04 00 7F 11 00 00 00 00 00 76 EF C3 4C 16 00 00 00 94
> 50 4F B4 01 49 1C 4B F0 85 64 91 64 9E 84 59 EB F5 8E 06 83 43 C1 1C
> E9 9C BC E9 EF EB DC 7D BF EF 25 54 C6 EF FF 7D FE 72 F9 FE 63 3F FE
> F5 E7 5B D4 BA 17 C7 41 25 6D 31 2D EA A5 AE 9A 56 F3 F1 DE A6 F9 F5
> 5E 89 DE 53 2F CB F4 F8 07
> 
> What does 'no packets finish on this page’ mean and why might that
> appear at the end of a file?

Does the generating use ogg_stream_flush() at end of file (in addition
to ogg_stream_pageout())?

I think ov_pcm_total() should handle this better (returning an error).
But would need to look up the API reference first.


> I’m guessing this is an encoding problem..

Yes.

Please also check that the EOS flag is set on the last page.


With best regards,


> > On 7 Apr 2017, at 13:31, Jim Credland <jim at credland.net> wrote:
> > 
> > Hello - I send this to the vorbis-dev list yesterday, but I’m
> working if it would not have been better targeted at this list. 
> > 
> > Sorry for the spam if you are on both :)
> > 
> >> Begin forwarded message:
> >> 
> >> From: Jim Credland <jim at credland.net>
> >> Subject: [Vorbis-dev] Zero length reported.
> >> Date: 6 April 2017 at 15:43:18 BST
> >> To: vorbis-dev at xiph.org
> >> Cc: Maciej Dudek <maciej.dudek at gmail.com>
> >> 
> >> Hello - I have two files which play back in VLC correctly.
> >> 
> >> They were encoded using this command:
> >> 
> >> ffmpeg -y -i
> '/tmp/2e905b981d30324f9a0664cbabb3f59a20170406-21128-r0neh9.wav'
> -acodec libvorbis
> '/tmp/2e905b981d30324f9a0664cbabb3f59a20170406-21128-r0neh920170406-21128-146yyex.ogg
> >> 
> >> However ov_pcm_total reports a zero length for one of the two
> files.  Is this a problem with my use of the ov_pcm_total function or
> a problem with the encoding?  The files are here
> http://www.credland.net/ogg/ along with a copy of the source code.
> >> 
> >> This is a problem because the same function call is used by the
> JUCE ogg decoder we are using in an application.  
> >> 
> >> Any thoughts?
> >> 
> >> thanks in advance, Jim.
> >> 
> >> 
> >> 
> >> The output is:
> >> 
> >> jim at snoopy ~/trouble.vorbis/a
> >> $ ./a <
> 53884c2935e6b47938f91ca78b0c2473a85730833138370caedbb66a74995130.ogg
> >> encoder=Lavf53.32.100
> >> 
> >> Bitstream is 2 channel, 44100Hz
> >> Encoded by: Lavf53.32.100
> >> 
> >> Length: 0
> >> 
> >> jim at snoopy ~/trouble.vorbis/a
> >> $ ./a <
> d7d5ef8e6c7fad33f922924d0a05591277654d53941d43518f1fe8580c7ea3f9.ogg
> >> encoder=Lavf53.32.100
> >> 
> >> Bitstream is 2 channel, 44100Hz
> >> Encoded by: Lavf53.32.100
> >> 
> >> Length: 1146624
> >> 
> >> 
> >> Source:
> >> 
> >> #include <stdio.h>
> >> #include <stdlib.h>
> >> #include <math.h>
> >> #include "vorbis/codec.h"
> >> #include "vorbis/vorbisfile.h"
> >> 
> >> #ifdef _WIN32
> >> #include <io.h>
> >> #include <fcntl.h>
> >> #endif
> >> 
> >> char pcmout[4096];
> >> 
> >> int main (int argc, char** argv)
> >> {
> >>    OggVorbis_File vf;
> >>    int eof = 0;
> >>    int current_section;
> >> 
> >> #ifdef _WIN32
> >>    _setmode (_fileno (stdin), _O_BINARY);
> >>    _setmode (_fileno (stdout), _O_BINARY);
> >> #endif
> >> 
> >>    if (ov_open_callbacks (stdin, &vf, NULL, 0,
> OV_CALLBACKS_NOCLOSE) < 0)
> >>    {
> >>        fprintf (stderr, "Input does not appear to be an Ogg
> bitstream.\n");
> >>        exit (1);
> >>    }
> >> 
> >>    {
> >>        char** ptr = ov_comment (&vf, -1)->user_comments;
> >>        vorbis_info* vi = ov_info (&vf, -1);
> >> 
> >>        while (*ptr)
> >>        {
> >>            fprintf (stderr, "%s\n", *ptr);
> >>            ++ptr;
> >>        }
> >> 
> >>        fprintf (stderr, "\nBitstream is %d channel, %ldHz\n",
> vi->channels, vi->rate);
> >>        fprintf (stderr, "Encoded by: %s\n\n", ov_comment (&vf,
> -1)->vendor);
> >>        fprintf (stderr, "Length: %lld\n\n", ov_pcm_total(&vf, -1));
> >>    }
> >> 
> >>    return 0;
> >> }


-- 
Philipp Schafft (CEO/Geschäftsführer) 
Telephon: +49.3535 490 17 92

Löwenfelsen UG (haftungsbeschränkt)     Registration number:
Bickinger Straße 21                     HRB 12308 CB
04916 Herzberg (Elster)                 VATIN/USt-ID:
Germany                                 DE305133015
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://lists.xiph.org/pipermail/vorbis/attachments/20170411/8b4b9f16/attachment.sig>


More information about the Vorbis mailing list