Way back in May of last year, Chris Wilkinson reported that x86_64
produced invalid wav files, and Steven M. Schultz replied the problem
was likely solved already in CVS
(http://sourceforge.net/mailarchive/message.php?msg_id=11547708).

I'm still seeing this on an amd64 Debian sid installation with
libmjpegtools0 (1.8.0-0.1). wav files generated by streamer are rejected
by mp2enc.

 # streamer -c /dev/video3 -C /dev/dsp3 -t 0:30 -s 640x480 -r 29.97 \
   -o 1-video-4mpeg.yuv -f 4mpeg -O 1-audio.wav -F stereo -R 32000

 # mp2enc -o 1-audio.mp2 < 1-audio.wav
**ERROR: [mp2enc] Input not a WAV file - has no "WAVE" tag
**ERROR: [mp2enc] failure reading WAV file

Audacity crashes when I try to read it:
 #audacity 1-audio.wav
audacity: layer3.c:2633: mad_layer_III: Assertion `stream->md_len +
md_len - si.main_data_begin <= (511 + 2048 + 8)' failed.
Aborted

There's a slight difference if I captured it this way:
 # streamer -c /dev/video3 -C /dev/dsp3 -t 0:30 -s 640x480 -r 29.97 \
   -o 2-video-422.raw -f 422 -O 2-audio.wav -F stereo -R 32000

Here audacity reads it, shows two channels, but it's all hissing noise.

hexedit shows these first two lines:
RIFF....L§:.....
WAVE....fmt ....

Other wav files I looked at has this on the first line:
RIFFJ...WAVEfmt
RIFF.p..WAVEfmt

I know nothing about this but perhaps the header is still written
incorrectly?

For fun, I went in and messed with the header -- manually copied over
two lines of hex values from the good wav file to the bad one, and
fooled mp2enc into opening it, all bogus values of course --

$ mp2enc -s -o 1-audio.mp2 < 1-audio2.wav
++ WARN: [mp2enc] File length according data tag: 44
++ WARN: [mp2enc] File length according RIFF tag: 28682
++ WARN: [mp2enc] Inconsistency is inevitable if wav's are being piped
   INFO: [mp2enc] Opened WAV file, freq = 11025 Hz, channels = 1, bits = 16
   INFO: [mp2enc] format = 0x1, audio length = 0 bytes
   INFO: [mp2enc] SpF=672, frac SpF=0.000, bitrate=224 kbps, sfreq=48.0 kHz
   INFO: [mp2enc] System is little endian

Anyway, it looks like it's a header problem. Here's the full bad header:

0000:0000 52 49 46 46 00 00 00 00 4c a7 3a 00 00 00 00 00 RIFF....L§:.....
0000:0010 57 41 56 45 00 00 00 00 66 6d 74 20 00 00 00 00 WAVE....fmt ....
0000:0020 10 00 00 00 00 00 00 00 01 00 02 00 00 00 00 00 ................
0000:0030 00 7d 00 00 00 00 00 00 00 f4 01 00 00 00 00 00 .}.......ô......
0000:0040 04 00 10 00 00 00 00 00 64 61 74 61 00 00 00 00 ........data....
0000:0050 04 a7 3a 00 00 00 00 00 ad 05 9b 00 84 05 b0 ff .§:.....­.....°ÿ
0000:0060 2f 04 11 fe b0 03 02 fc e1 02 e3 fb 7a 01 70 fc /..þ°..üá.ãûz.pü
0000:0070 83 01 1f fd da 00 cf fd e0 00 fc fd 1c 02 d2 fe ...ýÚ.Ïýà.üý..Òþ
0000:0080 21 02 4d 01 93 00 8f 02 16 ff 64 01 9f fe e9 00 !.M......ÿd..þé.
0000:0090 aa fd 3b ff ee fd 63 fd 2b fe 95 fe fe fc ed ff ªý;ÿîýcý+þ.þþüíÿ

Another one (the one that doesn't crash audacity but squeaks in stereo:

0000:0000 52 49 46 46 00 00 00 00 4c a7 3a 00 00 00 00 00 RIFF....L§:.....
0000:0010 57 41 56 45 00 00 00 00 66 6d 74 20 00 00 00 00 WAVE....fmt ....
0000:0020 10 00 00 00 00 00 00 00 01 00 02 00 00 00 00 00 ................
0000:0030 00 7d 00 00 00 00 00 00 00 f4 01 00 00 00 00 00 .}.......ô......
0000:0040 04 00 10 00 00 00 00 00 64 61 74 61 00 00 00 00 ........data....
0000:0050 04 a7 3a 00 00 00 00 00 4b 08 e5 03 86 08 e6 03 .§:.....K.å...æ.
0000:0060 85 06 e2 00 a5 03 a2 ff 1b 03 a3 01 5d 04 d1 01 ..â.¥.¢ÿ..£.].Ñ.
0000:0070 ac 07 09 00 23 0a dd 00 0b 0a 41 01 f5 09 6e 00 ¬...#.Ý...A.õ.n.
0000:0080 87 0a 37 00 ed 09 80 ff 4f 09 74 ff 68 08 b4 01 ..7.í..ÿO.tÿh.´.

That's what they're like.  A healthy wav file looks like this:

0000:0000 52 49 46 46 02 70 00 00 57 41 56 45 66 6d 74 20 RIFF.p..WAVEfmt
0000:0010 10 00 00 00 01 00 01 00 11 2b 00 00 22 56 00 00 .........+.."V..
0000:0020 02 00 10 00 64 61 74 61 de 6f 00 00 00 fe 00 ff ....dataÞo...þ.ÿ
0000:0030 01 fe ff fe 00 00 01 ff 00 00 01 ff 00 ff fe fe .þÿþ...ÿ...ÿ.ÿþþ
0000:0040 00 ff 01 01 00 01 ff 00 00 02 ff 00 02 02 00 01 .ÿ....ÿ...ÿ.....

Pretty please, could we have the right wave headers on amd64? Does
someone need a test machine?

Dave







-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Mjpeg-users mailing list
Mjpeg-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mjpeg-users

Reply via email to