{"id":2051,"date":"2020-05-09T23:59:57","date_gmt":"2020-05-09T21:59:57","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=2051"},"modified":"2020-05-28T20:03:12","modified_gmt":"2020-05-28T18:03:12","slug":"heterogeneous-media-foundation-pipelines","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/2051","title":{"rendered":"Heterogeneous Media Foundation pipelines"},"content":{"rendered":"\n<p>Just a small test here to feature use of multiple GPUs within single Media Foundation pipeline. The initial idea here is pretty simple: quite so many systems are equipped with multiple GPUs, some have &#8220;free&#8221; onboard Intel GPU idling in presence of regular video card. Some other systems have integrated &#8220;iGPU&#8221; and discrete &#8220;dGPU&#8221; seamlessly blended by DXGI.<\/p>\n\n\n\n<p>Media Foundation API does not bring any specific feature set to leverage multiple GPUs at a time, but this is surely possible to take advantage of.<\/p>\n\n\n\n<p>The application creates a 20 second long video clips by combining GPUs: one GPU is used for video rendering and another is a host of hardware H.264 video encoding. No system memory is used for uncompressed video: system memory jumps in first to receive encoded H.264 bitstream. The Media Foundation pipeline hence is:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Media Source generating video frames off its video stream using the first GPU<\/li><li>Transform to combine multiple GPUs<\/li><li>H.264 video encoder transform specific to second GPU<\/li><li>Stock MP4 Media Sink<\/li><\/ul>\n\n\n\n<p>The pipeline runs in a single media session pretty much like normal pipeline. Media Foundation is designed in the way that primitives do not have to be aligned in their GPU usage with the pipeline. Surely they have to share devices and textures so that they all could operate together, but pipeline itself does not put much of limitations there.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Microsoft Windows [Version 10.0.18363.815]\n(c) 2019 Microsoft Corporation. All rights reserved.\n\nC:\\Temp&gt;HeterogeneousRecordFile.exe\nHeterogeneousRecordFile.exe 20200502.1-11-gd3d16d5 (Release)\nd3d16d51e7f2a098c5765d445714f14051c7a68d\nHEAD -&gt; master, origin\/master\n2020-05-09 23:51:54 +0300\n--\nFound 2 DXGI adapters\nTrying heterogeneous configurations\u00e2\u20ac\u00a6\nUsing NVIDIA GeForce GTX 1650 to render video and Intel(R) HD Graphics 4600 to encode the content\nUsing filename HeterogeneousRecordFile-20200509-235406.mp4 for recording\nUsing Intel(R) HD Graphics 4600 to render video and NVIDIA GeForce GTX 1650 to encode the content\nUsing filename HeterogeneousRecordFile-20200509-235411.mp4 for recording\nTrying trivial configuration with loopback data transfer\u00e2\u20ac\u00a6\nUsing NVIDIA GeForce GTX 1650 to render video and NVIDIA GeForce GTX 1650 to encode the content\nUsing filename HeterogeneousRecordFile-20200509-235416.mp4 for recording\nUsing Intel(R) HD Graphics 4600 to render video and Intel(R) HD Graphics 4600 to encode the content\nUsing filename HeterogeneousRecordFile-20200509-235419.mp4 for recording<\/pre>\n\n\n\n<figure class=\"wp-block-video\"><video height=\"1080\" style=\"aspect-ratio: 1920 \/ 1080;\" width=\"1920\" controls src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/05\/HeterogeneousRecordFile-20200509-234226-2.mp4\"><\/video><\/figure>\n\n\n\n<p>This is just a simple use case, I believe there can be other: GPUs are pretty powerful for certain specific tasks, and they are also equipped with video specific ASICs.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Download links<\/h3>\n\n\n\n<p>Binaries:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li> 64-bit: <a href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2020\/05\/HeterogeneousRecordFile-20200528-c34d70f8f1240c2ef9ef2ce88da95e8b8110c4c1.zip\">HeterogeneousRecordFile.exe<\/a>  (in .ZIP archive)<\/li><li> License: This software is free to use<\/li><\/ul>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just a small test here to feature use of multiple GPUs within single Media Foundation pipeline. The initial idea here is pretty simple: quite so many systems are equipped with multiple GPUs, some have &#8220;free&#8221; onboard Intel GPU idling in presence of regular video card. Some other systems have integrated &#8220;iGPU&#8221; and discrete &#8220;dGPU&#8221; seamlessly&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/2051\">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":[544,606,505,379,424,486],"class_list":["post-2051","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-direct3d-11","tag-direct3d-12","tag-gpu","tag-h-264","tag-media-foundation","tag-video"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2051","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=2051"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2051\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=2051"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=2051"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=2051"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}