{"id":2260,"date":"2022-11-26T14:52:49","date_gmt":"2022-11-26T12:52:49","guid":{"rendered":"https:\/\/alax.info\/blog\/?p=2260"},"modified":"2022-11-26T22:46:12","modified_gmt":"2022-11-26T20:46:12","slug":"encoding-multiple-concurrent-real-time-video-streams-with-nvidia-hardware-video-encoder","status":"publish","type":"post","link":"https:\/\/alax.info\/blog\/2260","title":{"rendered":"Encoding multiple concurrent real time video streams with NVIDIA hardware video encoder"},"content":{"rendered":"\n<p>NVIDIA consumer grade hardware provides support nowadays for &#8211; mostly &#8211; three concurrent sessions. The support matrix is provided here: <a href=\"https:\/\/developer.nvidia.com\/video-encode-and-decode-gpu-support-matrix-new\">Video Encode and Decode GPU Support Matrix | NVIDIA Developer<\/a>.<\/p>\n\n\n\n<p>This small tool starts video encoding with given signal parameters (resolution, rate) and provides an easy way to measure load of GPU video encoding engine.<\/p>\n\n\n\n<p>The application creates a Media Foundation pipeline with signal source based on software implementation of Direct2D and system memory backed RGB32 media samples. Then it is connected to H.264 video encoder MFT (not a stock one, a customer wrapper over NVIDIA SDK) with encoding profile around the lowest latency and maximal performance. The output is being fed into null media sink, with or without dumping created content to disk.<\/p>\n\n\n\n<p>Video feed configuration is defined in associated JSON file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{\n    \"Tasks\": &#91;\n        {\n            \"RateN\": 60,\n            \"RateD\": 1,\n            \"SizeW\": 1920,\n            \"SizeH\": 1080\n        },\n        {\n            \"RateN\": 60,\n            \"RateD\": 1,\n            \"SizeW\": 1920,\n            \"SizeH\": 1080\n        },\n        {\n            \"RateN\": 60,\n            \"RateD\": 1,\n            \"SizeW\": 1920,\n            \"SizeH\": 1080\n        }\n    ],\n    \"Duration\": 60\n}<\/code><\/pre>\n\n\n\n<p>The GPU load is displayed by task manager as encoding goes, for example three 1920&#215;1080@60 streams load NVIDIA GeForce RTX 2060 by ~45%.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"600\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-2-700x600.png\" alt=\"\" class=\"wp-image-2261\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-2-700x600.png 700w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-2-320x274.png 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-2-768x658.png 768w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-2-1536x1316.png 1536w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-2-600x514.png 600w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-2-1040x891.png 1040w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-2.png 1616w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p>Command line parameter <code>-ws<\/code> may be added to write streams to disk, the produced <code>.h264<\/code> files can be played out by Media Player Classic or other players:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"540\" src=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-3-800x540.png\" alt=\"\" class=\"wp-image-2262\" srcset=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-3-800x540.png 800w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-3-320x216.png 320w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-3-768x519.png 768w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-3-1536x1037.png 1536w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-3-600x405.png 600w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-3-1040x702.png 1040w, https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/image-3.png 1922w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>The archive below contains 32 and 64 bit builds of the utility with configuration files. Have fun!<\/p>\n\n\n\n<div class=\"wp-block-file\"><a id=\"wp-block-file--media-cae6d7fb-efba-4420-8f1e-5a18210b28b8\" href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/NviEncodeTest-20221126-e66fdcea3f200bd38856e87e93f9c63410e58d82.zip\">NviEncodeTest-20221126-e66fdcea3f200bd38856e87e93f9c63410e58d82<\/a><a href=\"https:\/\/alax.info\/blog\/wp-content\/uploads\/2022\/11\/NviEncodeTest-20221126-e66fdcea3f200bd38856e87e93f9c63410e58d82.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-cae6d7fb-efba-4420-8f1e-5a18210b28b8\">Download<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>NVIDIA consumer grade hardware provides support nowadays for &#8211; mostly &#8211; three concurrent sessions. The support matrix is provided here: Video Encode and Decode GPU Support Matrix | NVIDIA Developer. This small tool starts video encoding with given signal parameters (resolution, rate) and provides an easy way to measure load of GPU video encoding engine.&hellip; <\/p>\n<p><a class=\"moretag\" href=\"https:\/\/alax.info\/blog\/2260\">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":[379,424,547,398],"class_list":["post-2260","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-h-264","tag-media-foundation","tag-nvidia","tag-utilitiy"],"_links":{"self":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2260","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=2260"}],"version-history":[{"count":0,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/posts\/2260\/revisions"}],"wp:attachment":[{"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/media?parent=2260"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/categories?post=2260"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alax.info\/blog\/wp-json\/wp\/v2\/tags?post=2260"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}