From: Jan S. <ha...@st...> - 2015-07-31 05:55:33
|
On Jul 30 18:55:58, sc...@at... wrote: > Cross-posted from Stack Overflow. I originally posted this there, but decided that I might be more likely to get an answer here. > > This question comes from another I recently asked. See http://stackoverflow.com/questions/31702592/jplayer-circle-player-does-not-show-circle-first-time-around-with-wav-files-made . After much head-banging, trying this and trying that, I am convinced that the output of SoX given an input of a .vox file produces a file the duration of which cannot be predetermined by HTML5-based audio players such as JPlayer. > I have now tried this with both .wav and .ogg output formats. The command line used was simply > > sox inputfile.vox outputfile.wav > or > sox inputfile.vox outputfile.ogg > > without any other parameters. None of the documented command line switches seems to jump out as providing the answer I need, but I do not know much about audio conversion in general. > > In neither case can the player predetermine the duration of the clip. Once it has played the clip once, it then knows the duration, and this is shown in great detail in the other question. > Oddly, though, the utility soxi is able to tease the duration out of either the input or output file as shown below: > $ soxi /var/tmp/test.vox > > Input File : '/var/tmp/test.vox' (wav) > Channels : 1 > Sample Rate : 8000 > Precision : 16-bit > Duration : 00:00:10.48 = 83840 samples ~ 786 CDDA sectors > Sample Encoding: 16-bit Signed Integer PCM > > $ soxi /var/tmp/test.wav > > Input File : '/var/tmp/test.wav' > Channels : 1 > Sample Rate : 8000 > Precision : 16-bit > Duration : 00:00:10.48 = 83840 samples ~ 786 CDDA sectors > Sample Encoding: 16-bit Signed Integer PCM > > >From this, I deduce that the input file had sufficient metadata for soxi to figure the duration out, but that HTML5 must be using a different algorithm that is insufficient. > Is there some combination of SoX parameters that would generate sufficient metadata so that HTML5 audio players can predetermine duration? Apparently, the duration is present in the files' headers. That's about all you can do about storing the duration: write it in the header as expected, which sox does. I think that your problem has nothing to do with SoX, but is a problem with those browsers. Jan PS: make your "Subject:" a one-liner. |