{"id":2106,"date":"2020-08-30T20:34:28","date_gmt":"2020-08-30T18:34:28","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=2106"},"modified":"2020-08-30T22:00:57","modified_gmt":"2020-08-30T20:00:57","slug":"media-foundation-support-for-opus-5-1-audio","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/2106","title":{"rendered":"Media Foundation support for Opus 5.1 audio"},"content":{"rendered":"\n<p>There is some support for Opus in Windows, unfortunately however it is not documented. IIRC it came to <a href=\"https:\/\/blogs.windows.com\/msedgedev\/2016\/04\/18\/webm-vp9-and-opus-support-in-microsoft-edge\/\">extend media codec support in Microsoft Edge browser<\/a>, and since internally Microsoft Edge is using standard platform media API Media Foundation, the decoder came in format of Media Foundation Transform.<\/p>\n\n\n\n<p>It is interesting that Opus decoding was put deep enough to appear across multiple environments, including even Windows IoT:<\/p>\n\n\n\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-fooling-around\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"iivftx0UQ6\"><a href=\"https:\/\/alax.info\/blog\/1923\">Media Foundation on Raspberry Pi 3 Model B+<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Media Foundation on Raspberry Pi 3 Model B+&#8221; &#8212; Fooling Around\" src=\"https:\/\/alax.info\/blog\/1923\/embed#?secret=iivftx0UQ6\" data-secret=\"iivftx0UQ6\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>However, Microsoft did not update Media Foundation API itself to indicate presence of new codec support. <a href=\"https:\/\/docs.microsoft.com\/en-us\/windows\/win32\/medfound\/codecobjects\">The documentation has no mention for Opus decoder.<\/a> The thing has been present in Windows for four years, but it is not exposed to developers&#8230;<\/p>\n\n\n\n<p>Apart from this, stock support for Opus either decoder or WebM parser, or both, are limited to mono or stereo audio. There is no support for more sophisticated channel configurations. Neither in Media Foundation, nor in Edge itself. Edge Beta has it because it inherited the capability from Chrome, which in turn bundles libopus directly, through use of FFmpeg.<\/p>\n\n\n\n<p>5.1 Opus audio fragment played by Edge Beta but not Edge:<\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/opus-6ch.webm\"><\/video><\/figure>\n\n\n\n<p>Edge Beta&#8217;s internals:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"722\" height=\"600\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-3-722x600.png\" alt=\"\" class=\"wp-image-2108\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-3-722x600.png 722w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-3-320x266.png 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-3-768x638.png 768w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-3-600x498.png 600w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-3-1040x864.png 1040w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-3.png 1531w\" sizes=\"auto, (max-width: 722px) 100vw, 722px\" \/><\/figure>\n\n\n\n<p>Since the limitation is in Media Foundation primitives, other Media Foundation based applications exhibit similar behavior. For example, Movies and TV application similarly fails on this media file.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"749\" height=\"600\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-4-749x600.png\" alt=\"\" class=\"wp-image-2109\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-4-749x600.png 749w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-4-320x257.png 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-4-768x616.png 768w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-4-600x481.png 600w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-4-1040x834.png 1040w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/08\/image-4.png 1532w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>There is some support for Opus in Windows, unfortunately however it is not documented. IIRC it came to extend media codec support in Microsoft Edge browser, and since internally Microsoft Edge is using standard platform media API Media Foundation, the decoder came in format of Media Foundation Transform. It is interesting that Opus decoding was&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/2106\">Read the full article<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[485,424,426,597,568,150],"class_list":["post-2106","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-audio","tag-media-foundation","tag-mft","tag-mse","tag-opus","tag-windows"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2106","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/comments?post=2106"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2106\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=2106"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=2106"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=2106"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}