{"id":114,"date":"2018-03-21T14:04:02","date_gmt":"2018-03-21T05:04:02","guid":{"rendered":"http:\/\/oksisi2.ddns.net:8092\/wordpress\/?p=114"},"modified":"2019-12-21T18:55:21","modified_gmt":"2019-12-21T09:55:21","slug":"screen-recorder-%eb%a7%8c%eb%93%a4%ea%b8%b0","status":"publish","type":"post","link":"https:\/\/charlezz.com\/?p=114","title":{"rendered":"Screen Recorder \ub9cc\ub4e4\uae30"},"content":{"rendered":"<hr \/>\n<h1>ScreenRecorder<\/h1>\n<hr \/>\n<h2>\ud654\uba74 \ub179\ud654 \ud504\ub85c\uc138\uc2a4<\/h2>\n<ol>\n<li><span style=\"font-weight: 400;\">\ube44\ub514\uc624 \ucf54\ub371\uc73c\ub85c \ubd80\ud130 \uc5bb\uc740 Surface\ub97c \ud1b5\ud574 VirtualDisplay\ub97c \uc0dd\uc131\ud558\uc600\ub2e4\uba74, \ube44\ub514\uc624\ucf54\ub371\uc758 \ucd9c\ub825\ubc84\ud37c\ub85c\ubd80\ud130 \ubd80\ud638\ud654\ub41c \ud504\ub808\uc784 \ubc84\ud37c\ub97c \uc5bb\uc744\uc218 \uc788\ub2e4.<\/span><\/li>\n<li><span style=\"font-weight: 400;\">AudioRecord\ub85c \ubd80\ud130 \uc5bb\uc740 \uc624\ub514\uc624 \ubc84\ud37c(PCM)\ub97c \u00a0\uc624\ub514\uc624 \ucf54\ub371\uc758 \uc785\ub825\ubc84\ud37c\uc5d0 \ub123\uace0 \ud050\uc5d0 \ub123\ub294\ub2e4\uba74, \ucd9c\ub825\ubc84\ud37c\ub85c\ubd80\ud130 \ubd80\ud638\ud654\ub41c \uc624\ub514\uc624 \ubc84\ud37c\ub97c \uc5bb\uc744\uc218 \uc788\ub2e4.<br \/>\n<\/span><\/li>\n<li><span style=\"font-weight: 400;\">MediaMuxer\uc5d0 \ube44\ub514\uc624\uc640 \uc624\ub514\uc624\ud2b8\ub799\uc744 \ucd94\uac00\ud558\uace0, start() \ud55c\ub2e4.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/li>\n<li><span style=\"font-weight: 400;\">muxer.writeSampleData(trackIndex, buffer) \uba54\uc18c\ub4dc\ub97c \ud1b5\ud574 \uba39\uc2f1\uc744 \ud55c\ub2e4.<br \/>\n<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\ub179\ud654\ub97c \uc911\uc9c0\ud558\uace0 \uc2f6\ub2e4\uba74 stop(), release()\ub97c \uc21c\uc11c\ub300\ub85c \ud638\ucd9c\ud55c\ub2e4.<\/span><\/li>\n<\/ol>\n<p>\ub2e4\uc6b4\ub85c\ub4dc : <a href=\"https:\/\/github.com\/Charlezz\/ScreenRecorder\">https:\/\/github.com\/Charlezz\/ScreenRecorder<\/a><br \/>\n\u00a0<\/p>\n<hr \/>\n<h2>\uc548\ub4dc\ub85c\uc774\ub4dc \ud654\uba74 \ub370\uc774\ud130 \uc5bb\uae30<\/h2>\n<p><span style=\"font-weight: 400;\">\uc548\ub4dc\ub85c\uc774\ub4dc 5.0(Lollipop: API21) \ubd80\ud130 Screen \ub370\uc774\ud130\ub97c \uac00\uc838\uc62c \uc218 \uc788\ub294 MediaProjection\uc774 \u00a0\ucd94\uac00\ub418\uc5c8\uc2b5\ub2c8\ub2e4.<\/span><br \/>\n<span style=\"font-weight: 400;\">\uc774\ub97c \uc774\uc6a9\ud558\uc5ec \ud654\uba74\uc758 \uc2a4\ud06c\ub9b0\uc0f7\uc744 \ucc0d\uac70\ub098 \ub179\ud654\ud558\ub294 \uc560\ud50c\ub9ac\ucf00\uc774\uc158\uc744 \ub9cc\ub4e4 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/span><\/p>\n<hr \/>\n<h2>MediaProjection<\/h2>\n<p><span style=\"font-weight: 400;\">MediaProjectionManager\ub294 getSystemService\ub97c \ud1b5\ud574 \uc11c\ube44\uc2a4\ub97c \uc0dd\uc131\ud558\uace0, \uc0ac\uc6a9\uc790\uc5d0\uac8c \uad8c\ud55c\uc744 \uc694\uad6c\ud558\uac8c \ub429\ub2c8\ub2e4.<\/span><br \/>\n\u00a0<\/p>\n<pre><span style=\"font-weight: 400;\">MediaProjectionManager mgm = getSystemService(Context.MEDIA_PROJECTION_SERVICE)<\/span>\r\n<span style=\"font-weight: 400;\">startActivityForResult(mpm.createScreenCaptureIntent(), REQUEST_CODE);\r\n<\/span><\/pre>\n<hr \/>\n<h2>VirtualDisplay<\/h2>\n<pre><span style=\"font-weight: 400;\">protected void onActivityResult(int requestCode, int resultCode, Intent data){<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0if(requestCode==REQUEST_CODE){<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0mediaProjection = mgm.getMediaProjection(resultCode,data);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0\u00a0\u00a0\u00a0virtualDisplay = mediaProjection.createVirtualDisplay(\u201cname\u201d, <\/span><span style=\"font-weight: 400;\">screenWidth<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">screenHeight<\/span><span style=\"font-weight: 400;\">, <\/span><span style=\"font-weight: 400;\">screenDpi<\/span><span style=\"font-weight: 400;\">, flag, <\/span><span style=\"font-weight: 400;\">surface<\/span><span style=\"font-weight: 400;\">, null,null);<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0\u00a0}<\/span>\r\n<span style=\"font-weight: 400;\">}<\/span><\/pre>\n<p><i><span style=\"font-weight: 400;\">Note : \ud654\uba74\ub179\ud654\uc2dc\uc5d0\ub294 \ubc18\ub4dc\uc2dc \ucf54\ub371\uc73c\ub85c \ubd80\ud130 \uc5bb\uc740 surface \ub85c virtualDisplay\ub97c \uc0dd\uc131\ud574\uc57c\ud55c\ub2e4.<\/span><\/i><\/p>\n<hr \/>\n<h2>\uc18c\ub9ac \ub370\uc774\ud130 \uc5bb\uae30 (AudioRecord)<\/h2>\n<p>&nbsp;<\/p>\n<pre><span style=\"font-weight: 400;\">AudioRecord \uac1d\uccb4 \uc0dd\uc131 \ubc0f \ub808\ucf54\ub529 \uc2dc\uc791<\/span>\r\n<span style=\"font-weight: 400;\">mAudioRecord = new AudioRecord(mAudioSource, mSampleRate, mChannelCount, mAudioFormat, mBufferSize); \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mAudioRecord.startRecording();<\/span>\r\n<span style=\"font-weight: 400;\">\ud55c \ubc88\uc5d0 \uc804\ub2ec \ubc1b\uc744 \ucd5c\uc18c\uc758 audio data \ud06c\uae30 \uad6c\ud558\uae30<\/span>\r\n<span style=\"font-weight: 400;\">int bufferSize = AudioTrack.getMinBufferSize(mSampleRate, mChannelCount, mAudioFormat);<\/span>\r\n<span style=\"font-weight: 400;\">\ubc84\ud37c\uc5d0 \uc624\ub514\uc624 \ub370\uc774\ud130 \ub2f4\uae30<\/span>\r\n<span style=\"font-weight: 400;\">int byteCount = mAudioRecord.read(buffer, \u00a00, bufferSize);\r\n<\/span><\/pre>\n<hr \/>\n<h2><span style=\"font-weight: 400;\">MediaCodec \uac1d\uccb4 \uc0dd\uc131 \ud558\uae30<\/span><\/h2>\n<p>&nbsp;<\/p>\n<ul>\n<li><span style=\"font-weight: 400;\">MediaCodecList\ub97c \uc0ac\uc6a9\ud558\uc5ec \ud2b9\uc815 MediaFormat\uc5d0 \ub300\ud55c MediaCodec\uac1d\uccb4\ub97c \uc0dd\uc131\ud560 \uc218 \uc788\ub2e4. <\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><\/li>\n<li><span style=\"font-weight: 400;\">MediaCodec.createByCodecName(String name)\uc744 \uc0ac\uc6a9\ud558\uc5ec \uc6d0\ud558\ub294 \ucf54\ub371\uc744 \ub9cc\ub4e4\uc218 \uc788\ub2e4<br \/>\n<\/span><\/li>\n<li><span style=\"font-weight: 400;\">\ub9c8\ucc2c\uac00\uc9c0\ub85c \uc6d0\ud558\ub294 \ub514\ucf54\ub354 \ub610\ub294 \uc778\ucf54\ub354\ub97c \uc0dd\uc131\ud560 \uc218\ub3c4 \uc788\ub2e4.<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">MediaCodec.createDecoderByType(String type)<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">MediaCodec.createEncoderByType(String type)<\/span><\/li>\n<\/ul>\n<hr \/>\n<h2>MediaCodec \uc124\uc815\ud558\uae30<\/h2>\n<p><span style=\"font-weight: 400;\">\ubbf8\ub514\uc5b4 \ucf54\ub371 \uac1d\uccb4\ub97c \uc0dd\uc131\ud558\uc600\ub2e4\uba74 <\/span><b>configure(MediaFormat format, Surface surface, MediaCrypto crypto, int flags)<\/b><span style=\"font-weight: 400;\"> \uba54\uc18c\ub4dc\ub97c \uc0ac\uc6a9\ud558\uc5ec \uc791\uc5c5\uc5d0 \ud544\uc694\ud55c \ucd5c\uc18c\ud55c\uc758 \uc791\uc5c5\ud658\uacbd\uc744 \uc124\uc815\ud574\uc57c\ud55c\ub2e4. \uc124\uc815 \ud6c4 start()\ub97c \ud638\ucd9c\ud558\uc5ec \uc778\ucf54\ub529\/\ub514\ucf54\ub529 \uc791\uc5c5\uc744 \uc2dc\uc791\ud55c\ub2e4.<\/span><br \/>\n<span style=\"font-weight: 400;\">format:\uc785\ub825\ub370\uc774\ud130\uc758 \ud3ec\ub9f7 \ub610\ub294 \ucd9c\ub825\uc744 \ubc14\ub77c\ub294 \ub370\uc774\ud130\uc758 \ud3ec\ub9f7\uc744 \uac00\ub974\ud0a8\ub2e4.<\/span><br \/>\n<span style=\"font-weight: 400;\">surface: \ube44\ub514\uc624\ub97c \ub514\ucf54\ub529\ud558\uc5ec \ucd9c\ub825\ud558\uace0\uc790 \ud558\ub294 \ud654\uba74\uc744 \uac00\ub974\ud0a8\ub2e4.<\/span><br \/>\n<span style=\"font-weight: 400;\">crypto: \uc800\uc791\uad8c\uc774 \uac78\ub824\uc788\ub294 \uc554\ud638\ubb38\uc744 \ud3c9\ubb38\uc73c\ub85c \ubcf5\ud638\ud654\ud560 \ub54c \uc0ac\uc6a9\ud558\ub294 MediaCrypto\uac1d\uccb4\ub97c \uac00\ub974\ud0a8\ub2e4.<\/span><br \/>\n<span style=\"font-weight: 400;\">flags:\uc778\ucf54\ub354\ub85c \uc0ac\uc6a9\ud558\ub824\uba74 CONFIGURE_FLAG_ENCODE\ub85c \uc124\uc815\ud55c\ub2e4. \ub514\ucf54\ub354\uc758 \uacbd\uc6b0 0<\/span><br \/>\n\u00a0<\/p>\n<hr \/>\n<h2><b>MediaCodec \uc785\ucd9c\ub825\ubc84\ud37c<\/b><\/h2>\n<p><span style=\"font-weight: 400;\">\uc18c\ucf13\ucc98\ub7fc \ubbf8\ub514\uc5b4 \ucf54\ub371\uc73c\ub85c\ubd80\ud130 \uc785\ub825 \ubc84\ud37c\uc640 \ucd9c\ub825 \ubc84\ud37c\ub97c \ubc1b\uc744 \uc218 \uc788\ub2e4.<\/span><br \/>\n<span style=\"font-weight: 400;\">\uc785\ub825\ubc84\ud37c\uc5d0 \ub370\uc774\ud130\ub97c \ub123\uace0 \ud050\uc5d0 \ub123\uc73c\uba74, \ucd9c\ub825\ubc84\ud37c\ub85c\ubd80\ud130 \ubd80\ud638\ud654\ub41c \ub370\uc774\ud130\ub97c \uc5bb\uc744 \uc218 \uc788\ub2e4.<\/span><\/p>\n<p><a href=\"https:\/\/www.charlezz.com\/?attachment_id=43821\" rel=\"attachment wp-att-43821\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2018\/03\/mediacodec_buffers.png\" alt=\"\" width=\"540\" height=\"208\" class=\"aligncenter size-full wp-image-43821\" srcset=\"https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2018\/03\/mediacodec_buffers.png 540w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2018\/03\/mediacodec_buffers-300x116.png 300w\" sizes=\"(max-width: 540px) 100vw, 540px\" \/><\/a><br \/>\n\u0010<\/p>\n<hr \/>\n<h2>MediaMuxer<\/h2>\n<p><a href=\"https:\/\/www.charlezz.com\/?attachment_id=43823\" rel=\"attachment wp-att-43823\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.charlezz.com\/wordpress\/wp-content\/uploads\/2018\/03\/63cf9e176f2a2dbea22b9db37747d6a4e1cb035ef42d6c87d1e150657b59d217.png\" alt=\"\" width=\"1006\" height=\"440\" class=\"aligncenter size-full wp-image-43823\" srcset=\"https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2018\/03\/63cf9e176f2a2dbea22b9db37747d6a4e1cb035ef42d6c87d1e150657b59d217.png 1006w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2018\/03\/63cf9e176f2a2dbea22b9db37747d6a4e1cb035ef42d6c87d1e150657b59d217-300x131.png 300w, https:\/\/charlezz.com\/wordpress\/wp-content\/uploads\/2018\/03\/63cf9e176f2a2dbea22b9db37747d6a4e1cb035ef42d6c87d1e150657b59d217-768x336.png 768w\" sizes=\"(max-width: 1006px) 100vw, 1006px\" \/><\/a><span style=\"font-weight: 400;\"><a href=\"http:\/\/oksisi2.ddns.net:8092\/wordpress\/wp-content\/uploads\/2018\/03\/\ub3d9\uc601\uc0c101.jpg\"><br \/>\n<\/a>\ub3d9\uc601\uc0c1 \ud30c\uc77c\uc744 \ub9cc\ub4e4\uae30 \uc704\ud574\uc11c\ub294 \ubbf8\ub514\uc5b4 \uba39\uc11c\uac00 \ud544\uc694\ud558\ub2e4.<\/span><br \/>\n<span style=\"font-weight: 400;\">\ud2b8\ub799 : \uc601\uc0c1 \ub610\ub294 \uc74c\uc131<\/span><span style=\"font-weight: 400;\"><br \/>\n<\/span><span style=\"font-weight: 400;\">\ucee8\ud14c\uc774\ub108 : \uc601\uc0c1 \ub610\ub294 \uc74c\uc131 \ud2b8\ub799\uc744 \ucd94\uac00\ud560 \uc218 \uc788\ub294 \uacf5\uac04.<\/span><br \/>\n<span style=\"font-weight: 400;\">int <\/span><span style=\"font-weight: 400;\">addTrack<\/span><span style=\"font-weight: 400;\">(MediaFormat format) \uba54\uc18c\ub4dc\ub97c \ud638\ucd9c\ud558\uc5ec \ud2b8\ub799\uc744 \ucd94\uac00 \ud55c \ub4a4 <\/span><span style=\"font-weight: 400;\">start<\/span><span style=\"font-weight: 400;\">()\ub97c \ud638\ucd9c\ud558\uc5ec \uba39\uc2f1\uc744 \uc2dc\uc791\ud558\uace0, <\/span><span style=\"font-weight: 400;\">writeSampleData<\/span><span style=\"font-weight: 400;\">()\ub97c \ud1b5\ud574 \ub370\uc774\ud130\ub97c \ub123\uc744 \uc218 \uc788\ub2e4.<\/span><br \/>\n<span style=\"font-weight: 400;\">\uba39\uc2f1\uc744 \ub05d\ub0bc\ub54c\ub294 <\/span><span style=\"font-weight: 400;\">stop<\/span><span style=\"font-weight: 400;\">()\uc744 \ubc18\ub4dc\uc2dc \ud638\ucd9c\ud574\uc57c \ud55c\ub2e4.<\/span><\/p>\n<hr \/>\n<p>\u00a0<br \/>\n<a href=\"https:\/\/github.com\/Charlezz\/ScreenRecorder\">https:\/\/github.com\/Charlezz\/ScreenRecorder<\/a><br \/>\n\u00a0<br \/>\n\u00a0<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ScreenRecorder \ud654\uba74 \ub179\ud654 \ud504\ub85c\uc138\uc2a4 \ube44\ub514\uc624 \ucf54\ub371\uc73c\ub85c \ubd80\ud130 \uc5bb\uc740 Surface\ub97c \ud1b5\ud574 VirtualDisplay\ub97c \uc0dd\uc131\ud558\uc600\ub2e4\uba74, \ube44\ub514\uc624\ucf54\ub371\uc758 \ucd9c\ub825\ubc84\ud37c\ub85c\ubd80\ud130 \ubd80\ud638\ud654\ub41c \ud504\ub808\uc784 \ubc84\ud37c\ub97c \uc5bb\uc744\uc218 \uc788\ub2e4. AudioRecord\ub85c \ubd80\ud130 \uc5bb\uc740 \uc624\ub514\uc624 \ubc84\ud37c(PCM)\ub97c \u00a0\uc624\ub514\uc624 \ucf54\ub371\uc758 \uc785\ub825\ubc84\ud37c\uc5d0 \ub123\uace0 \ud050\uc5d0 \ub123\ub294\ub2e4\uba74, \ucd9c\ub825\ubc84\ud37c\ub85c\ubd80\ud130 \ubd80\ud638\ud654\ub41c \uc624\ub514\uc624 \ubc84\ud37c\ub97c \uc5bb\uc744\uc218 \uc788\ub2e4. MediaMuxer\uc5d0 \ube44\ub514\uc624\uc640 \uc624\ub514\uc624\ud2b8\ub799\uc744 \ucd94\uac00\ud558\uace0, start() \ud55c\ub2e4. muxer.writeSampleData(trackIndex, buffer) \uba54\uc18c\ub4dc\ub97c \ud1b5\ud574 \uba39\uc2f1\uc744 \ud55c\ub2e4. \ub179\ud654\ub97c \uc911\uc9c0\ud558\uace0 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"inline_featured_image":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0},"categories":[16],"tags":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/114"}],"collection":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=114"}],"version-history":[{"count":2,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions"}],"predecessor-version":[{"id":43824,"href":"https:\/\/charlezz.com\/index.php?rest_route=\/wp\/v2\/posts\/114\/revisions\/43824"}],"wp:attachment":[{"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=114"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=114"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/charlezz.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}