{"id":556,"date":"2008-05-12T21:37:42","date_gmt":"2008-05-13T05:37:42","guid":{"rendered":"http:\/\/multimedia.cx\/eggs\/libsndfile-survey-caff\/"},"modified":"2020-07-25T22:05:06","modified_gmt":"2020-07-26T05:05:06","slug":"libsndfile-survey-caff","status":"publish","type":"post","link":"https:\/\/multimedia.cx\/eggs\/libsndfile-survey-caff\/","title":{"rendered":"Libsndfile Survey; CAFF"},"content":{"rendered":"<p>I have been sitting on the results of this little experiment for a month now. I was in a bit more of a hurry during the qualification period for this year&#8217;s <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=FFmpeg_Summer_Of_Code_2008\">Summer of Code<\/a> because I knew it would eventually yield a bumper crop of suitable qualification tasks. But that time has long passed.<\/p>\n<p>The task at hand is to systematically survey the types of files that <a href=\"http:\/\/www.mega-nerd.com\/libsndfile\/\">libsndfile<\/a> can create, see what it can do that <a href=\"http:\/\/ffmpeg.org\/\">FFmpeg<\/a> can&#8217;t, and make a plan to get those formats into FFmpeg starting with listing them as <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=Small_FFmpeg_Tasks\">small tasks<\/a>.<\/p>\n<p>Libsndfile comes with several small example utilities (something can FFmpeg could probably use instead of, or to supplement, one big utility). One such program is sndfile-convert<\/p>\n<p><script src=\"https:\/\/gist.github.com\/multimediamike\/4b3129c286e387c7d70435e518922cb5.js\"><\/script><\/p>\n<p>I had to modify sndfile-convert since not all of the supported formats were enumerated in its case-switch statements. The result of the above command was 120 unique format\/codec combinations. <a href=\"http:\/\/multimedia.cx\/libsndfile-samples\/\">I have uploaded all 120 cow moo samples<\/a> (taken from the OpenOffice media suite, handy on my Eee PC when I was running this experiment).<\/p>\n<p>How many of these 120 files can FFmpeg decode? I compiled FFmpeg with GSM 6.10 support and used the following command to print out FFmpeg return code and filename for each sample:<\/p>\n<pre>\r\nfor file in `ls`; do\r\n  ffmpeg -i $file -f wav - 1> \/dev\/null 2> \/dev\/null;\r\n  echo $? $file; \r\ndone\r\n<\/pre>\n<p>The count is: 26 supported, 94 unsupported. Time to get to work. You wouldn&#8217;t believe how many different ways there are to wrap raw PCM data with a basic file header for storage and transport.<\/p>\n<p>Actually, closer inspection will reveal that FFmpeg is not necessarily ready to support all of these file formats since a number of them contain 24- or 32-bit integer PCM, or 32- or 64-bit floating point PCM; these are longstanding FFmpeg TODO items.<\/p>\n<p>Libsndfile is actually the first program I have encountered that handles <a href=\"http:\/\/wiki.multimedia.cx\/index.php?title=Apple_Core_Audio_Format\">Apple Core Audio Format Files (CAF or CAFF)<\/a>. I haven&#8217;t even found an Apple program that creates these, at least not among the offerings bundled with Mac OS X 10.5. Now that I have created some CAFs, I see that Apple&#8217;s QuickTime Player plays them handily.<\/p>\n<p>FFmpeg also doesn&#8217;t support multichannel (more-than-stereo) audio very robustly in its present incarnation. Yeah, that&#8217;s <a href=\"http:\/\/codecs.multimedia.cx\/?p=73\">another item on the TODO list<\/a>. Check out the complete specs for CAFF, however. I think if we made it a goal to support CAFF to its fullest (save perhaps for its <a href=\"http:\/\/en.wikipedia.org\/wiki\/Pulse-width_modulation\">pulse-width modulation<\/a> provisions), FFmpeg&#8217;s audio handling would reign supreme at the end of the journey.<\/p>\n<p>For the curious, these are the 26\/120 files that FFmpeg can decode at this time:<\/p>\n<p><!--more--><\/p>\n<ol>\n<li>aif-alaw.aif<\/li>\n<li>aif-gsm610.aif<\/li>\n<li>aif-ima-adpcm.aif<\/li>\n<li>aif-pcm16.aif<\/li>\n<li>aif-pcm24.aif<\/li>\n<li>aif-pcm32.aif<\/li>\n<li>aif-pcms8.aif<\/li>\n<li>aif-ulaw.aif<\/li>\n<li>au-alaw.au<\/li>\n<li>au-pcm16.au<\/li>\n<li>au-pcms8.au<\/li>\n<li>au-ulaw.au<\/li>\n<li>svx-pcms8.svx<\/li>\n<li>voc-alaw.voc<\/li>\n<li>voc-pcm16.voc<\/li>\n<li>voc-pcmu8.voc<\/li>\n<li>voc-ulaw.voc<\/li>\n<li>wav-alaw.wav<\/li>\n<li>wav-gsm610.wav<\/li>\n<li>wav-ima-adpcm.wav<\/li>\n<li>wav-ms-adpcm.wav<\/li>\n<li>wav-pcm16.wav<\/li>\n<li>wav-pcm24.wav<\/li>\n<li>wav-pcm32.wav<\/li>\n<li>wav-pcmu8.wav<\/li>\n<li>wav-ulaw.wav<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>I have been sitting on the results of this little experiment for a month now. I was in a bit more of a hurry during the qualification period for this year&#8217;s Summer of Code because I knew it would eventually yield a bumper crop of suitable qualification tasks. But that time has long passed. The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,55],"tags":[],"class_list":["post-556","post","type-post","status-publish","format-standard","hentry","category-open-source-multimedia","category-python"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/556","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":3,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/556\/revisions"}],"predecessor-version":[{"id":4573,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/posts\/556\/revisions\/4573"}],"wp:attachment":[{"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/media?parent=556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/categories?post=556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/multimedia.cx\/eggs\/wp-json\/wp\/v2\/tags?post=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}