{"id":313,"date":"2021-02-13T23:41:20","date_gmt":"2021-02-13T22:41:20","guid":{"rendered":"https:\/\/www.davidestebanmunoz.com\/?p=313"},"modified":"2023-11-19T23:45:44","modified_gmt":"2023-11-19T22:45:44","slug":"encoder-for-hdmi-capture-card-to-view-it-on-alexa-echo-show-and-mobile-devices","status":"publish","type":"post","link":"https:\/\/www.davidestebanmunoz.com\/?p=313","title":{"rendered":"Encoder for HDMI capture card to view it on Alexa Echo Show and mobile devices"},"content":{"rendered":"\n<p><a href=\"https:\/\/www.davidestebanmunoz.com\/?p=300&amp;lang=es\">Este art\u00edculo se puede leer en castellano aqu\u00ed<\/a><\/p>\n\n\n\n<p>This project, which is dual-purpose, involves two different Alexa skills, which I&#8217;ve named \u00abscreen control\u00bb and \u00abthe screen,\u00bb one of which is hosted on Amazon&#8217;s own servers, written in Node.js, and the other, written in Python, is hosted on my Raspberry Pi.<\/p>\n\n\n\n<p>On the other hand, it also involves a Telegram bot, written in Python, hosted on my Raspberry Pi.<\/p>\n\n\n\n<p>Taking a look at the wiring part, I had to purchase an HDMI splitter like this one:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"529\" height=\"521\" src=\"https:\/\/www.davidestebanmunoz.com\/wp-content\/uploads\/2023\/11\/imagen-3.png\" alt=\"\" class=\"wp-image-314\" style=\"width:326px;height:auto\" srcset=\"https:\/\/www.davidestebanmunoz.com\/wp-content\/uploads\/2023\/11\/imagen-3.png 529w, https:\/\/www.davidestebanmunoz.com\/wp-content\/uploads\/2023\/11\/imagen-3-300x295.png 300w\" sizes=\"auto, (max-width: 529px) 100vw, 529px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.aliexpress.com\/item\/1005001577128634.htm\">https:\/\/www.aliexpress.com\/item\/1005001577128634.htm<\/a><\/p>\n\n\n\n<p>And an HDMI capture card like this one:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"514\" height=\"509\" src=\"https:\/\/www.davidestebanmunoz.com\/wp-content\/uploads\/2023\/11\/imagen-1-1.png\" alt=\"\" class=\"wp-image-315\" style=\"width:223px;height:auto\" srcset=\"https:\/\/www.davidestebanmunoz.com\/wp-content\/uploads\/2023\/11\/imagen-1-1.png 514w, https:\/\/www.davidestebanmunoz.com\/wp-content\/uploads\/2023\/11\/imagen-1-1-300x297.png 300w, https:\/\/www.davidestebanmunoz.com\/wp-content\/uploads\/2023\/11\/imagen-1-1-150x150.png 150w\" sizes=\"auto, (max-width: 514px) 100vw, 514px\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/www.aliexpress.com\/item\/1005004990708725.html\">https:\/\/www.aliexpress.com\/item\/1005004990708725.html<\/a><\/p>\n\n\n\n<p>This way, it is possible to connect a TV decoder to both the TV and the HDMI capture card.<\/p>\n\n\n\n<p>The code for the \u00abthe screen\u00bb skill can be observed here, and simply upon the command, \u00abAlexa, open the screen,\u00bb it opens a video player pointing to the specified URL. As a note, it is CRITICAL that this URL be HTTPS, which is achieved through appropriate nginx configuration, a dynamic DDNS name, and Letsencrypt to sign the necessary certificates.<\/p>\n\n\n\n<p>The \u00abscreen control\u00bb skill, on the other hand, uses an HTTP-based API, similar to the one used in this project, to control what the encoder is playing and, through voice commands, change to the desired channel.<\/p>\n\n\n\n<p>It also runs the command:<\/p>\n\n\n\n<p>ffmpeg -f video4linux2 -input_format yuyv422 -s 1280&#215;720 -i \/dev\/video2 -f alsa -i plughw:CARD=UHD,DEV=0 -vcodec h264_omx -b:v 2M -c:a aac -b:a 64k -f mpegts -loglevel error -filter:v fps=30 &#8211; | \/usr\/bin\/vlc -I dummy &#8211; &#8211;sout \u00ab#duplicate{dst=std{access=http,mux=mkv,dst=:8950\/stream}}\u00bb<\/p>\n\n\n\n<p>To encode the captured video in a codec and resolution suitable for the Alexa Echo Show at the URL 127.0.0.1:8950\/stream, finally, nginx converts this loopback URL into a public URL under HTTPS.<\/p>\n\n\n\n<p>The Telegram bot is used to provide convenient interaction, also making use of the HTTP API to control what the encoder is playing and offering three different video qualities to choose from, suitable for desired data consumption or available bandwidth at that moment.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/www.davidestebanmunoz.com\/?p=313\">Read More<span class=\"screen-reader-text\">Encoder for HDMI capture card to view it on Alexa Echo Show and mobile devices<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19],"tags":[86,49,81],"class_list":["post-313","post","type-post","status-publish","format-standard","hentry","category-personal-projects","tag-alexa","tag-python","tag-telegram","excerpt"],"_links":{"self":[{"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=\/wp\/v2\/posts\/313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=313"}],"version-history":[{"count":2,"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions"}],"predecessor-version":[{"id":319,"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=\/wp\/v2\/posts\/313\/revisions\/319"}],"wp:attachment":[{"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.davidestebanmunoz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}