{"id":375934,"date":"2024-05-21T06:37:33","date_gmt":"2024-05-21T06:37:33","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=375934"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=375934","title":{"rendered":"<span>YouTube Shorts \u0438\u0437 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u0430. \u041a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0432\u0438\u0434\u0435\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e FFMPEG \u0438 Bash. \u0427\u0430\u0441\u0442\u044c 2<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/kx\/2f\/nj\/kx2fnjvfjhgcvkv5kqyaf3cm52y.png\" data-src=\"https:\/\/habrastorage.org\/webt\/kx\/2f\/nj\/kx2fnjvfjhgcvkv5kqyaf3cm52y.png\"\/><\/div>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! <a href=\"https:\/\/habr.com\/ru\/companies\/selectel\/articles\/802809\/\">\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043d\u0430\u0440\u0435\u0437\u043a\u0443 YouTube-\u0432\u0438\u0434\u0435\u043e \u043d\u0430 Shorts, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u0442\u0435\u043a\u0441\u0442 \u0438 \u0440\u0430\u0437\u043c\u044b\u0442\u044b\u0439 \u0444\u043e\u043d. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u2014 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0435\u043c \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u043c. \u0412 \u0442\u0435\u043a\u0441\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Bark \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e ASCII-\u043c\u0430\u0441\u043a\u043e\u0442\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u2014 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c. <br \/>  <a name=\"habracut\"><\/a><br \/>  <b>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043d\u0430\u0432\u0438\u0433\u0430\u0446\u0438\u044e, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0443\u044e\u0449\u0438\u0439 \u0431\u043b\u043e\u043a<\/b><\/p>\n<p>  \u2192 <a href=\"#1\">\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/a><br \/>  \u2192 <a href=\"#2\">\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438 \u043a\u0430\u0434\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/a><br \/>  \u2192 <a href=\"#3\">\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e<\/a><br \/>  \u2192 <a href=\"#4\">\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043c\u0430\u0441\u043a\u043e\u0442\u0430<\/a><br \/>  \u2192 <a href=\"#5\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e UI<\/a><br \/>  \u2192 <a href=\"#6\">\u0418\u0442\u043e\u0433\u0438<\/a><\/p>\n<p>  <a name=\"1\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/h2>\n<p><\/font><br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u0432\u0432\u043e\u0434\u043d\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u041c\u043e\u044f \u0433\u043b\u0430\u0432\u043d\u0430\u044f \u0446\u0435\u043b\u044c \u2014 \u043d\u0430\u0447\u0430\u0442\u044c \u0443\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0438\u0433\u0440\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u043f\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u043d\u0442\u0430\u0436\u0430 \u0432\u0438\u0434\u0435\u043e \u0434\u043b\u044f YouTube Shorts. <a href=\"https:\/\/store.steampowered.com\/app\/2671770\/HackeRPG\/\">\u0418\u0433\u0440\u0430<\/a> \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0445\u0430\u043a\u0435\u0440\u0441\u043a\u043e\u0439 \u044d\u0441\u0442\u0435\u0442\u0438\u043a\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u044e \u0432 \u044d\u0442\u0443 \u0430\u0442\u043c\u043e\u0441\u0444\u0435\u0440\u0443, \u0440\u0435\u0448\u0438\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u043e\u0431\u043e\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0433\u043e\u043b\u043e\u0441 \u0434\u043b\u044f \u043e\u0437\u0432\u0443\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e \u0438 ASCII-\u043c\u0430\u0441\u043a\u043e\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 <s>\u0433\u043e\u0432\u043e\u0440\u0438\u0442<\/s> \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0440\u043e\u0442 \u0432 \u0442\u0430\u043a\u0442 \u0442\u0435\u043a\u0441\u0442\u0430.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/b19\/824\/db7\/b19824db78a109bfdb92c7e7af03898e.png\" width=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/b19\/824\/db7\/b19824db78a109bfdb92c7e7af03898e.png\"\/><\/div>\n<p>  <i>\u0412\u043d\u0435\u0448\u043d\u0438\u0439 \u0432\u0438\u0434 ASCII-\u043c\u0430\u0441\u043a\u043e\u0442\u0430. <\/i><\/p>\n<p>  \u041c\u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0432 \u0432\u0438\u0434\u0435\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436\u0435\u043c, \u043d\u043e \u043e\u0431\u0438\u043b\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u043b\u043e \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u2014 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u044f \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043b \u0435\u0435 \u043e\u0442 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0438\u043b \u0441\u0432\u0435\u0440\u0445\u0443 \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u043b \u0432 \u0440\u0430\u0437\u043c\u0435\u0440\u0435, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043a\u043e\u0434.<\/p>\n<p>  \u0420\u0435\u0437\u044e\u043c\u0438\u0440\u0443\u0435\u043c, \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u0435\u043d \u0443\u043c\u0435\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442.<\/p>\n<ol>\n<li>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u043a\u0430\u0434\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0438\u0434\u0435\u043e \u0432 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0435. <\/li>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0442\u0435\u043a\u0441\u0442\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0432\u0443\u043a\u043e\u0432\u044b\u0435 \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0434\u043b\u044f \u0440\u043e\u0431\u043e\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u0433\u043e\u043b\u043e\u0441\u0430. <\/li>\n<li>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438 \u043c\u0430\u0441\u043a\u043e\u0442\u0430, \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043a \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0443.<\/li>\n<\/ol>\n<p>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430 \u0432\u044b\u0431\u0440\u0430\u043b Python. \u0412 \u043d\u0435\u043c \u043c\u043d\u043e\u0433\u043e TTS-\u0440\u0435\u0448\u0435\u043d\u0438\u0439 (text-to-speech), \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0441\u0442 \u0432 \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u043d\u0443\u044e \u0440\u0435\u0447\u044c.<\/p>\n<p>  <a name=\"2\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438 \u043a\u0430\u0434\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435<\/h2>\n<p><\/font><br \/>  \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 \u043c\u044b \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u0438, \u0447\u0442\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u043e\u0431\u043e\u0439 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e \u2014 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0434\u043d\u043e\u0439 FFMPEG-\u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435 \u0431\u0443\u0434\u0443 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b FFMPEG-\u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u0442\u044c\u0441\u044f. \u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u0443\u0437\u043d\u0430\u0442\u044c \u043e \u043d\u0435\u0439 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u0435 <a href=\"https:\/\/habr.com\/ru\/companies\/selectel\/articles\/802809\/\">\u043f\u043e \u0441\u0441\u044b\u043b\u043a\u0435<\/a>.<\/p>\n<pre><code class=\"python\">if [[ -z $3 ]]; then   start_time=\"0\" fi  if [[ $no_console -ne 1 ]]; then   console=\"[3:v]scale=1080*4:-1, crop=in_w:200:0:100, trim=start=$start_time, setpts=PTS-STARTPTS[console];\\     [mix][console]overlay=0:0[mix];\" else   console=\"\" fi  ffmpeg -i $background -i $video -filter_complex \\   \"[0:v]scale=1080:1920[bg]; \\   [1:v]scale=1080*2:-1, trim=start=$start_time, crop=in_w:in_h-300, setpts=PTS-STARTPTS[vid]; \\   [1:a]volume=0.1,atrim=start=$start_time;\\   [bg][vid]overlay=(W-w)\/2:0[mix];$console\" \\   -map [mix] -map  -r 60 output.mp4  -y <\/code><\/pre>\n<p>  \u0412 \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u0441\u0432\u0435\u0440\u0445\u0443. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0442\u0430\u043a\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 $no_console, \u0438 \u043e\u043d\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u043c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0432\u0438\u0434\u0435\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0439, \u043d\u043e \u0438 \u0434\u0440\u0443\u0433\u0443\u044e \u0437\u0430\u043f\u0438\u0441\u044c. \u041f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0440\u043e\u043b\u0438\u043a \u0431\u0435\u0437 \u0444\u0443\u0442\u0430\u0436\u0435\u0439 \u0438\u0433\u0440\u044b.<\/p>\n<p>  <a href=\"https:\/\/pro.selectel.ru\/20-kubernetes\/?utm_source=habr.com&amp;utm_medium=referral&amp;utm_campaign=dbaas_article_marketing_140524_banner_058_01_ord\"><\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zj\/k4\/6h\/zjk46h9tfezvth4lctrpy0djsaq.png\" data-src=\"https:\/\/habrastorage.org\/webt\/zj\/k4\/6h\/zjk46h9tfezvth4lctrpy0djsaq.png\"\/><\/div>\n<p><\/a><br \/>  <a name=\"3\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0430\u0443\u0434\u0438\u043e<\/h2>\n<p><\/font><br \/>  \u0423 Python \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e TTS-\u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0438\u0437 \u043d\u0438\u0445 \u043c\u0435\u043d\u044f \u043d\u0435 \u0443\u0441\u0442\u0440\u043e\u0438\u043b\u0438. \u041c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0436\u0435\u043d\u0441\u043a\u0438\u0439 \u0433\u043e\u043b\u043e\u0441, \u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0440\u0435\u0448\u0435\u043d\u0438\u0439, \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0431\u044b\u043b\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043c\u0430\u043b\u043e.<\/p>\n<p>  \u041f\u043e\u0437\u0436\u0435 \u044f \u043d\u0430\u0448\u0435\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 <a href=\"https:\/\/github.com\/suno-ai\/bark\">Bark<\/a> \u2014 \u043c\u043d\u0435 \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c \u043f\u043e\u044d\u0442\u0438\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f. \u041e\u043d\u0430 \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u043e\u0431\u043e\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442 \u0442\u0435\u043a\u0441\u0442, \u043d\u043e \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0430\u0443\u0437\u044b, \u0432\u0437\u0434\u043e\u0445\u0438, \u0441\u043c\u0435\u0448\u043a\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043d\u044e\u0430\u043d\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0436\u0438\u0432\u043b\u044f\u044e\u0442 \u0433\u043e\u043b\u043e\u0441. \u042f \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b, \u0443\u043c\u0435\u0435\u0442 \u043b\u0438 \u0433\u043e\u043b\u043e\u0441 \u043b\u0430\u044f\u0442\u044c, \u043d\u043e \u043d\u0435 \u0443\u0434\u0438\u0432\u0438\u043b\u0441\u044f, \u0435\u0441\u043b\u0438 \u0431\u044b \u0438 \u0442\u0430\u043a\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0431\u044b\u043b\u0430.<\/p>\n<p>  \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u044b\u0439, \u044f \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u043b \u0435\u0433\u043e \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0430\u0439\u043b\u043e\u0432. \u0423 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u044b\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430.<\/p>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0430\u0439\u043b genwav.py \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430\u0448\u0435\u0439 \u0430\u0443\u0434\u0438\u043e\u0434\u043e\u0440\u043e\u0436\u043a\u0438. \u0421\u0442\u043e\u0438\u0442 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0430\u0434\u0435\u043a\u0432\u0430\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0430\u0443\u0434\u0438\u043e \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435 \u0431\u043e\u043b\u0435\u0435 13 \u0441\u0435\u043a\u0443\u043d\u0434. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u043a\u0430\u043a \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0439\u0442\u0438. \u0420\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u0442\u0435\u043a\u0441\u0442 \u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0441\u043a\u043b\u0435\u0438\u0432\u0430\u0435\u043c \u0438\u0445 \u0432 \u043e\u0434\u0438\u043d \u0444\u0430\u0439\u043b. \u0412\u043e\u0442 \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432 \u0438\u0442\u043e\u0433\u0435:<\/p>\n<pre><code class=\"python\">import os import torch  os.environ[\"SUNO_ENABLE_MPS\"] = \"True\" torch.device(\"mps\")  import nltk   nltk.download('punkt') import numpy as np  from bark.generation import (     generate_text_semantic,     preload_models, ) from bark.api import semantic_to_waveform from bark import generate_audio, SAMPLE_RATE  import sys input = sys.argv[1]   with open(input,'r') as i:     text = i.read()  sentences = nltk.sent_tokenize(text)     from transformers import AutoProcessor, BarkModel  processor = AutoProcessor.from_pretrained(\"suno\/bark\") model = BarkModel.from_pretrained(\"suno\/bark\")  GEN_TEMP = 0.8 SPEAKER = \"v2\/en_speaker_9\"  pieces = [] for sentence in sentences:     semantic_tokens = generate_text_semantic(         sentence,         history_prompt=SPEAKER,         temp=GEN_TEMP,         min_eos_p=0.05,     )      audio_array = semantic_to_waveform(semantic_tokens, history_prompt=SPEAKER,)     pieces += [audio_array]  result = np.concatenate(pieces)  import scipy  scipy.io.wavfile.write(\"temp\/voice.wav\", rate=int(SAMPLE_RATE), data=result) <\/code><\/pre>\n<p>  \u041c\u043d\u0435 \u043d\u0443\u0436\u0435\u043d \u0431\u044b\u043b \u0438\u043c\u0435\u043d\u043d\u043e \u0436\u0435\u043d\u0441\u043a\u0438\u0439 \u0433\u043e\u043b\u043e\u0441, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u043c\u043e\u0434\u0435\u043b\u044c v2\/en_speaker_9. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 WAV-\u0444\u043e\u0440\u043c\u0430\u0442. \u041e\u043d\u0430 \u0440\u0430\u0432\u043d\u0430 24 \u043a\u0413\u0446. \u042d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430\u043c \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c.<\/p>\n<p>  \u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u0432\u043a\u043b\u044e\u0447\u0438\u043b \u043e\u043f\u0446\u0438\u044e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f MPS (Metal Performance Shaders), \u0447\u0442\u043e\u0431\u044b \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438. \u041e\u043f\u0446\u0438\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f MacBook \u0441 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430\u043c\u0438 Apple Silicon.<\/p>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0443 \u0430\u0443\u0434\u0438\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0438\u0441\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u0435 \u043f\u0430\u0443\u0437\u044b \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438. \u0412\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u0438\u0445 \u044f \u0440\u0435\u0448\u0438\u043b \u0437\u0434\u0435\u0441\u044c \u0436\u0435 \u2014 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0443\u0441\u043b\u043e\u0436\u043d\u044f\u0442\u044c \u0438 \u0431\u0435\u0437 \u0442\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0423\u0447\u0438\u0442\u044b\u0432\u0430\u044f, \u0447\u0442\u043e \u0443 \u043c\u0435\u043d\u044f \u0435\u0449\u0435 \u0441\u044b\u0440\u043e\u0439 \u043f\u043e\u0442\u043e\u043a \u043d\u0435 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0445 \u0432 WAV \u0431\u0430\u0439\u0442\u043e\u0432, \u0432\u044b\u0440\u0435\u0437\u0430\u0442\u044c \u043f\u0430\u0443\u0437\u044b \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0435 \u0431\u044b\u0441\u0442\u0440\u0435\u0435.<\/p>\n<pre><code class=\"python\">\/\/ \u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u0433\u043e\u043b\u043e\u0441\u0430  ZEROS_TO_REMOVE=10000 index_of_first_zero=-1 zero_counter=0  for i in range(len(result)):     if abs(result[i]) &lt; 0.005:         if index_of_first_zero == -1:             index_of_first_zero = i;         zero_counter= zero_counter+1;           if zero_counter > ZEROS_TO_REMOVE:             result[index_of_first_zero:i] = 0.;             index_of_first_zero=i;     else:         zero_counter=0;         index_of_first_zero=-1;  result=result[result!=0]  import scipy  scipy.io.wavfile.write(\"temp\/voice.wav\", rate=int(SAMPLE_RATE), data=result) <\/code><\/pre>\n<p>  \u0410\u0443\u0434\u0438\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0447\u0438\u0441\u0435\u043b \u043e\u0442 -1 \u0434\u043e 1. \u0412\u0441\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u043d\u044c\u0448\u0435 0.005 \u043f\u043e \u043c\u043e\u0434\u0443\u043b\u044e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0442\u0438\u0445\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0438\u0445 \u0442\u0438\u0448\u0438\u043d\u043e\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e \u0438\u0445 \u0432 0, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u044b\u0432\u0430\u044e.<\/p>\n<p>  \u0421\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 10 \u0442\u044b\u0441\u044f\u0447 \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435. \u042d\u0442\u043e \u0440\u0430\u0432\u043d\u043e\u0441\u0438\u043b\u044c\u043d\u043e \u0442\u0438\u0448\u0438\u043d\u0435 \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 0,5 \u0441\u0435\u043a\u0443\u043d\u0434\u044b (24 \u043a\u0413\u0446 \u0440\u0430\u0432\u043d\u044f\u0435\u0442\u0441\u044f 24 000 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443). \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u043d\u043e \u0440\u0430\u0437 \u043e\u043d \u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e \u0441\u0432\u043e\u0435\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439, \u0442\u043e:<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/rg\/tb\/jp\/rgtbjp_pidmjbcdt5-3fkjtwsl4.png\" data-src=\"https:\/\/habrastorage.org\/webt\/rg\/tb\/jp\/rgtbjp_pidmjbcdt5-3fkjtwsl4.png\"\/><\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u2014 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 Shell-\u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u0448\u0435 \u0430\u0443\u0434\u0438\u043e. \u041d\u043e \u0434\u0430\u0436\u0435 \u0437\u0434\u0435\u0441\u044c \u0432\u0441\u0435 \u043e\u0431\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0435 \u0431\u0435\u0437 \u043d\u044e\u0430\u043d\u0441\u043e\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u043d\u0438\u0445 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u043d\u0438\u0436\u0435.<\/p>\n<pre><code class=\"python\">vid_len=$(ffprobe -v error -select_streams v:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 $video) sound_len=$(ffprobe -v error -select_streams a:0 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 $audio) vid_len=$(echo $vid_len $start_time | awk '{print $1 - $2}')  duration=$(python -c \"print(min($vid_len,$sound_len))\")  if [[ $mute_video -ne 1 ]]; then   vid_audio=\"[1:a]volume=0.1,atrim=start=$start_time[avid];\\   [avid]amix=2;\" else   vid_audio=\"\" fi  ffmpeg -i $background -i $video -i $audio -filter_complex \\   \"[0:v]scale=1080:1920[bg]; \\   [1:v]scale=1080*2:-1, trim=start=$start_time, crop=in_w:in_h-300, setpts=PTS-STARTPTS[vid]; \\   [2:a]volume=1.0,\\   tremolo=f=500:d=0.1,\\   chorus=0.5:0.9:50|60|40:0.4|0.32|0.3:0.25|0.4|0.3:2|2.3|1.3,\\   rubberband=pitch=1.1\\   ;$vid_audio\\   [bg][vid]overlay=(W-w)\/2:0[mix];$console\" \\   -map [mix] -map  -t $duration -r 60 output.mp4  -y <\/code><\/pre>\n<p>  \u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u043b\u0438\u0448\u043d\u0435\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0432\u0438\u0434\u0435\u043e, \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e \u0441\u043a\u0440\u0438\u043f\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0438\u0434\u0435\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u043b\u043e\u0441\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u2014 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0434\u043b\u0438\u043d\u044b \u0430\u0443\u0434\u0438\u043e \u0438 \u0432\u0438\u0434\u0435\u043e, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e \u043a\u0440\u0430\u0442\u0447\u0430\u0439\u0448\u0435\u0435 \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<p>  \u0414\u0430\u043b\u0435\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u0431\u0438\u0440\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e \u0432 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u043c \u0432\u0438\u0434\u0435\u043e \u2014 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0435\u0432. \u0422\u0430\u043a\u0436\u0435 \u043d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e \u043d\u0430 \u0430\u0443\u0434\u0438\u043e \u044d\u0444\u0444\u0435\u043a\u0442\u044b \u0442\u0440\u0435\u043c\u043e\u043b\u043e, \u0445\u043e\u0440\u0443\u0441\u0430 \u0438 \u043f\u0438\u0442\u0447-\u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0437\u0432\u0443\u043a \u0431\u043e\u043b\u0435\u0435 \u0440\u043e\u0431\u043e\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c.<\/p>\n<p>  \u0414\u0430, \u044f \u0438\u0441\u043a\u0430\u043b \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 \u0441 \u0440\u0435\u0430\u043b\u0438\u0441\u0442\u0438\u0447\u043d\u044b\u043c \u0433\u043e\u043b\u043e\u0441\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0442\u043e\u043c \u0435\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/f03\/524\/c8c\/f03524c8c338a4d1cb03a144464272db.png\" width=\"400\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/f03\/524\/c8c\/f03524c8c338a4d1cb03a144464272db.png\"\/><\/div>\n<p>  \u041f\u043e \u0441\u0443\u0442\u0438 \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0433\u043b\u043e \u0431\u044b\u0442\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e, \u043d\u043e \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0447\u0435\u0433\u043e-\u0442\u043e \u044d\u0434\u0430\u043a\u043e\u0433\u043e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044e \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u043c\u0430\u0441\u043a\u043e\u0442\u0430.<\/p>\n<p>  <a name=\"4\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044f \u043c\u0430\u0441\u043a\u043e\u0442\u0430<\/h2>\n<p><\/font><br \/>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0443\u0442\u043e\u0447\u043d\u044e, \u0438\u0437 \u0447\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f. \u041f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u044f \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u043b \u0432 \u0438\u0433\u0440\u0435, \u043d\u043e \u0431\u0435\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u0430\u0443\u0434\u0438\u043e\u0444\u0430\u0439\u043b\u0430.<\/p>\n<ul>\n<li>IDLE-\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f. \u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f \u0434\u043b\u044f \u0432\u0438\u0434\u0435\u043e\u0438\u0433\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u0436 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0432\u043d\u0438\u0437-\u0432\u0432\u0435\u0440\u0445.<\/li>\n<li>\u041c\u043e\u0440\u0433\u0430\u043d\u0438\u0435 ASCII-\u043c\u0430\u0441\u043a\u043e\u0442\u0430. <\/li>\n<li>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u0440\u0442\u0430 \u0432 \u0442\u0430\u043a\u0442 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u043c\u0443 \u0433\u043e\u043b\u043e\u0441\u0443.<\/li>\n<\/ul>\n<p>  \u0421 \u043f\u0435\u0440\u0432\u044b\u043c\u0438 \u0434\u0432\u0443\u043c\u044f \u043f\u0443\u043d\u043a\u0442\u0430\u043c\u0438 \u0432 \u0446\u0435\u043b\u043e\u043c \u043f\u043e\u043d\u044f\u0442\u043d\u043e: \u0438\u0445 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0432\u044b\u0448\u0435\u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u0410 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u043d\u043e\u0432\u044b\u0439 Python-\u0441\u043a\u0440\u0438\u043f\u0442 \u0444\u0430\u0439\u043b gensylltim.py \u0434\u043b\u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0442\u0430\u0439\u043c\u0438\u043d\u0433\u0430 \u0441\u043b\u043e\u0433\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u043a\u043e\u0433\u0434\u0430 \u043c\u0430\u0441\u043a\u043e\u0442\u0443 \u043d\u0443\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0440\u043e\u0442.<\/p>\n<pre><code class=\"python\">import sys audio = sys.argv[1]   import numpy as np from scipy.io.wavfile import read import wave  frame_rate = 24000  a = read(audio) arr = np.array(a[1],dtype=float)  import scipy.signal indexes, _ = scipy.signal.find_peaks(arr, height=0.05, distance=frame_rate\/4)  result=map(lambda it: it\/frame_rate, indexes)  print(list(result)) <\/code><\/pre>\n<p>  \u0421\u043a\u0440\u0438\u043f\u0442 \u0438\u0449\u0435\u0442 \u043f\u0438\u043a\u043e\u0432\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0431\u0430\u0439\u0442\u043e\u0432 WAV-\u0444\u0430\u0439\u043b\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443 SciPy. \u041f\u043e\u0441\u043b\u0435 \u2014 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043f\u043e\u0442\u043e\u043a\u0435 stdout. \u0414\u0430\u043b\u0435\u0435 \u0431\u0443\u0434\u0443 \u00ab\u043b\u043e\u0432\u0438\u0442\u044c\u00bb \u0435\u0433\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u0442\u0438\u043b\u0438\u0442\u044b grep \u0432 Shell-\u0441\u043a\u0440\u0438\u043f\u0442\u0435.<\/p>\n<p>  \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0447\u0430\u0441\u0442\u043e\u0442\u044b \u0434\u0438\u0441\u043a\u0440\u0435\u0442\u0438\u0437\u0430\u0446\u0438\u0438 \u2014 \u043f\u0440\u0438 \u043f\u043e\u0438\u0441\u043a\u0435 \u043f\u0438\u043a\u043e\u0432\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u043d\u0430\u0448\u0435\u043c \u043c\u0430\u0441\u0441\u0438\u0432\u0435 \u0433\u0440\u043e\u043c\u043a\u043e\u0441\u0442\u0435\u0439, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0432 \u0442\u0430\u0439\u043c\u0438\u043d\u0433\u0438.<\/p>\n<p>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f height=0.05 \u0438 distance=frame_rate\/4 \u0431\u044b\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u043d\u044b \u043f\u0443\u0442\u0435\u043c \u043d\u0430\u0443\u0447\u043d\u043e\u0433\u043e \u0442\u044b\u043a\u0430. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0434\u0435\u043b\u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0439 \u043e\u0442 \u043c\u043e\u0435\u0439, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043e\u0442\u043b\u0438\u0447\u0430\u0442\u044c\u0441\u044f.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0430\u0441\u043a\u043e\u0442\u0430. \u0410\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 10 FPS, IDLE-\u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u2014 \u0438\u0437 6 FPS \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 (12 \u043a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0438\u0442\u043e\u0433\u0435), \u043c\u043e\u0440\u0433\u0430\u043d\u0438\u0435 \u2014 33 FPS (\u0442\u0440\u0438 \u043a\u0430\u0434\u0440\u0430 \u043d\u0430 \u0437\u0430\u043a\u0440\u044b\u0442\u044b\u0435 \u0433\u043b\u0430\u0437\u0430 \u0438 30 \u043d\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0435). \u0417\u0430 \u0441\u0447\u0435\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u0430 \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044f \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0436\u0438\u0432\u0435\u0435, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"python\">loop_time=$(echo \"$vid_len * 10\" | bc -l) loop_time=${loop_time%.*}  function get_states() {   local i=0   states=()   local timer=0   local current_state=0   while [[ $i -le $loop_time ]]; do     states+=(\"$current_state\")     ((timer = timer + 1))     if [[ -z $2 ]]; then       if [[ $timer -ge $1 ]]; then         timer=0         current_state=$((current_state ^= 1));       fi     else       if ([ $current_state == 0 ] &amp;&amp; [ $timer -ge $1 ]) || ([ $current_state == 1 ] &amp;&amp; [ $timer -ge $2 ]); then         timer=0         current_state=$((current_state ^= 1));       fi     fi     ((i = i + 1))   done }  readonly TOP_TIME=6 get_states $TOP_TIME  top_states=(\"${states[@]}\")  readonly CE_TIME=3 readonly OE_TIME=30 get_states $OE_TIME $CE_TIME  eyes_states=(\"${states[@]}\")  syll_timings=($(python gensylltim.py $2 | tr -d '[],')) <\/code><\/pre>\n<p>  \u0417\u0434\u0435\u0441\u044c \u044f \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e \u043c\u0430\u0441\u0441\u0438\u0432\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u0438 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u044e \u0442\u0430\u0439\u043c\u0438\u043d\u0433\u0438 \u0441\u043b\u043e\u0433\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0440\u0430\u043d\u0435\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442. \u041a\u043e\u0434 \u0432\u044b\u0445\u043e\u0434\u0438\u0442 \u0443\u0436\u0435 \u043d\u0435 \u0441\u0430\u043c\u044b\u0439 \u043a\u0440\u0430\u0441\u0438\u0432\u044b\u0439 \u0438 \u043b\u0430\u043a\u043e\u043d\u0438\u0447\u043d\u044b\u0439, \u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0439\u0442\u0435 \u2014 \u0441\u0430\u043c\u043e\u0435 \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043b\u044c\u0448\u0435:<\/p>\n<pre><code class=\"python\">toc_states=\"between(t,-1,-1)\" boc_states=\"between(t,-1,-1)\" tcc_states=\"between(t,-1,-1)\" bcc_states=\"between(t,-1,-1)\" tco_states=\"between(t,-1,-1)\" bco_states=\"between(t,-1,-1)\" too_states=\"between(t,-1,-1)\" boo_states=\"between(t,-1,-1)\"  current_time=0  for i in ${!top_states[@]}; do   prev_time_sec=$(echo $current_time | awk '{printf \"%.2f\", $1 \/ 10}')   ((current_time = current_time + 1))   current_time_sec=$(echo $current_time | awk '{printf \"%.2f\", $1 \/ 10}')   between=\"+between(t,$prev_time_sec,$current_time_sec)\"    syll_condition=0     if [[ ${#syll_timings} -ne 0 ]]; then       syll_condition=$(echo \"scale=2; ${syll_timings[0]} &lt;= ($current_time_sec + 0.1)\" | bc)       if [[ $syll_condition -eq 1 ]]; then         syll_timings=(\"${syll_timings[@]:1}\")       fi fi    if [[ ${top_states[$i]} -eq 0 ]]; then     if [[ ${eyes_states[$i]} -eq 0 ]]; then       if [[ $syll_condition -eq 1 ]]; then         too_states+=$between         else         toc_states+=$between       fi     else       if [[ $syll_condition -eq 1 ]]; then         tco_states+=$between       else         tcc_states+=$between       fi     fi   else     if [[ ${eyes_states[$i]} -eq 0 ]]; then       if [[ $syll_condition -eq 1 ]]; then         boo_states+=$between       else         boc_states+=$between       fi     else        if [[ $syll_condition -eq 1 ]]; then         bco_states+=$between       else         bcc_states+=$between       fi     fi   fi done <\/code><\/pre>\n<p>  \u0421\u043d\u0438\u043f\u043f\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0438 between, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c FFMPEG, \u043a\u043e\u0433\u0434\u0430 \u0438 \u043a\u0430\u043a\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0443 \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c. \u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u043d \u043d\u0435 \u0441\u0430\u043c\u044b\u043c \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043f\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 0,1 \u0441\u0435\u043a\u0443\u043d\u0434\u044b, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435. \u041d\u043e \u043d\u0430 \u043f\u0435\u0440\u0444\u043e\u0440\u043c\u0430\u043d\u0441\u0435 \u044d\u0442\u043e \u043d\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441\u043c\u044b\u0441\u043b\u0430 \u043d\u0435 \u0432\u0438\u0436\u0443.<\/p>\n<p>  \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u0432\u043d\u0435\u0434\u0440\u044f\u0435\u043c \u044d\u0442\u043e \u0432 FFMPEG.<\/p>\n<pre><code class=\"python\">tcc=\"loda\/Loda,Default,Top,Eclose,MClose.png\" tco=\"loda\/Loda,Default,Top,Eclose,MOpen.png\" toc=\"loda\/Loda,Default,Top,Eopen,MClose.png\" too=\"loda\/Loda,Default,Top,Eopen,MOpen.png\" bcc=\"loda\/Loda,Default,Bottom,Eclose,MClose.png\" bco=\"loda\/Loda,Default,Bottom,Eclose,MOpen.png\" boc=\"loda\/Loda,Default,Bottom,Eopen,MClose.png\" boo=\"loda\/Loda,Default,Bottom,Eopen,MOpen.png\"  ffmpeg $quiet -i \"temp\/output.mp4\" \\   -i $tcc -i $tco -i $toc -i $too \\   -i $bcc -i $bco -i $boc -i $boo \\   -filter_complex \\   \"[1:v]scale=-1:800[tcc];\\   [2:v]scale=-1:800[tco];\\   [3:v]scale=-1:800[toc];\\   [4:v]scale=-1:800[too];\\   [5:v]scale=-1:800[bcc];\\   [6:v]scale=-1:800[bco];\\   [7:v]scale=-1:800[boc];\\   [8:v]scale=-1:800[boo];\\   [0:v][tcc]overlay=(W-w)\/2:(H-h):enable='$tcc_states'[temp];\\   [temp][tco]overlay=(W-w)\/2:(H-h):enable='$tco_states'[temp];\\   [temp][toc]overlay=(W-w)\/2:(H-h):enable='$toc_states'[temp];\\   [temp][too]overlay=(W-w)\/2:(H-h):enable='$too_states'[temp];\\   [temp][bcc]overlay=(W-w)\/2:(H-h):enable='$bcc_states'[temp];\\   [temp][bco]overlay=(W-w)\/2:(H-h):enable='$bco_states'[temp];\\   [temp][boc]overlay=(W-w)\/2:(H-h):enable='$boc_states'[temp];\\   [temp][boo]overlay=(W-w)\/2:(H-h):enable='$boo_states'[res];\\   [0:a]volume=1.0;\"\\   -map [res] -map  -r 60 \"fin.mp4\" <\/code><\/pre>\n<p>  \u0417\u0430\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043d\u0430 \u0432\u0445\u043e\u0434 \u0440\u0430\u043d\u0435\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0432\u0438\u0434\u0435\u043e, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u041d\u0430\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0438\u0445 \u0432 \u043d\u0438\u0436\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0430 \u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 enable \u043f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0431\u0443\u0434\u0435\u043c \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435. \u0413\u043e\u0442\u043e\u0432\u043e!<\/p>\n<div class=\"oembed\">\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/664324b187bb36d4b3919a33\" data-style=\"\" id=\"664324b187bb36d4b3919a33\" width=\"\"><\/div>\n<\/div>\n<p><i>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442.<\/i><\/p>\n<p>  <a name=\"5\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0433\u043e UI<\/h2>\n<p><\/font><br \/>  \u0421\u0435\u0439\u0447\u0430\u0441 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0442\u044c \u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435, \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0435\u0449\u0435 \u043e\u0434\u0438\u043d:<\/p>\n<pre><code class=\"python\">while getopts ':v:s:t:mc' flag; do  case $flag in    v)      vid=$OPTARG    ;;    s)         st=$OPTARG    ;;    t)      text=$OPTARG    ;;    m)      mute=1    ;;    c)      console=1    ;;    \\?)      continue    ;;  esac done  if [[ -z $vid ]]; then   echo \"You need to pass video using -v flag, you can also set text using -t and start time using -s\"   exit fi  set -e  dir=\"$HOME\/tools\/TikTok\" source $dir\/.env\/bin\/activate mkdir -p $dir\/temp  if [[ \"$text\" != \"\" ]]; then   python $dir\/genwav.py $text    open $dir\/temp\/voice.wav   read -r -p \"Do you like the result? [y\/N] \" response   if ! [[ \"$response\" =~ ^([yY])$ ]]; then     exit   fi fi  sh $dir\/genvid.sh $vid $dir\/temp\/voice.wav $st $console $mute  deactivate  open . <\/code><\/pre>\n<p>  \u0412 \u043d\u0435\u043c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u043b\u0430\u0433\u043e\u0432:<\/p>\n<ul>\n<li><b>v<\/b> \u2014 \u0432\u0438\u0434\u0435\u043e,<\/li>\n<li><b>t<\/b> \u2014 \u0444\u0430\u0439\u043b \u0441 \u0442\u0435\u043a\u0441\u0442\u043e\u043c (\u0435\u0441\u043b\u0438 \u0435\u0433\u043e \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c, \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430\u0447\u043d\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u043d\u0435\u0435 \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0432\u0443\u043a), <\/li>\n<li><b>s<\/b> \u2014 \u043d\u0430\u0447\u0430\u043b\u043e \u0432\u0438\u0434\u0435\u043e (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e), <\/li>\n<li><b>m<\/b> \u2014 \u0437\u0430\u0433\u043b\u0443\u0448\u0438\u0442\u044c \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u0438\u0434\u0435\u043e (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e), <\/li>\n<li><b>\u0441<\/b> \u2014 \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e).<\/li>\n<\/ul>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0438\u0433\u0440\u044b\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e \u0438, \u0435\u0441\u043b\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442, \u0442\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0435\u0442 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443. \u0412 \u043a\u043e\u043d\u0446\u0435 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0430\u043f\u043a\u0430 \u0441\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0432\u0438\u0434\u0435\u043e, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0435\u0433\u043e \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0432 \u0441\u043e\u0446. \u0441\u0435\u0442\u0438.<\/p>\n<p>  <a name=\"6\"><\/a><font color=\"#EB4247\"><\/p>\n<h2>\u0418\u0442\u043e\u0433\u0438<\/h2>\n<p><\/font><br \/>  \u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e, \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0430\u0443\u0434\u0438\u043e. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u043e \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c, \u043e\u0431\u0440\u0435\u0437\u0430\u0442\u044c \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c \u0432\u0438\u0434\u0435\u043e \u0440\u0443\u043a\u0430\u043c\u0438. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0448\u044c \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u044e \u0438 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0448\u044c\u0441\u044f \u0441\u0432\u043e\u0438\u043c\u0438 \u0434\u0435\u043b\u0430\u043c\u0438 \u2014 \u043c\u0435\u0447\u0442\u0430 \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u0430!<\/p>\n<p>  \u0422\u0430\u043a\u0436\u0435 \u0445\u043e\u0447\u0443 \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u043e\u043b\u044c\u0437\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u043b\u0438\u0447\u043d\u043e \u0434\u043b\u044f \u043c\u0435\u043d\u044f. \u041d\u0430\u043a\u043e\u043d\u0435\u0446, \u044f \u0431\u043e\u043b\u0435\u0435 \u0438\u043b\u0438 \u043c\u0435\u043d\u0435\u0435 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043b\u0441\u044f \u0441 Bash, \u043f\u0440\u043e\u0434\u0432\u0438\u043d\u0443\u043b\u0441\u044f \u0432 \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u0438 \u0440\u0430\u0431\u043e\u0442\u044b FFMPEG, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u043b\u0441\u044f \u0441 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 Bark, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432 \u0431\u0443\u0434\u0443\u0449\u0435\u043c \u043c\u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f.<\/p>\n<p>  <b>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0432\u0430\u043c \u0442\u043e\u0436\u0435 \u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u043c\u043e\u0439 \u043e\u043f\u044b\u0442. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u0432\u0430\u0448\u0435\u043c\u0443 \u043c\u043d\u0435\u043d\u0438\u044e \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445. <\/b><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/813767\/\"> https:\/\/habr.com\/ru\/articles\/813767\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<div style=\"text-align:center;\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/kx\/2f\/nj\/kx2fnjvfjhgcvkv5kqyaf3cm52y.png\" data-src=\"https:\/\/habrastorage.org\/webt\/kx\/2f\/nj\/kx2fnjvfjhgcvkv5kqyaf3cm52y.png\"\/><\/div>\n<p>  \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440! <a href=\"https:\/\/habr.com\/ru\/companies\/selectel\/articles\/802809\/\">\u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/a> \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u043b, \u043a\u0430\u043a \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u043d\u0430\u0440\u0435\u0437\u043a\u0443 YouTube-\u0432\u0438\u0434\u0435\u043e \u043d\u0430 Shorts, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0443\u0434\u0430 \u0442\u0435\u043a\u0441\u0442 \u0438 \u0440\u0430\u0437\u043c\u044b\u0442\u044b\u0439 \u0444\u043e\u043d. \u0421\u0435\u0433\u043e\u0434\u043d\u044f \u0437\u0430\u0439\u043c\u0435\u043c\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0441\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u2014 \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0435\u0439 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u0432\u0438\u0434\u0435\u043e \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0437\u0430\u043f\u0438\u0441\u0438 \u0441 \u0433\u0435\u0439\u043c\u043f\u043b\u0435\u0435\u043c \u0438 \u0442\u0435\u043a\u0441\u0442\u043e\u043c. \u0412 \u0442\u0435\u043a\u0441\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u0442\u0435, \u043a\u0430\u043a \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u0443\u0434\u0438\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 Bark \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u044e ASCII-\u043c\u0430\u0441\u043a\u043e\u0442\u0430. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u2014 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.   <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-375934","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/375934","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=375934"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/375934\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=375934"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=375934"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=375934"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}