Re: [Vorbis-dev] Zero length reported.

Philipp Schafft <[email protected]> Tue, 11 Apr 2017 08:25:37 +0000
Newsgroups gmane.comp.multimedia.ogg.vorbis.general
Message-ID <[email protected]>
--===============6215706830647239529==
Content-Type: multipart/signed; micalg="pgp-sha256";
	protocol="application/pgp-signature"; boundary="=-M1Yu65x/o0hKuXCjz/tk"


--=-M1Yu65x/o0hKuXCjz/tk
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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.=20
>=20
> And I can see what=E2=80=99s wrong.  The last Ogg header of the troubleso=
me
> 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."
>=20
> 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
>=20
> And the files that play correctly do not have this problem:
>=20
> 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
>=20
> What does 'no packets finish on this page=E2=80=99 mean and why might tha=
t
> 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=E2=80=99m 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 <[email protected]> wrote:
> >=20
> > Hello - I send this to the vorbis-dev list yesterday, but I=E2=80=99m
> working if it would not have been better targeted at this list.=20
> >=20
> > Sorry for the spam if you are on both :)
> >=20
> >> Begin forwarded message:
> >>=20
> >> From: Jim Credland <[email protected]>
> >> Subject: [Vorbis-dev] Zero length reported.
> >> Date: 6 April 2017 at 15:43:18 BST
> >> To: [email protected]
> >> Cc: Maciej Dudek <[email protected]>
> >>=20
> >> Hello - I have two files which play back in VLC correctly.
> >>=20
> >> They were encoded using this command:
> >>=20
> >> ffmpeg -y -i
> '/tmp/2e905b981d30324f9a0664cbabb3f59a20170406-21128-r0neh9.wav'
> -acodec libvorbis
> '/tmp/2e905b981d30324f9a0664cbabb3f59a20170406-21128-r0neh920170406-21128=
-146yyex.ogg
> >>=20
> >> 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.
> >>=20
> >> This is a problem because the same function call is used by the
> JUCE ogg decoder we are using in an application. =20
> >>=20
> >> Any thoughts?
> >>=20
> >> thanks in advance, Jim.
> >>=20
> >>=20
> >>=20
> >> The output is:
> >>=20
> >> jim@snoopy ~/trouble.vorbis/a
> >> $ ./a <
> 53884c2935e6b47938f91ca78b0c2473a85730833138370caedbb66a74995130.ogg
> >> encoder=3DLavf53.32.100
> >>=20
> >> Bitstream is 2 channel, 44100Hz
> >> Encoded by: Lavf53.32.100
> >>=20
> >> Length: 0
> >>=20
> >> jim@snoopy ~/trouble.vorbis/a
> >> $ ./a <
> d7d5ef8e6c7fad33f922924d0a05591277654d53941d43518f1fe8580c7ea3f9.ogg
> >> encoder=3DLavf53.32.100
> >>=20
> >> Bitstream is 2 channel, 44100Hz
> >> Encoded by: Lavf53.32.100
> >>=20
> >> Length: 1146624
> >>=20
> >>=20
> >> Source:
> >>=20
> >> #include <stdio.h>
> >> #include <stdlib.h>
> >> #include <math.h>
> >> #include "vorbis/codec.h"
> >> #include "vorbis/vorbisfile.h"
> >>=20
> >> #ifdef _WIN32
> >> #include <io.h>
> >> #include <fcntl.h>
> >> #endif
> >>=20
> >> char pcmout[4096];
> >>=20
> >> int main (int argc, char** argv)
> >> {
> >>    OggVorbis_File vf;
> >>    int eof =3D 0;
> >>    int current_section;
> >>=20
> >> #ifdef _WIN32
> >>    _setmode (_fileno (stdin), _O_BINARY);
> >>    _setmode (_fileno (stdout), _O_BINARY);
> >> #endif
> >>=20
> >>    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);
> >>    }
> >>=20
> >>    {
> >>        char** ptr =3D ov_comment (&vf, -1)->user_comments;
> >>        vorbis_info* vi =3D ov_info (&vf, -1);
> >>=20
> >>        while (*ptr)
> >>        {
> >>            fprintf (stderr, "%s\n", *ptr);
> >>            ++ptr;
> >>        }
> >>=20
> >>        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));
> >>    }
> >>=20
> >>    return 0;
> >> }


--=20
Philipp Schafft (CEO/Gesch=C3=A4ftsf=C3=BChrer)=20
Telephon: +49.3535 490 17 92

L=C3=B6wenfelsen UG (haftungsbeschr=C3=A4nkt)     Registration number:
Bickinger Stra=C3=9Fe 21                     HRB 12308 CB
04916 Herzberg (Elster)                 VATIN/USt-ID:
Germany                                 DE305133015

--=-M1Yu65x/o0hKuXCjz/tk
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Comment: Because it's your freedom

iQEcBAABCAAGBQJY7JMBAAoJEHz9i3MWdaObMasIAIr/cVlAADHXqgpos2/ZkL1Y
ZJObMUjZVlUlQ1sia/yF0DUc1lzNiSKxKKOA/ED8j1vey0w1cL54p6krY29t9zBj
ORB40HSKYIrNB7aqrrcNdIOFAfRGMYucZEd+Ox3qxVZGySJdW7K+autwBJsE5Jce
5ROiw3KJErqq8C8C/9iNrmtd1khdICRHc+tT7+g6vbgTn+TmErpGkJDu8e8I4urk
nYt7ybL+E56bYuLI27LmgH3WucoFhvmKzXDcq8BUU9wa0TbT1JqhqcnIdHREAN4l
ukxs/XonqA3kVWxK3K628RBXgETtgVf6rpHNSUQc/uOKnsil1Iw0bcGt+M0ApjA=
=ODYT
-----END PGP SIGNATURE-----

--=-M1Yu65x/o0hKuXCjz/tk--

--===============6215706830647239529==
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: base64
Content-Disposition: inline

X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KVm9yYmlzIG1h
aWxpbmcgbGlzdApWb3JiaXNAeGlwaC5vcmcKaHR0cDovL2xpc3RzLnhpcGgub3JnL21haWxtYW4v
bGlzdGluZm8vdm9yYmlzCg==

--===============6215706830647239529==--