{"id":297929,"date":"2020-01-30T09:00:16","date_gmt":"2020-01-30T09:00:16","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=297929"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=297929","title":{"rendered":"\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432\u0438\u0434\u0435\u043e. \u0421\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043d\u0430 Python \u0438 Rust"},"content":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/467537\/\">\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u2014 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 Python \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f? \u041f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u0434\u0430\u044e\u0442 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u043e \u0432\u0441\u0435\u043c, \u0447\u0435\u0433\u043e \u043a\u0430\u0441\u0430\u044e\u0442\u0441\u044f? \u0427\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435: OpenCV \u0438\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e? \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u044d\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u0432\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435. \u0422\u0430\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043a\u0443\u0447\u043d\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435.<br \/>  \u0412\u0441\u0435 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u0435\u0441\u044f, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c!<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u043d\u0430\u0434 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u044f \u0440\u0430\u0431\u043e\u0442\u0430\u044e, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0438 \u043b\u044e\u0434\u0435\u0439 \u0438 \u0438\u0445 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0439 \u043d\u0430 \u0432\u0438\u0434\u0435\u043e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0418\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e \u043e\u043d \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0430 Python+OpenCV. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u043d\u0435\u0437\u0430\u043f\u043d\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0440\u0430\u0449\u0438\u0432\u0430\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431, \u043f\u043e\u0432\u044b\u0448\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0438 \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0418 \u043f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u0441\u044f \u0441\u0440\u0435\u0434\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a\u043e\u043c. \u0410 \u0437\u0430\u043e\u0434\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043a\u0430\u043a \u0441\u0438\u043b\u044c\u043d\u043e \u044f\u0437\u044b\u043a \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p>  <\/p>\n<p>\u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u043b \u0441\u0430\u043c\u044b\u0435 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b\u0435 (\u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0432\u044b\u0431\u043e\u0440 \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0432\u0435\u043b\u0438\u043a):<\/p>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/opencv.org\/\" rel=\"nofollow\">OpenCV<\/a><\/li>\n<li><a href=\"https:\/\/ffmpeg.org\/\" rel=\"nofollow\">FFmpeg<\/a><\/li>\n<li><a href=\"https:\/\/gstreamer.freedesktop.org\/\" rel=\"nofollow\">GStreamer<\/a><\/li>\n<li><a href=\"https:\/\/www.videolan.org\/vlc\/index.ru.html\" rel=\"nofollow\">VLC<\/a><\/li>\n<li><a href=\"https:\/\/valkka.readthedocs.io\/en\/latest\/\" rel=\"nofollow\">Valkka<\/a><\/li>\n<\/ol>\n<p>  <\/p>\n<p>VLC \u0438 Valkka \u043e\u0442\u043f\u0430\u043b\u0438 \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0441\u0440\u0430\u0437\u0443. \u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u0435\u0437 \u0432\u044b\u0437\u043e\u0432\u0430 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0442\u0430\u043a \u0438 \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u043b. \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u043a\u0440\u0430\u0439\u043d\u0435 \u043c\u0430\u043b\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0438 \u0435\u0449\u0435 \u043c\u0435\u043d\u044c\u0448\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u044f\u0437\u044b\u043a\u043e\u0432.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u043e \u043f\u0435\u0440\u0432\u044b\u0445 \u0442\u0440\u0435\u0445 \u044f \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0438 \u0441\u0440\u0430\u0432\u043d\u044e \u0438\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430 Python.<\/p>\n<p>  <\/p>\n<h3 id=\"opencv\">OpenCV<\/h3>\n<p>  <\/p>\n<h4 id=\"plyusy\">\u041f\u043b\u044e\u0441\u044b<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u041a\u0440\u0430\u0439\u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f<\/li>\n<li>\u041d\u0430\u043b\u0438\u0447\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f Python \u0441 \u043a\u0443\u0447\u0435\u0439 \u0421V \u0444\u0443\u043d\u043a\u0446\u0438\u0439<\/li>\n<li>\u041e\u0442\u043b\u0438\u0447\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"minusy\">\u041c\u0438\u043d\u0443\u0441\u044b<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u0434\u0440\u043e\u0432 \u0441 rtsp-\u043f\u043e\u0442\u043e\u043a\u0430. \u0418 \u0435\u0441\u043b\u0438 \u0434\u043b\u044f FFmpeg \u0447\u0435\u0440\u0435\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0435\u0449\u0435 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0442\u043e \u0434\u043b\u044f GStreamer \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u043b\u044c\u0437\u044f. \u0425\u043e\u0442\u044f \u0438 \u044d\u0442\u043e\u0442 \u043c\u0430\u043b\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043d\u0435 \u0441\u043f\u0430\u0441\u0430\u0435\u0442 \u043d\u0438\u043a\u0430\u043a<\/li>\n<li>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 FFmpeg \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0431\u044d\u043a\u0435\u043d\u0434\u0430 \u043f\u043e-\u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 \u043f\u0440\u043e FFmpeg)<\/li>\n<li>\u0418\u0437-\u0437\u0430 \u0443\u043f\u0440\u043e\u0449\u0451\u043d\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u043d\u0435\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043a\u0430\u0434\u0440 \u043d\u0430 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u043c \u044d\u0442\u0430\u043f\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u043a\u0430\u0434\u0440\u0430 \u043c\u044b \u0441\u0440\u0430\u0437\u0443 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0433\u043e\u0442\u043e\u0432\u044b\u0439 numpy.ndarray, \u0434\u0430 \u0435\u0449\u0435 \u0438 \u0432 BGR (\u043a \u0441\u043b\u043e\u0432\u0443 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0432 RGB \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u044b\u0441\u0442\u0440\u0430\u044f). \u0418 \u0435\u0441\u043b\u0438 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u0440\u043e\u0431\u043b\u0435\u043c \u043d\u0435\u0442, \u0442\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0439, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u044f\u0434\u0440\u0430 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0410 \u043b\u044e\u0431\u0430\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0441\u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0440\u0435\u0441\u0443\u0440\u0441\u044b, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435 \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 python \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c pickable.<br \/>  \u042d\u0442\u043e \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0440\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0438 \u0432 Queue, \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 pickle.dumps() \u0438 pickle.loads() (\u043a \u0441\u043b\u043e\u0432\u0443 \u0432 \u0432\u0435\u0440\u0441\u0438\u0438 Python 3.8 \u043f\u043e\u043e\u0431\u0435\u0449\u0430\u043b\u0438 \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 shared memory). \u042d\u0442\u043e \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0430\u043a\u043b\u0430\u0434\u043d\u043e \u0434\u043b\u044f FullHD \u043a\u0430\u0434\u0440\u043e\u0432. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 ndarray \u043a\u0430\u0434\u0440 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 ~6\u043c\u0431 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438.<br \/>  \u0422\u043e \u0436\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0438 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e \u0441\u0435\u0442\u0438. \u041f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 numpy.ndarray \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0432 bytes \u043f\u0435\u0440\u0435\u0434 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u043e\u0439, \u043d\u0430 \u0447\u0442\u043e \u0442\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438.<\/p>\n<p>  <\/p>\n<h3 id=\"ffmpeg\">FFmpeg<\/h3>\n<p>  <\/p>\n<h4 id=\"plyusy-1\">\u041f\u043b\u044e\u0441\u044b<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0421\u0430\u043c\u043e\u0435 \u0431\u044b\u0441\u0442\u0440\u043e\u0435 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0438\u0437 \u0442\u0440\u043e\u0439\u043a\u0438<\/li>\n<li>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f<\/li>\n<li>\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"minusy-1\">\u041c\u0438\u043d\u0443\u0441\u044b<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u0430\u044f \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 OpenCV \u2014 \u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043d\u0435\u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b\u043c rtsp-\u043f\u043e\u0442\u043e\u043a\u043e\u043c: \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0431\u0438\u0442\u044b\u0445 \u043a\u0430\u0434\u0440\u043e\u0432 \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0437\u043a\u0435 \u043a\u0430\u043a \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430, \u0442\u0430\u043a \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u0435\u043b\u044f. \u0414\u043b\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u044d\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043a\u0430\u0434\u0440 \u0431\u0438\u0442\u044b\u0439 \u043d\u0435 \u0442\u0430\u043a-\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u0430 \u043e\u0431\u0443\u0447\u0435\u043d\u043d\u0430\u044f \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0448\u0443\u043c\u0435 \u043c\u043e\u0436\u0435\u0442 \u0443\u0432\u0438\u0434\u0435\u0442\u044c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e\u0439 \u043e\u0442 \u043d\u0443\u043b\u044f<\/li>\n<li>\u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u043d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u044b\u0439 \u0444\u0430\u043a\u0442\u043e\u0440 \u2014 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Python. \u041d\u0430 \u0432\u044b\u0431\u043e\u0440 \u0432\u0441\u0435\u0433\u043e \u0434\u0432\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430: \u043b\u0438\u0431\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0431\u0430\u0439\u0442\u044b \u0447\u0435\u0440\u0435\u0437 linux pipe, \u043b\u0438\u0431\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0438\u0445 \u0432 zram \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u0438 \u0447\u0438\u0442\u0430\u0442\u044c. \u0412 \u043e\u0431\u0449\u0435\u043c, \u043e\u0431\u0430 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430 \u0442\u0430\u043a \u0441\u0435\u0431\u0435<\/li>\n<\/ul>\n<p>  <\/p>\n<h3 id=\"gstreamer\">GStreamer<\/h3>\n<p>  <\/p>\n<h4 id=\"plyusy-2\">\u041f\u043b\u044e\u0441\u044b<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u0425\u043e\u0440\u043e\u0448\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f <a href=\"https:\/\/gitlab.freedesktop.org\/gstreamer\/gst-python\" rel=\"nofollow\">Python<\/a> \u0438 <a href=\"https:\/\/gitlab.freedesktop.org\/gstreamer\/gstreamer-rs\" rel=\"nofollow\">Rust<\/a><\/li>\n<li>\u0411\u043e\u0433\u0430\u0442\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041c\u043e\u0436\u043d\u043e \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0434\u0440 \u0440\u0430\u0437\u0432\u0435\u0442\u0432\u043b\u044f\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u043e\u0432 \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u043e-\u0440\u0430\u0437\u043d\u043e\u043c\u0443<\/li>\n<li>\u041e\u0442\u043b\u0438\u0447\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 rtsp, \u0443\u043c\u0435\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u0432\u0445\u043e\u0434\u043d\u0443\u044e \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 (\u0447\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0432\u0430\u0436\u043d\u043e \u0434\u043b\u044f \u0441\u0438\u0441\u0442\u0435\u043c \u0440\u0435\u0430\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438), \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0442\u044c \u0431\u0438\u0442\u044b\u0435 \u043a\u0430\u0434\u0440\u044b<\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"minusy-2\">\u041c\u0438\u043d\u0443\u0441\u044b<\/h4>\n<p>  <\/p>\n<ul>\n<li>\u041f\u043b\u043e\u0445\u043e\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/li>\n<li>\u041f\u043e \u0440\u0430\u0437\u043d\u044b\u043c \u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u0430\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c FFmpeg \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043d\u0430 5-10%<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"primery-koda-i-proizvoditelnost\">\u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430 \u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c<\/h2>\n<p>  <\/p>\n<p>\u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430. \u0418\u0437-\u0437\u0430 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0445 \u0432\u044b\u0448\u0435, \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0431\u0443\u0434\u0443 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u0442\u044c \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u0445:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0434\u0440\u0430<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0434\u0440\u0430 \u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0435\u0439 \u0432 RGB \u0438 GRAY8 (\u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u0434\u043b\u044f ML \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438 \u0441\u0435\u0440\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430, \u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u043c \u0432 3 \u0440\u0430\u0437\u0430 \u043c\u0435\u043d\u044c\u0448\u0435)<\/li>\n<li>\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0434\u0440\u0430, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438 \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\/\u0434\u0435\u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0435\u0440\u0435\u0437 pickle<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0414\u043b\u044f OpenCV \u043e\u0431\u044a\u044f\u0441\u043d\u0435\u043d\u0438\u044f \u0432\u0440\u044f\u0434 \u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f. \u0421\u0442\u0430\u0442\u0435\u0439 \u043e \u043d\u0430\u0447\u0430\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u044d\u0442\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u043e\u0439 \u2014 \u043f\u043e\u043b\u043d\u044b\u0439 \u0445\u0430\u0431\u0440.<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">import pickle import cv2  source = 'Tractor_500kbps_x264.mp4' cap = cv2.VideoCapture(source) while cap.isOpened():     ret, frame = cap.read()     if not ret:         break     pickle.loads(cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY).dumps()) cap.release()<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f FFmpeg \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0434\u043b\u044f Python (<a href=\"https:\/\/github.com\/kkroening\/ffmpeg-python\" rel=\"nofollow\">ffmpeg-python<\/a>, <a href=\"http:\/\/www.scikit-video.org\/stable\/\" rel=\"nofollow\">scikit-video<\/a>, <a href=\"https:\/\/ffmpy.readthedocs.io\/en\/latest\/\" rel=\"nofollow\">ffmpy<\/a>, <a href=\"https:\/\/github.com\/jiashaokun\/ffmpeg\" rel=\"nofollow\">ffmpeg<\/a>). \u041b\u0443\u0447\u0448\u0430\u044f, \u043d\u0430 \u043c\u043e\u0439 \u0432\u0437\u0433\u043b\u044f\u0434, <a href=\"https:\/\/github.com\/kkroening\/ffmpeg-python\" rel=\"nofollow\">ffmpeg-python<\/a>: \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f, \u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432. \u041d\u043e \u0432\u0441\u0435 \u044d\u0442\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043f\u043e\u0432\u0435\u0440\u0445 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0432\u044b\u0437\u043e\u0432\u0430 \u0447\u0435\u0440\u0435\u0437 subprocess.Popen \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0435\u0439 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 linux pipe \u0432 stdout, \u0430 \u043a\u043e\u0434 \u043d\u0430 Python \u0443\u0436\u0435 \u0441\u043b\u0443\u0448\u0430\u0435\u0442 stdout \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 numpy ndarray.<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u044d\u0442\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"python\">from subprocess import Popen, PIPE, DEVNULL import numpy as np import cv2  source = 'Tractor_500kbps_x264.mp4' width, height = (1920, 1080) stream_url = f'ffmpeg -vcodec h264 -i {source} -f rawvideo -pix_fmt yuv420p pipe:'.split(' ') with Popen(stream_url, stdout=PIPE, stderr=DEVNULL) as p:     while p.stdout.readable():         yuv_height = int(height+height\/\/2)         raw_frame = p.stdout.read(yuv_height * width)         if len(raw_frame) == yuv_height * width:             frame = np.frombuffer(raw_frame, np.uint8).reshape((yuv_height, width))             cv2.cvtColor(frame, cv2.COLOR_YUV2RGB_I420)         else:             break     p.stdout.flush()<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u043a\u043e\u0434\u0435 \u0435\u0441\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c bytearray \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u043a\u0430\u0434\u0440\u0430. \u041c\u043e\u0436\u043d\u043e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f ffprobe \u0438 \u0442\u0430\u043a \u0436\u0435, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0435\u0433\u043e \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c \u0441\u0443\u0431\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435, \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u0447\u0430\u043b\u043e\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u041d\u043e \u044d\u0442\u043e \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e, \u0438 \u0432\u0440\u0435\u043c\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0443\u0434\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0442. \u043a. ffprobe \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c\u0441\u044f \u043a rtsp-\u043f\u043e\u0442\u043e\u043a\u0443 \u0438 \u0432\u0437\u044f\u0442\u044c \u043e\u0434\u0438\u043d \u043a\u0430\u0434\u0440.<br \/>  \u0412\u0442\u043e\u0440\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u2014 \u044d\u0442\u043e \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0432\u0441\u0435 \u0432\u0438\u0434\u0435\u043e \u0444\u0430\u0439\u043b\u044b \u0438 \u0432\u0438\u0434\u0435\u043e\u043f\u043e\u0442\u043e\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e YUV, \u0447\u0430\u0449\u0435 \u044d\u0442\u043e <a href=\"https:\/\/fourcc.org\/pixel-format\/yuv-i420\/\" rel=\"nofollow\">I420<\/a> (YUV420p), \u043a\u0430\u0434\u0440 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u043a\u0430\u0434\u0440\u0430 \u044f\u0440\u043a\u043e\u0441\u0442\u0438 \u0438 \u0434\u0432\u0443\u0445 \u0446\u0432\u0435\u0442\u043e\u0440\u0430\u0437\u043d\u043e\u0441\u0442\u043d\u044b\u0445 \u043f\u043e\u043b\u0443\u043a\u0430\u0434\u0440\u043e\u0432. \u0410 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u0432\u0451\u0440\u0442\u043e\u0447\u043d\u044b\u0445 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u0435\u0439 \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u044b \u043d\u0430 RGB.<br \/>  \u041a\u0441\u0442\u0430\u0442\u0438, \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u0430\u0434\u0440\u0430 \u043d\u0430 GPU (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 <a href=\"https:\/\/developer.nvidia.com\/nvidia-video-codec-sdk\" rel=\"nofollow\">NVDEC<\/a>) \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u043a\u0430\u0434\u0440 \u0432 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u043e NV12 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u043e\u0436\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u0434\u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e\u043c YUV. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 ffmpeg \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 \u043d\u0435\u0433\u043e \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 OpenCV. \u0420\u0430\u0437\u043d\u0438\u0446\u0443 \u0431\u0443\u0434\u0435\u0442 \u0432\u0438\u0434\u043d\u043e \u0432 \u0442\u0435\u0441\u0442\u0430\u0445 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>  <\/p>\n<p>C GStreamer \u0432\u0441\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u043a\u043e\u0434\u0430, \u043d\u043e, \u0432 \u0446\u0435\u043b\u043e\u043c, \u043d\u0435 \u0441\u043b\u043e\u0436\u043d\u0435\u0435.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u0434\u043b\u044f GStreamer<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">import numpy as np import cv2 import gi  gi.require_version('Gst', '1.0') gi.require_version('GLib', '2.0') gi.require_version('GObject', '2.0')  from gi.repository import GLib, Gst  def bus_call(bus, message, loop, pipe):     t = message.type     if t == Gst.MessageType.EOS:         pipe.set_state(Gst.State.NULL)         loop.quit()     elif t == Gst.MessageType.ERROR:         err, debug = message.parse_error()         print(f'{err}: {debug}')         pipe.set_state(Gst.State.NULL)         loop.quit()     return Gst.FlowReturn.OK  def yuv_rgb(appsink):     sample = appsink.emit(&quot;pull-sample&quot;)     buf = sample.get_buffer()     caps = sample.get_caps()     height = caps.get_structure(0).get_value('height')     width = caps.get_structure(0).get_value('width')     stream_format = caps.get_structure(0).get_value('format')     data = buf.extract_dup(0, buf.get_size())     if data:         frame = np.frombuffer(data, np.uint8).reshape((height+height\/\/2, width))         cv2.cvtColor(frame, cv2.COLOR_YUV2RGB_I420)     return Gst.FlowReturn.OK  def pipe_init(source, on_new_sample, pix_format):     Gst.init(None)     pipe = Gst.Pipeline.new('dynamic')      src = Gst.ElementFactory.make('filesrc')     demux = Gst.ElementFactory.make('qtdemux')     parse = Gst.ElementFactory.make('h264parse')     decode = Gst.ElementFactory.make('avdec_h264')     convert = Gst.ElementFactory.make('videoconvert')     sink = Gst.ElementFactory.make('appsink')      for item in (src, demux, parse, decode, convert, sink):         pipe.add(item)      src.link(demux)     demux.connect('pad-added', lambda element, pad: element.link(parse))     parse.link(decode)     decode.link(convert)     convert.link(sink)      src.set_property('location', source)      sink.set_property(&quot;emit-signals&quot;, True)     sink.set_property(&quot;max-buffers&quot;, 1)     caps = Gst.caps_from_string(f&quot;video\/x-raw, format=(string){pix_format}&quot;)     sink.set_property(&quot;caps&quot;, caps)     sink.set_property(&quot;drop&quot;, True)     sink.set_property(&quot;wait-on-eos&quot;, True)     sink.set_property('sync', False)     sink.connect(&quot;new-sample&quot;, on_new_sample)     return pipe  def run(source, sink_callback, pix_format):     loop = GLib.MainLoop()     pipe = pipe_init(source, sink_callback, pix_format)      bus = pipe.get_bus()     bus.add_signal_watch()     bus.enable_sync_message_emission()     bus.connect('message', bus_call, loop, pipe)      pipe.set_state(Gst.State.PLAYING)     loop.run()  run('Tractor_500kbps_x264.mp4', yuv_rgb, 'I420')<\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<p>\u0423 GStreamer \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0432 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0435 appsink, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 callback-\u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0432 \u043d\u0435\u0435 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0439 \u043a\u0430\u0434\u0440.<\/p>\n<p>  <\/p>\n<h3 id=\"chto-zhe-s-proizvoditelnostyu\">\u0427\u0442\u043e \u0436\u0435 \u0441 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c\u044e?<\/h3>\n<p>  <\/p>\n<p>\u0412\u0441\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043b\u0438\u0441\u044c \u043d\u0430 Intel Core i5-6600K, \u043f\u043e 10 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439. \u0414\u043b\u044f Python \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0430\u0441\u044c \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 timeit. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0432\u0438\u0434\u0435\u043e \u0432\u0437\u044f\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0435 <a href=\"https:\/\/s3.amazonaws.com\/x265.org\/video\/Tractor_500kbps_x264.mp4\" rel=\"nofollow\">Tractor_500kbps_x264.mp4<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>pure \u2014 \u044d\u0442\u043e \u043a\u0430\u0434\u0440 \u0431\u0435\u0437 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438<\/li>\n<li>gray8 \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438\u0437 BGR \u0432 GRAY8 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 OpenCV<\/li>\n<li>rgb \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438\u0437 BGR \u0432 RGB \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 OpenCV<\/li>\n<li>yuv_gray \u2014 \u044f\u0440\u043a\u043e\u0441\u0442\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043a\u0430\u0434\u0440\u0430 \u043e\u0442 I420<\/li>\n<li>yuv_gray8 \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438\u0437 YUV420p \u0432 GRAY8 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 OpenCV<\/li>\n<li>yuv_rgb \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438\u0437 YUV420p \u0432 RGB \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 OpenCV<\/li>\n<li>native_gray \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438\u0437 YUV420p \u0432 GRAY8 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/li>\n<li>native_rgb \u2014 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0438\u0437 YUV420p \u0432 RGB \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0430\u043c\u0438 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438<\/li>\n<\/ul>\n<p>  <\/p>\n<h4 id=\"native\">Native<\/h4>\n<p>  <\/p>\n<p>\u0423 FFmpeg \u0438 GStreamer \u0435\u0441\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u0441\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044f \u043a\u0430\u0434\u0440\u044b \u0432 \/dev\/null. \u042d\u0442\u0438 \u0446\u0438\u0444\u0440\u044b \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0437\u0430 \u0431\u0430\u0437\u043e\u0432\u044b\u0435.<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">ffmpeg -vcodec h264 -i Tractor_500kbps_x264.mp4 -f null \/dev\/null  frame=  252 fps=0.0 q=-0.0 Lsize=N\/A time=00:00:10.28 bitrate=N\/A speed=24.6x  gst-launch-1.0 filesrc location=&quot;Tractor_500kbps_x264.mp4&quot; ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! fakesink  Execution ended after 0:00:00.551382068<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"opencv-1\">OpenCV<\/h4>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043e\u043f\u0446\u0438\u0439 \u043c\u0430\u043b\u043e. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043c\u0435\u0440\u0438\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u043a\u0430\u0434\u0440\u0430 \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044e \u0432 \u0434\u0432\u0430 \u0446\u0432\u0435\u0442\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0441 \u044d\u043c\u0443\u043b\u044f\u0446\u0438\u0435\u0439 \u0447\u0435\u0440\u0435\u0437 pickle \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e \u0441\u0435\u0442\u0438 \u0438\u043b\u0438 \u0432 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u044a\u0435\u043c\u0430\u0445 \u0434\u0430\u043d\u043d\u044b\u0445 pickle \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0431\u0438\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c.<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u0424\u043e\u0440\u043c\u0430\u0442<\/th>\n<th>\u0412\u0441\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/th>\n<th>\u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e<\/th>\n<th>\u041a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>pure<\/td>\n<td>8.7099\u0441<\/td>\n<td>0.8710\u0441<\/td>\n<td>289.3268 fps<\/td>\n<\/tr>\n<tr>\n<td>gray8<\/td>\n<td>20.3162\u0441<\/td>\n<td>2.0316\u0441<\/td>\n<td>124.0389 fps<\/td>\n<\/tr>\n<tr>\n<td>rgb<\/td>\n<td>74.3420\u0441<\/td>\n<td>7.4342\u0441<\/td>\n<td>33.8974 fps<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<h4 id=\"ffmpeg-1\">FFmpeg<\/h4>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043e\u043f\u0446\u0438\u0439 \u0443\u0436\u0435 \u0431\u043e\u043b\u044c\u0448\u0435. \u041f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 \u0432 OpenCV. \u0422\u0430\u043a\u0436\u0435 \u043e\u0442\u043f\u0430\u0434\u0430\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c \u0441\u0435\u0440\u0438\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u0434\u0440 \u0447\u0435\u0440\u0435\u0437 pickle \u043f\u0440\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0435 \u043f\u043e \u0441\u0435\u0442\u0438 \u0438\u043b\u0438 \u0432 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0439 \u043f\u0440\u043e\u0446\u0435\u0441\u0441.<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u0424\u043e\u0440\u043c\u0430\u0442<\/th>\n<th>\u0412\u0441\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/th>\n<th>\u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e<\/th>\n<th>\u041a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>pure<\/td>\n<td>8.3283\u0441<\/td>\n<td>0.8328\u0441<\/td>\n<td>302.5810 fps<\/td>\n<\/tr>\n<tr>\n<td>yuv_gray<\/td>\n<td>7.3772\u0441<\/td>\n<td>0.7377\u0441<\/td>\n<td>341.5925 fps<\/td>\n<\/tr>\n<tr>\n<td>yuv_gray8<\/td>\n<td>8.2721\u0441<\/td>\n<td>0.8272\u0441<\/td>\n<td>304.6402 fps<\/td>\n<\/tr>\n<tr>\n<td>yuv_rgb<\/td>\n<td>9.3969\u0441<\/td>\n<td>0.9397\u0441<\/td>\n<td>268.1733 fps<\/td>\n<\/tr>\n<tr>\n<td>native_gray<\/td>\n<td>10.7005\u0441<\/td>\n<td>1.0700\u0441<\/td>\n<td>235.5041 fps<\/td>\n<\/tr>\n<tr>\n<td>native_rgb<\/td>\n<td>13.7820\u0441<\/td>\n<td>1.3782\u0441<\/td>\n<td>182.8466 fps<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e, \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u0432 OpenCV. yuv_gray \u2014 \u044d\u0442\u043e \u044f\u0440\u043a\u043e\u0441\u0442\u043d\u0430\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0449\u0430\u044f I420 \u043a\u0430\u0434\u0440\u0430, \u0430 \u0446\u0432\u0435\u0442\u043e\u0440\u0430\u0437\u043d\u043e\u0441\u0442\u043d\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u043f\u0440\u043e\u0441\u0442\u043e \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c.<\/p>\n<p>  <\/p>\n<h4 id=\"gstreamer-1\">GStreamer<\/h4>\n<p>  <\/p>\n<p>\u0422\u0435 \u0436\u0435 \u0441\u0430\u043c\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0447\u0442\u043e \u0438 FFmpeg, \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u043d\u0430\u0434 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u043c.<\/p>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u0424\u043e\u0440\u043c\u0430\u0442<\/th>\n<th>\u0412\u0441\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/th>\n<th>\u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e<\/th>\n<th>\u041a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>pure<\/td>\n<td>7.1359\u0441<\/td>\n<td>0.7136\u0441<\/td>\n<td>353.1457 fps<\/td>\n<\/tr>\n<tr>\n<td>yuv_gray<\/td>\n<td>6.8841\u0441<\/td>\n<td>0.6884\u0441<\/td>\n<td>366.0609 fps<\/td>\n<\/tr>\n<tr>\n<td>yuv_gray8<\/td>\n<td>7.3328\u0441<\/td>\n<td>0.7333\u0441<\/td>\n<td>343.6599 fps<\/td>\n<\/tr>\n<tr>\n<td>yuv_rgb<\/td>\n<td>8.9191\u0441<\/td>\n<td>0.8919\u0441<\/td>\n<td>282.5403 fps<\/td>\n<\/tr>\n<tr>\n<td>native_gray<\/td>\n<td>20.2932\u0441<\/td>\n<td>2.3832\u0441<\/td>\n<td>105.7409 fps<\/td>\n<\/tr>\n<tr>\n<td>native_rgb<\/td>\n<td>23.8318\u0441<\/td>\n<td>2.0293\u0441<\/td>\n<td>124.1793 fps<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0435\u0449\u0435 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u0447\u0435\u043c \u0432 FFmpeg. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0444\u043e\u0440\u043c\u0430\u0442\u044b \u0447\u0443\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u0438\u0437-\u0437\u0430 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043a\u0430\u0434\u0440\u0430.<br \/>  \u041f\u0440\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0447\u0435\u0440\u0435\u0437 Python \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 30% \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u043b\u0443\u0447\u0430\u044f. \u041e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0434\u0430\u043b\u044c\u0448\u0435, GStreamer, \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0432\u044b\u0432\u043e\u0434, \u0447\u0435\u043c \u0432\u044b\u0438\u0433\u0440\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u0435 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438, \u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u0430\u044f \u0446\u0438\u0444\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043f\u0440\u0435\u0434\u0435\u043b\u0430\u0445 \u043e\u0442 10% \u0434\u043e 20%. \u0422\u0430\u043a\u0436\u0435 \u0432 \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u043d\u0435 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u044b\u043c, \u0447\u0442\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 RGB \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0435\u043c \u0432 GRAY8. \u041d\u043e \u044d\u0442\u043e \u043f\u043e\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u0442\u0441\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0431\u0435\u0437 python:<\/p>\n<p>  <\/p>\n<pre><code class=\"bash\">gst-launch-1.0 filesrc location=&quot;Tractor_500kbps_x264.mp4&quot; ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! &quot;video\/x-raw, format=(string)GRAY8&quot; ! fakesink  Execution ended after 0:00:02.229323128  gst-launch-1.0 filesrc location=&quot;Tractor_500kbps_x264.mp4&quot; ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! &quot;video\/x-raw, format=(string)RGB&quot; ! fakesink  Execution ended after 0:00:01.150704119<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u044d\u0442\u043e Python \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439, \u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u043e\u0439-\u043d\u0438\u0431\u0443\u0434\u044c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0439 \u044f\u0437\u044b\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0436\u0430\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u043c\u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u043c\u043e\u043b\u043e\u0434\u0435\u0436\u043d\u043e\u0433\u043e \u044f\u0437\u044b\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 Rust.<\/p>\n<p>  <\/p>\n<h4 id=\"opencv-2\">OpenCV<\/h4>\n<p>  <\/p>\n<pre><code class=\"rust\">extern crate opencv;  use opencv::{core, videoio, imgproc};  fn main() -&gt; opencv::Result&lt;()&gt; {     let filename = &quot;Tractor_500kbps_x264.mp4&quot;;     let mut cam = videoio::VideoCapture::new_from_file_with_backend(filename, videoio::CAP_ANY)?;     let opened = videoio::VideoCapture::is_opened(&amp;cam)?;     if !opened { panic!(&quot;Unable to open default camera!&quot;) };     let mut frame = core::Mat::default()?;     let mut gray = core::Mat::default()?;     loop {         cam.read(&amp;mut frame)?;         if frame.size()?.width &gt; 0 {             imgproc::cvt_color(&amp;frame, &amp;mut gray, imgproc::COLOR_BGR2RGB, 0)?;         }         else {             break         }     } }<\/code><\/pre>\n<p>  <\/p>\n<h4 id=\"gstreamer-2\">GStreamer<\/h4>\n<p>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u0443\u0441\u043e\u043a \u043a\u043e\u0434\u0430 \u0434\u043b\u044f GStreamer \u043d\u0430 Rust<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"rust\">extern crate opencv; use crate::opencv::prelude::Vector;  use std::time::SystemTime; use opencv::{core, videoio, imgproc}; use opencv::types::{VectorOfint};  extern crate gstreamer as gst; extern crate gstreamer_app as gst_app; extern crate failure; extern crate glib;  use failure::Error; use gst::prelude::*;  #[macro_use] extern crate failure_derive;  #[derive(Debug, Fail)] #[fail(display = &quot;Missing element {}&quot;, _0)] struct MissingElement(&amp;'static str);  struct Camera {     pipe: gst::Pipeline,     main_loop: glib::MainLoop, }  impl Camera {     fn new(location: &amp;str) -&gt; Camera {         Camera {             pipe: Camera::create_pipeline(location).unwrap(),             main_loop: glib::MainLoop::new(None, false),         }     }     fn run(&amp;self) -&gt; Result&lt;(), Error&gt; {         self.create_bus()?;         self.pipe.set_state(gst::State::Playing)?;         self.main_loop.run();         Ok(())     }      fn create_bus(&amp;self) -&gt; Result&lt;(), Error&gt;{         let bus = self.pipe.get_bus().expect(&quot;Pipeline without bus. Shouldn't happen!&quot;);         let ml = self.main_loop.clone();         let pipe = self.pipe.clone();         bus.add_watch(move |_: &amp;gst::Bus, msg: &amp;gst::Message| {             use gst::MessageView;             match msg.view() {                 MessageView::Eos(..) =&gt; {                     pipe.set_state(gst::State::Null).unwrap();                     ml.quit();                 },                 MessageView::Error(err) =&gt; {                     println!(                         &quot;Error from {:?}: {} ({:?})&quot;,                         err.get_src().map(|s| s.get_path_string()),                         err.get_error(),                         err.get_debug()                     );                     pipe.set_state(gst::State::Null).unwrap();                     ml.quit();                 }                 _ =&gt; (),             };             glib::Continue(true)         });         Ok(())     }     fn create_pipeline(location: &amp;str) -&gt; Result&lt;gst::Pipeline, Error&gt; {         gst::init()?;          let src = gst::ElementFactory::make(&quot;filesrc&quot;, Some(&quot;src&quot;))             .ok_or(MissingElement(&quot;cant create filesource&quot;))?;         let demux = gst::ElementFactory::make(&quot;qtdemux&quot;, Some(&quot;demux&quot;))             .ok_or(MissingElement(&quot;cant create demux&quot;))?;         let parse = gst::ElementFactory::make(&quot;h264parse&quot;, Some(&quot;parse&quot;))             .ok_or(MissingElement(&quot;cant create parse&quot;))?;         let decode = gst::ElementFactory::make(&quot;avdec_h264&quot;, Some(&quot;decode&quot;))             .ok_or(MissingElement(&quot;cant create decodebin&quot;))?;         let convert = gst::ElementFactory::make(&quot;videoconvert&quot;, Some(&quot;convert&quot;))             .ok_or(MissingElement(&quot;cant create convert&quot;))?;         let sink = gst::ElementFactory::make(&quot;appsink&quot;, Some(&quot;appsink&quot;))             .ok_or(MissingElement(&quot;cant create appsink&quot;))?;          src.set_property(&quot;location&quot;, &amp;location)?;          let pipeline = gst::Pipeline::new(None);         pipeline.add_many(&amp;[&amp;src, &amp;demux, &amp;parse, &amp;decode, &amp;convert, &amp;sink])?;         src.link(&amp;demux)?;         parse.link(&amp;decode)?;         decode.link(&amp;convert)?;         convert.link(&amp;sink)?;          let sink_pad = parse.get_static_pad(&quot;sink&quot;).unwrap();         demux.connect_pad_added(move |_dbin, src_pad| {             src_pad.link(&amp;sink_pad).expect(&quot;Not linked&quot;);         });          let appsink = sink.dynamic_cast::&lt;gst_app::AppSink&gt;()             .expect(&quot;Sink element is expected to be an appsink!&quot;);         appsink.set_emit_signals(true);         appsink.set_max_buffers(1);         appsink.set_drop(true);         appsink.set_wait_on_eos(false);         appsink.set_property(&quot;sync&quot;, &amp;false)?;         appsink.set_callbacks(             gst_app::AppSinkCallbacks::new()                 .new_sample(move |appsink: &amp;gst_app::AppSink| {                     let sample = appsink.pull_sample().ok_or(gst::FlowError::Eos)?;                     let buffer = sample.get_buffer().ok_or_else(||gst::FlowError::Error)?;                     let map = buffer.map_readable().ok_or_else(||gst::FlowError::Error)?;                     let samples = map.as_slice();                     let dims = VectorOfint::from_iter(vec![1080+1080\/2, 1920]);                     let frame = core::Mat::from_slice(samples).unwrap().reshape_nd(1, &amp;dims).unwrap();                     let mut rgb = core::Mat::default().unwrap();                     imgproc::cvt_color(&amp;frame, &amp;mut rgb, imgproc::COLOR_YUV2RGB_I420, 3).unwrap();                     Ok(gst::FlowSuccess::Ok)                 })                 .build()         );         Ok(pipeline)     } }  fn main() {     let filename = &quot;Tractor_500kbps_x264.mp4&quot;;     let camera = Camera::new(filename);     camera.run().expect(&quot;Loop stopped&quot;); } <\/code><\/pre>\n<\/div>\n<\/div>\n<p>  <\/p>\n<div class=\"scrollable-table\">\n<table>\n<thead>\n<tr>\n<th>\u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430<\/th>\n<th>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/th>\n<th>\u0412\u0441\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438<\/th>\n<th>\u0412\u0440\u0435\u043c\u0435\u043d\u0438 \u043d\u0430 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044e<\/th>\n<th>\u041a\u0430\u0434\u0440\u043e\u0432 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>OpenCV<\/td>\n<td>pure<\/td>\n<td>8.733\u0441<\/td>\n<td>0.8733\u0441<\/td>\n<td>288.5606 fps<\/td>\n<\/tr>\n<tr>\n<td>OpenCV<\/td>\n<td>rgb<\/td>\n<td>10.5890\u0441<\/td>\n<td>1.0589\u0441<\/td>\n<td>237.9828 fps<\/td>\n<\/tr>\n<tr>\n<td>GStreamer<\/td>\n<td>pure<\/td>\n<td>5.487\u0441<\/td>\n<td>0.5487\u0441<\/td>\n<td>459.2673 fps<\/td>\n<\/tr>\n<tr>\n<td>GStreamer<\/td>\n<td>yuv_rgb<\/td>\n<td>7.8290\u0441<\/td>\n<td>0.7829\u0441<\/td>\n<td>321.8802 fps<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>  <\/p>\n<p>\u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 OpenCV \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c. \u0410 \u0432\u043e\u0442 GStreamer \u0434\u0430\u0435\u0442 ~15% \u043f\u0440\u0438\u0440\u043e\u0441\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. \u041f\u0440\u0438\u0447\u0435\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043e\u043f\u044f\u0442\u044c \u0436\u0435 \u0442\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0447\u0435\u0440\u0435\u0437 OpenCV. \u041e\u0441\u043d\u043e\u0432\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441 Python \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 opencv-python \u0438\u0437 pypi, \u0432 \u0441\u043e\u0441\u0442\u0430\u0432\u0435 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f OpenCV, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u0441 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438. \u0417\u0434\u0435\u0441\u044c \u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439, \u0438\u0437 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432 Arch Linux.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044f \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 GStreamer \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0446\u0432\u0435\u0442\u043e\u0433\u043e \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0430 \u0447\u0435\u0440\u0435\u0437 OpenCV \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0445\u043e\u0440\u043e\u0448\u0435\u0439 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0433\u0438\u0431\u043a\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0438\u043b\u0438 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0433\u043e \u043f\u043e \u0441\u0435\u0442\u0438 \u043a\u043e\u0434\u0430. <\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/gitlab.com\/menstenebris\/video_pipeline\" rel=\"nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<\/div>\n<p> \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\/post\/467537\/\"> https:\/\/habr.com\/ru\/post\/467537\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html\" id=\"post-content-body\" data-io-article-url=\"https:\/\/habr.com\/ru\/post\/467537\/\">\n<p>\u041c\u043d\u043e\u0433\u0438\u0435 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c \u2014 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u044b\u0439 Python \u0432 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f\u0445 \u0434\u0435\u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f? \u041f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c\u044b\u0435 \u044f\u0437\u044b\u043a\u0438 \u0434\u0430\u044e\u0442 \u043f\u0440\u0438\u0440\u043e\u0441\u0442 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u0432\u043e \u0432\u0441\u0435\u043c, \u0447\u0435\u0433\u043e \u043a\u0430\u0441\u0430\u044e\u0442\u0441\u044f? \u0427\u0442\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435: OpenCV \u0438\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e? \u041e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u044d\u0442\u0438 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0431\u0435\u0441\u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c \u0432\u044b \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442\u0435. \u0422\u0430\u043c \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0441\u043a\u0443\u0447\u043d\u043e\u0435 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0435.<br \/>  \u0412\u0441\u0435 \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u0432\u0448\u0438\u0435\u0441\u044f, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c!<\/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-297929","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297929","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=297929"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/297929\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=297929"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=297929"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=297929"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}