{"id":3312,"date":"2019-09-01T07:09:09","date_gmt":"2019-09-01T05:09:09","guid":{"rendered":"https:\/\/pythonprogramming.altervista.org\/?p=3312"},"modified":"2019-09-10T08:45:41","modified_gmt":"2019-09-10T06:45:41","slug":"ffmpeg-record-screen-update","status":"publish","type":"post","link":"https:\/\/pythonprogramming.altervista.org\/ffmpeg-record-screen-update\/","title":{"rendered":"Ffmpeg record screen update"},"content":{"rendered":"<p>I often write about ffmpeg, because I use it for my videos. The reason I use ffmpeg, this tool to manipulate video, record screen etc. is due to the fact that it is fast, once you understood the command you need (not easy indeed) your workflow goes to the speed of light, and that is saves memory as the .mp4 of the recorded screen are very light. You can do a lot of things. Last thing that I am trying is recording just a window, to save even more memory. It is not so easy, but I am experimenting. I want to share this fact here, a bit curious. I wanted to record the Prompt of windows, but it gave me some errors do to the dimension of the window, something like &#8230; this screen size is not divisible&#8230; so, I tryied different sizes until I put the col and row in the property of the window to <strong>100&#215;20<\/strong> and&#8230; it worked! So these are the commands, but remember to choose a divisible size (!).<\/p>\n<figure id=\"attachment_3313\" aria-describedby=\"caption-attachment-3313\" style=\"width: 390px\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/prompt.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-3313 size-full\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/prompt.png\" alt=\"\" width=\"390\" height=\"491\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/prompt.png 390w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/prompt-320x403.png 320w\" sizes=\"auto, (max-width: 390px) 100vw, 390px\" \/><\/a><figcaption id=\"caption-attachment-3313\" class=\"wp-caption-text\">This dimentions worked for me<\/figcaption><\/figure>\n<p>Create a .bat file like this<\/p>\n<pre class=\"lang:default decode:true \">ffmpeg -rtbufsize 1500M -f dshow -i audio=\"Microfono (8- Logitech USB Headset)\" -f gdigrab -framerate 30 -draw_mouse 1 -i title=\"Prompt dei comandi\" -pix_fmt yuv420p -profile:v baseline -y output\\output3_xp.mp4\r\npause<\/pre>\n<h2>The devices&#8230; how to check the name of the mic<\/h2>\n<p>Save a .bat file with these commands if you need to know the name of the mic to substitute the one in the code above, because in each pc it is different<\/p>\n<pre class=\"lang:default decode:true \">ffmpeg -list_devices true -f dshow -i dummy\r\n\r\npause<\/pre>\n<h2>An example<\/h2>\n<p>This is what I recorded as an example<\/p>\n<div style=\"width: 747px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3312-1\" width=\"747\" height=\"326\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output3_xp.mp4?_=1\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output3_xp.mp4\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output3_xp.mp4<\/a><\/video><\/div>\n<h2>Another example<\/h2>\n<p>In this example, instead, I haven&#8217;t had the problems I had with the Prompt&#8230; I used this python file code that asks me the name of the window (in this exampe is <strong>Python<\/strong>):<\/p>\n<pre class=\"lang:default decode:true \">import os\r\n\r\nname = input(\"Window name: \")\r\nos.system(\"\"\"ffmpeg -rtbufsize 1500M -f dshow -i audio=\"Microfono (8- Logitech USB Headset)\" -f gdigrab -framerate 30 -draw_mouse 1 -i title=\"\"\" + name + \"\"\" -pix_fmt yuv420p -profile:v baseline -y output\\\\output2.mp4\"\"\")<\/pre>\n<p>This is an example of a recording of the Python window &#8230;<\/p>\n<div style=\"width: 738px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3312-2\" width=\"738\" height=\"234\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output2.mp4?_=2\" \/><a href=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output2.mp4\">https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/09\/output2.mp4<\/a><\/video><\/div>\n<h2>Record just a window for some time<\/h2>\n<p>To record a specific window (by its name) and for a specific amount of time, you can use this code and save it as a .bat file<\/p>\n<pre class=\"lang:default decode:true\">ffmpeg -rtbufsize 1500M -f dshow -i audio=\"Microfono (8- Logitech USB Headset)\" -f gdigrab -framerate 30 -draw_mouse 1 -i title=Trace -pix_fmt yuv420p -profile:v baseline -y -t 00:00:30 win30sec.mp4\r\n\r\npause<\/pre>\n<p>The duration is the -t 00:00:30<\/p>\n<p>You can change it to the duration you want.<\/p>\n<h3>Ffmpeg & Python for videos<\/h3>\t\r\n<script>\r\nvar title = \"Ffmpeg\";\r\n\t\tvar links = [\r\n\t\t\t[\"https:\/\/pythonprogramming.altervista.org\/tkinter-utilities-convert-a-wav-in-mp3-with-a-gui\/\",\"Convert Wav to Mp3 with a GUI\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/get-audio-from-mp4-live-coding-ffmpeg-python-tkinter\/\",\"Get Audio From A Video\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/python-and-ffmpeg-grabs-some-seconds-from-an-mp4-video\/\",\"Get some seconds from a video\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/how-to-record-just-a-window-with-ffmpeg\/\",\"Record a window 1\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/ffmpeg-record-screen-update\/\",\"Record a window 2\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/record-the-screen-with-ffmpeg-and-python\/\",\"Record entire screen\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/automate-video-trimming-with-ffmpeg-and-python\/\",\"Automate video trimming\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/join-all-mp4-with-python-and-ffmpeg\/\",\"Join all mp4\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/concatenate-mp4-videos-of-different-size-with-python-and-ffmpeg\/\",\"Concatenate mp4 of different size\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/how-to-transform-an-mp4-to-gif-with-python-and-ffmpeg-ffmpy-module\/\",\"Mp4 to Gif with ffmpeg\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/animated-cartoon-gif-with-pil-and-python-1\/\",\"Convert Gif to Mp4 with ffmpeg (at the bottom of the post)\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/how-to-speed-a-video-2-times\/\",\"How to speed a video\"],\r\n[\"https:\/\/pythonprogramming.altervista.org\/tkinter-a-program-start-mp4-with-ffplay\/\",\"Start mp4 with ffplay\"]\r\n\t\t\t\t\t];\r\n\t\t\r\n\t<\/script>\r\n<script>\r\n\t\r\nif (typeof next2 != \"undefined\"){let next2 = 0;}\r\n\t\r\nnext2 = 0;\r\n\thtml = \"\";\/\/<b style='color:coral;font-size:1.2em'>Other posts about \" + title + \"<\/b><br>\";\r\nfor (address of links) \r\n{\r\n\r\n\tif (next2 == 1){\r\n\t\thtml += \"<div style='background:coral'>\";\r\n\t\thtml += \"Next link => <a href='\" + address[0] + \"'>\" + address[1] + \"<\/a>\";\r\n\t\thtml += \"<\/div><br>\";\r\n\t\tnext2 = 0;\r\n\t}\r\n\tif (address[0] == document.URL) {\r\n\t\tnext2 = 1;\r\n\t}\r\n}\r\n\r\nif (typeof next != \"undefined\") {let next = 0;}\r\nif (typeof addressStart != \"undefined\") {let addressStart = \"\";}\r\nnext = 0;\r\naddressStart = \"<a href='\";\r\nfor (address of links) {\r\n\tif (next == 1){\r\n\t\thtml += \">>>\" + addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t\tnext = 0;\r\n\t}\r\n\telse if (addressStart + address[0] != document.URL)\r\n\t{\r\n\t\thtml += addressStart + address[0] + \"'>\" + address[1] + \"<\/a><br>\";\r\n\t}\r\n\telse\r\n\t{\r\n\t\tnext = 1;\r\n\t\tnext_address = address[0]\r\n\t\tnext_title = address[1]\r\n\t\thtml += \"<span style='color:gray'>\" + address[1] + \"<\/span><br>\";\r\n\t}\r\n\r\n}\r\n\r\n\thtml += `<span style=\"font-size:8px\">Powered by <a href=\"https:\/\/pythonprogramming.altervista.org\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2673\" src=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png\" alt=\"\" width=\"70\" height=\"25\" srcset=\"https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2.png 156w, https:\/\/pythonprogramming.altervista.org\/wp-content\/uploads\/2019\/06\/altervista2-150x56.png 150w\" sizes=\"auto, (max-width: 70px) 100vw, 70px\" \/>pythonprogramming.altervista.org<\/a><\/span>`\r\n\thtml = \"<div style='background:yellow'>\" + html + \"<\/div>\";\r\n\tdocument.write(html)\r\n<\/script>\n","protected":false},"excerpt":{"rendered":"How to record from the screen with the Commands Prompt and the Python bash\n<a class=\"moretag\" href=\"https:\/\/pythonprogramming.altervista.org\/ffmpeg-record-screen-update\/\"> [...]<\/a>","protected":false},"author":1,"featured_media":3316,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1,417],"tags":[197],"class_list":["post-3312","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-examples","category-ffmpeg","tag-ffmpeg"],"avopt_banners_inside_post":true,"avopt_banners_on_page":true,"av_copy_from":"","av_sharing_message":"","av_sharing_allowed":false,"av_sharing_on":{"fb":[],"tw":[]},"av_allow_affiliate_banner":false,"av_allow_affiliate_multi_banner":false,"av_show_affiliation_buy_button":false,"av_post_rating":true,"av_have_post_rating_value":false,"av_is_artificial_intelligence_content":false,"_links":{"self":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/3312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/comments?post=3312"}],"version-history":[{"count":4,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/3312\/revisions"}],"predecessor-version":[{"id":3515,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/posts\/3312\/revisions\/3515"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media\/3316"}],"wp:attachment":[{"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/media?parent=3312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/categories?post=3312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pythonprogramming.altervista.org\/wp-json\/wp\/v2\/tags?post=3312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}