====== mp3plot ====== An mp3 bitrate plot tool [[:|Projects index]] ===== Details ===== * Current version: 0.6.0, released on June 22nd 2009 * Status: stable, work in progress * Released under the [[https://www.gnu.org/copyleft/gpl.html|GNU GPL]] * Online man page: [[p>/files/mp3plot/mp3plot.man%281%29.html"|html]], [[p>/files/mp3plot/mp3plot.man%281%29.pdf|pdf]] * New releases announced on [[blog>etiq/projects/mp3plot/|my site]] * Example, text mode, run: $ mp3plot "the file.mp3" mp3plot 0.6.0 (c) 2007, 2009 Toni Corvera Tag Identifier / File Magic: ID3 Tag version: 0x0000 ID3V2 Flags: 0x00 Tag size: 559 * Information gathered from the first frame: MPEG Version: MPEG v1 MPEG Layer: Layer III Has CRC: No Nominal bitrate: 128 kbps Sampling rate: 44100 Hz Channel mode: Joint Stereo * VBR Information: VBR file Number of frames included (15295) File size included (7522979) TOC included VBR scale included * Bitrate plot: [ free]: 0 [ 32kbps]: 41 [ 40kbps]: 7 [ 48kbps]: 8 [ 56kbps]: 8 [ 64kbps]: 7 [ 80kbps]: 32 [ 96kbps]: 358 .. [112kbps]: 1228 ........ [128kbps]: 3186 ....................... [160kbps]: 8720 ............................................................... [192kbps]: 1700 ............ [224kbps]: 0 [256kbps]: 0 [320kbps]: 0 [invalid]: 0 Average bitrate is 150.81 kbps with a total of 15295 frames which yields a theoretical (raw audio data) size of 7496918 bytes and a length of 399s ===== Description ===== This tool prints out a plot of the bitrate distribution of a VBR MP3 file (it will also do it for CBR files although it isn't very meaningful). There's a much more mature tool that does the same and more: ''mp3stat'' at [[https://signal-lost.homeip.net/projects/|signal-lost.homeip.net/projects]] (dead link, [[archive>https://signal-lost.homeip.net/projects/|archived version]], [[http://bsdforge.com/projects/audio/mp3stat/|page at BSDforge]]).\\ ''mp3stat'' refuses to work on my system(s) and having an interest in mp3's internal structure I gave a shot at it with ''mp3plot''. Graphical plots can also be generated by adding the ''-g'' option (note this is an optional feature and might not be included in your copy). \\ This feature was added in version 0.4.0a but is only really usable from 0.5.0 onwards. Example: (plot for the same file as in the textual example above) | {{:mp3plot:gdsample.jpg?direct&600|GD output}}\\ GD | {{:mp3plot:magicksample.jpg?direct&160|Magick output}}\\ Magick++\\ {{:mp3plot:old_gdsample.jpg?direct&160|GD output using the older colourscheme}}\\ GD, old colours\\ {{:mp3plot:old_magicksample.jpg?direct&160|Magick output using the older colourscheme}}\\ Magick++, old colours | The graphics output support can be provided by two different libraries (gd and ImageMagick ---or GraphicsMagick---).\\ All binaries in this page use GD since it produces sharper output. ===== Downloads ===== ==== Binaries ==== ^ OS/Platform ^ Package ^ Dependencies ^ | Debian Sid i386 | Sid @ 2009-06-22\\ [[deb>files/mp3plot/mp3plot_0.6.0-upstream.1_i386.deb|mp3plot_0.6.0-upstream.1_i386.deb]] | libboost-program-options1.35.0 (>= 1.35.0-1), libboost-thread1.35.0 (>= 1.35.0-1), libc6 (>= 2.3.6-6~), libgcc1 (>= 1:4.1.1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) %%|%% libgd2-xpm (>= 2.0.36~rc1~dfsg), libstdc++6 (>= 4.2.1) | | ::: | Sid @ 2010-02-21\\ [[deb>files/mp3plot/mp3plot_0.6.0-upstream.1-SID20100221_i386.deb|mp3plot_0.6.0-upstream.1-SID20100221_i386.deb]] | libboost-program-options1.40.0 (>= 1.40.0-1), libboost-thread1.40.0 (>= 1.40.0-1), libc6 (>= 2.3.6-6~), libgcc1 (>= 1:4.1.1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) %%|%% libgd2-xpm (>= 2.0.36~rc1~dfsg), libstdc++6 (>= 4.4.0) | | Debian Sid amd64 | Sid @ 2009-06-22\\ [[deb>files/mp3plot/mp3plot_0.6.0-upstream.1_amd64.deb|mp3plot_0.6.0-upstream.1_amd64.deb]] | libboost-program-options1.35.0 (>= 1.35.0-1), libboost-thread1.35.0 (>= 1.35.0-1), libc6 (>= 2.3.2), libgcc1 (>= 1:4.1.1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) %%|%% libgd2-xpm (>= 2.0.36~rc1~dfsg), libstdc++6 (>= 4.2.1) | | ::: | Sid @ 2010-02-21\\ [[deb>files/mp3plot/mp3plot_0.6.0-upstream.1-SID20100221_amd64.deb|mp3plot_0.6.0-upstream.1-SID20100221_amd64.deb]] | libboost-program-options1.40.0 (>= 1.40.0-1), libboost-thread1.40.0 (>= 1.40.0-1), libc6 (>= 2.3.2), libgcc1 (>= 1:4.1.1), libgd2-noxpm (>= 2.0.36~rc1~dfsg) %%|%% libgd2-xpm (>= 2.0.36~rc1~dfsg), libstdc++6 (>= 4.4.0) | | Fedora 10 i686 | [[rpm>files/mp3plot/mp3plot-0.6.0-1.fc10~upstream.i386.rpm|mp3plot-0.6.0-1.fc10~upstream.i386.rpm]] | libboost_program_options-mt.so.3 libboost_thread-mt.so.3 libc.so.6 libc.so.6(GLIBC_2.0) libc.so.6(GLIBC_2.1.3) libgcc_s.so.1 libgcc_s.so.1(GCC_3.0) libgd.so.2 libpthread.so.0 libpthread.so.0(GLIBC_2.0) libstdc++.so.6 libstdc++.so.6(CXXABI_1.3) libstdc++.so.6(GLIBCXX_3.4) libstdc++.so.6(GLIBCXX_3.4.9) rpmlib(CompressedFileNames) >= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) >= 4.0-1 rtld(GNU_HASH) | | FreeBSD 7.1-RELEASE amd64 ((FreeBSD includes mp3plot in its ports/packages system (''audio/mp3plot''). As of this writing it is up-to-date. See [[#External references]].)) | [[p>/files/mp3plot/mp3plot-0.6.0_amd64.tbz|mp3plot-0.6.0_amd64.tbz]] | png-1.2.32; gd-2.0.35,1; boost-1.34.1 | | Microsoft Windows (x86) | [[p>/files/mp3plot/mp3plot-0.6.0-win.zip|mp3plot-0.6.0-win.zip]] | (included) | Additionally the sources include means to produce easily [[#builddebpackage|deb]], [[#buildrpmpackage|rpm]] and [[#bldtbz|tbz]] (FreeBSD) packages for other OS/architecture combinations. ==== Source ==== [[p>/files/mp3plot/mp3plot-0.6.0.tar.gz|mp3plot-0.6.0.tar.gz]] === Generic build instructions === Mandatory requirements: * boost headers * boost program-options * boost thread (at least 1.34.1) * C++ compiler (preferably g++), libraries and tools Optional requirements (for graphical plots): * gd library * ImageMagick or GraphicsMagick library (currently gd is preferable) Compile in the standard GNU fashion: $ tar zxvf mp3plot-0.6.0.tar.gz $ cd mp3plot-0.6.0 $ ./configure $ make # make install ''configure'' will link against the graphics libraries available (binaries can link to both GD and *Magick at once). \\ Use ''--disable-*'' arguments to avoid linking in undesired modules, e.g.: \\ Compile without gd support ''$ ./configure --disable-gd''\\ Compile without *Magick support ''$ ./configure --disable-magick''\\ Compile without graphics support ''$ ./configure --disable-gd --disable-magick'' NOTE (nbsp)If ''configure'' has problems finding the boost libraries, refer to the ''INSTALL'' file in the tarball. === Build DEB package === Packages required to build DEB in Debian Sid: * Libraries: ''libgd2-noxpm-dev'', ''libboost-thread-dev'' OR ''libboost-thread1.35-dev'', ''libboost-program-options-dev'' OR ''libboost-program-options1.35-dev''. * C++ compiler: ''g++'' * Deb build stuff: ''dpkg-dev'', ''debhelper'' and optionally ''devscripts'' $ tar zxvf mp3plot-0.6.0.tar.gz $ cd mp3plot-0.6.0 $ dpkg-buildpackage -rfakeroot -us -uc -b # (or ''debuild -us -uc -b'') === Build RPM package === Packages required to build RPM in Fedora 10: * Libraries: ''gd-devel'', ''boost'' * C++ compiler: ''gcc-c++'' * RPM build stuff: ''rpm-build'' $ rpmbuild -tb mp3plot-0.6.0.tar.gz === Build FreeBSD port === Extract [[p>/files/mp3plot/port-0.6.0.tar.gz|port-0.6.0.tar.gz]] to ''${PORTSDIR}/audio/mp3plot'' and proceed normally from there, e.g: $ cd /usr/ports/audio/mp3plot $ tar -zxvf port-0.6.0.tar.gz $ make ===== TO-DO list ===== * Expected for 0.7.0 * Allow user-specified output image size * Optionally display generated image * Expected before 1.0 * Handling of free-form bitrate ===== Acknowledgements ===== I got most of my initial reference information on the MP3 file structure from the //MP3 File Structure Description// document located at [[http://www.goat.cz/index.php?path=MP3_MP3ProfiInfo|www.goat.cz/index.php?path=MP3_MP3ProfiInfo]] ([[http://www.multiweb.cz/twoinches/MP3inside.htm|older URL]].)\\ More information filled through web searches leading to random sites. List of sources of information used, in no particular order: * [[http://www.mpgedit.org/mpgedit/mpeg_format/MP3Format.html|MP3 File Format Specification]] * [[http://books.google.com/books?id=MN34-91z6qAC|Understanding MP3]], Ruckert, Martin; ISBN: 3528059052, 9783528059057 * [[http://www.id3.org/mp3Frame|How is MP3 built?]] * [[http://www.hydrogenaudio.org/forums/index.php?showtopic=52216|Hydrogenaudio: Frame Size, Calc bitrate, length, vbr/cbr etc..]] * [[http://www.hydrogenaudio.org/forums/index.php?showtopic=43172|Hydrogenaudio: Is this a MP3 Frame header]] * [[http://www.mp3-converter.com/mp3codec/frames.htm|Inside the MP3 Codec - Page 13]] Portions of the source code to compile on Visual C++ come from the [[http://code.google.com/p/msinttypes/|msinttypes]] project, which is (c) 2006-2008 Alexander Chemeris, published under the terms of a BSD 3-clause license. The initial //ports collection// integration effort was by Andrew Pantyukhin. [[http://home.cogeco.ca/~avi2vcd/|wav2mp]] and [[http://www.rjamorim.com/rrw/uzura.html|UZURA1]] were used to generate some MP1 samples. ===== External references ===== * BSD ports system: [[http://www.freebsd.org/cgi/cvsweb.cgi/ports/audio/mp3plot/|ports/audio/mp3plot at FreeBSD.org]], [[http://www.freshports.org/audio/mp3plot/|audio/mp3plot at FreshPorts.org]] * [[http://freecode.com/projects/mp3plot/|Project information at Freecode]] (formerly Freshmeat). I announced new versions there, no longer active. ===== Changes ===== [[p>/files/mp3plot/ChangeLog|Full Changelog]] ==== 0.6.0 (June, 22th 2009) ==== Lots of fixed of sloppy code and support for Layer I (//MP1//), Layer II (//MP2//) and MPEG-2 (//MP1//, //MP2// and //MP3// at lower sampling rates). * Fixed detection of sampling rate (defaulted to 44.1kHz) and CRC flag (displayed its value reversed). * Fix of nasty bug with free-form bitrate and corrupted files that led to an infinite loop eventually exhausting memory. * More warnings where appropriate * Print the theoretical length in seconds See the full changelog for the complete list of changes. ==== 0.5.1 (April, 25th 2009) ==== * Graphics output alignment corrections. * Single-hue graphics output by default. * Other bugfixes and minor cosmetic changes, see the full ChangeLog for a complete list. ==== 0.5.0 (April, 17th 2009) ==== * Image output is usable (not final though), both gd and/or ImageMagick++/GraphicsMagick++ can be used. If both are compiled in, one or the other can be chosen with "''-n''". * Allow choosing the output file name with "''-o''" * Display a list of available plotters with "''-p list''" * Support Microsoft Windows * Documentation: Added manpage (converted to PDF for Windows distribution) * Bugfix: Print usage information when command-line is incorrect ==== 0.4.0a (May, 26th 2007) ==== * Experimental image support * Cleanup of the build system and adoption of the standard ./configure && make cycle * Many internal changes, cleanups and redesigns. ---- //(c) 2007-2010 Toni Corvera < outlyer at gmail dot com >//