{"id":10297,"date":"2023-08-25T15:44:53","date_gmt":"2023-08-25T07:44:53","guid":{"rendered":"http:\/\/xinyiworld.top\/wordpress_it\/?p=10297"},"modified":"2024-01-10T10:54:09","modified_gmt":"2024-01-10T02:54:09","slug":"arm-linux%e4%ba%a4%e5%8f%89%e7%bc%96%e8%af%91x264-ffmpeg","status":"publish","type":"post","link":"http:\/\/xinyiworld.top\/wordpress_it\/?p=10297","title":{"rendered":"arm linux\u4ea4\u53c9\u7f16\u8bd1x264 ffmpeg"},"content":{"rendered":"<p><a href=\"https:\/\/zhuanlan.zhihu.com\/p\/147315845?utm_id=0\">https:\/\/zhuanlan.zhihu.com\/p\/147315845?utm_id=0<\/a><\/p>\n<p>\u5982\u679c\u4f60\u7f16\u8bd1\u7684ffmpeg\u6ca1\u6709\u542f\u7528h264\u5e93\uff0c\u5728\u7f16\u7801\u65f6\u6307\u5b9a-vcodec h264\u5c31\u4f1a\u62a5\u9519\uff1a<\/p>\n<pre><code class=\"language-bash\">[h264_v4l2m2m @ 0x3830dde0] Could not find a valid device                                                                                                                                            \n[h264_v4l2m2m @ 0x3830dde0] can&#039;t configure encoder                                                                                                                                                  \nError initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height                                      \nConversion failed!<\/code><\/pre>\n<ul>\n<li>\n<p>x264\u4e0eopenh264\u7684\u533a\u522b<br \/>\n<a href=\"https:\/\/www.xjx100.cn\/news\/620896.html?action=onClick\">https:\/\/www.xjx100.cn\/news\/620896.html?action=onClick<\/a><\/p>\n<\/li>\n<li>\n<p>x264\u4e0eh264<br \/>\n<a href=\"https:\/\/www.python100.com\/html\/81769.html\">https:\/\/www.python100.com\/html\/81769.html<\/a><br \/>\nh264\u662f\u7f16\u7801\u683c\u5f0f\uff0cx264\u662f\u57fa\u4e8eh264\u7684\u7f16\u7801\u5668\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u5e38\u7528\u6570\u636e\u7ed3\u6784\u8bf4\u660e<\/h3>\n<p><a href=\"https:\/\/blog.csdn.net\/qq_34732729\/article\/details\/87717540\">https:\/\/blog.csdn.net\/qq_34732729\/article\/details\/87717540<\/a><\/p>\n<ul>\n<li>x264_image_t<\/li>\n<\/ul>\n<pre><code class=\"language-cpp\">\/********************************************************************************************\n\n x264_image_t \u7ed3\u6784\u7528\u4e8e\u5b58\u653e\u4e00\u5e27\u56fe\u50cf\u5b9e\u9645\u50cf\u7d20\u6570\u636e\u3002\u8be5\u7ed3\u6784\u4f53\u5b9a\u4e49\u5728x264.h\u4e2d\n\n*********************************************************************************************\/\n\ntypedef struct\n\n{\n\n    int     i_csp;           \/\/ \u8bbe\u7f6e\u5f69\u8272\u7a7a\u95f4\uff0c\u901a\u5e38\u53d6\u503c X264_CSP_I420\uff0c\u6240\u6709\u53ef\u80fd\u53d6\u503c\u5b9a\u4e49\u5728x264.h\u4e2d\n\n    int     i_plane;        \/\/  \u56fe\u50cf\u5e73\u9762\u4e2a\u6570\uff0c\u4f8b\u5982\u5f69\u8272\u7a7a\u95f4\u662fYUV420\u683c\u5f0f\u7684\uff0c\u6b64\u5904\u53d6\u503c3\n\n    int     i_stride[4];    \/\/ \u6bcf\u4e2a\u56fe\u50cf\u5e73\u9762\u7684\u8de8\u5ea6\uff0c\u4e5f\u5c31\u662f\u6bcf\u4e00\u884c\u6570\u636e\u7684\u5b57\u8282\u6570\n\n    uint8_t *plane[4];   \/\/  \u6bcf\u4e2a\u56fe\u50cf\u5e73\u9762\u5b58\u653e\u6570\u636e\u7684\u8d77\u59cb\u5730\u5740, plane[0]\u662fY\u5e73\u9762\uff0c\n\n\/\/ plane[1]\u548cplane[2]\u5206\u522b\u4ee3\u8868U\u548cV\u5e73\u9762\n\n}  x264_image_t;\n<\/code><\/pre>\n<ul>\n<li>x264_picture_t<\/li>\n<\/ul>\n<pre><code class=\"language-cpp\">\/********************************************************************************************\n\nx264_picture_t \u7ed3\u6784\u4f53\u63cf\u8ff0\u4e00\u89c6\u9891\u5e27\u7684\u7279\u5f81\uff0c\u8be5\u7ed3\u6784\u4f53\u5b9a\u4e49\u5728x264.h\u4e2d\u3002\n\n*********************************************************************************************\/\n\ntypedef struct\n\n{\n\nint   i_type;           \/\/ \u5e27\u7684\u7c7b\u578b\uff0c\u53d6\u503c\u6709X264_TYPE_KEYFRAME\u3001X264_TYPE_P\u3001\n\n                            \/\/ X264_TYPE_AUTO\u7b49\u3002\u521d\u59cb\u5316\u4e3aauto\uff0c\u5219\u5728\u7f16\u7801\u8fc7\u7a0b\u81ea\u884c\u63a7\u5236\u3002\n\nint   i_qpplus1;     \/\/ \u6b64\u53c2\u6570\u51cf1\u4ee3\u8868\u5f53\u524d\u5e27\u7684\u91cf\u5316\u53c2\u6570\u503c\n\nint   i_pic_struct; \/\/ \u5e27\u7684\u7ed3\u6784\u7c7b\u578b\uff0c\u8868\u793a\u662f\u5e27\u8fd8\u662f\u573a\uff0c\u662f\u9010\u884c\u8fd8\u662f\u9694\u884c\uff0c\n\n                           \/\/ \u53d6\u503c\u4e3a\u679a\u4e3e\u503c pic_struct_e\uff0c\u5b9a\u4e49\u5728x264.h\u4e2d\n\nint   b_keyframe; \/\/ \u8f93\u51fa\uff1a\u662f\u5426\u662f\u5173\u952e\u5e27\n\nint64_t   i_pts;    \/\/ \u4e00\u5e27\u7684\u663e\u793a\u65f6\u95f4\u6233\n\nint64_t   i_dts;     \/\/ \u8f93\u51fa\uff1a\u89e3\u7801\u65f6\u95f4\u6233\u3002\u5f53\u4e00\u5e27\u7684pts\u975e\u5e38\u63a5\u8fd10\u65f6\uff0c\u8be5dts\u503c\u53ef\u80fd\u4e3a\u8d1f\u3002\n\n\/* \u7f16\u7801\u5668\u53c2\u6570\u8bbe\u7f6e\uff0c\u5982\u679c\u4e3aNULL\u5219\u8868\u793a\u7ee7\u7eed\u4f7f\u7528\u524d\u4e00\u5e27\u7684\u8bbe\u7f6e\u3002\u67d0\u4e9b\u53c2\u6570\n\n   (\u4f8b\u5982aspect ratio) \u7531\u4e8e\u6536\u5230H264\u672c\u8eab\u7684\u9650\u5236\uff0c\u53ea\u80fd\u6bcf\u9694\u4e00\u4e2aGOP\u624d\u80fd\u6539\u53d8\u3002\n\n   \u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u5982\u679c\u60f3\u8ba9\u8fd9\u4e9b\u6539\u53d8\u7684\u53c2\u6570\u7acb\u5373\u751f\u6548\uff0c\u5219\u5fc5\u987b\u5f3a\u5236\u751f\u6210\u4e00\u4e2aIDR\u5e27\u3002*\/ \n\nx264_param_t    *param;\n\nx264_image_t     img;          \/\/ \u5b58\u653e\u4e00\u5e27\u56fe\u50cf\u7684\u771f\u5b9e\u6570\u636e\n\nx264_image_properties_t    prop;\n\nx264_hrd_t    hrd_timing;     \/\/ \u8f93\u51fa\uff1aHRD\u65f6\u95f4\u4fe1\u606f\uff0c\u4ec5\u5f53i_nal_hrd\u8bbe\u7f6e\u4e86\u624d\u6709\u6548\n\nvoid    *opaque;                     \/\/ \u79c1\u6709\u6570\u636e\u5b58\u653e\u533a\uff0c\u5c06\u8f93\u5165\u6570\u636e\u62f7\u8d1d\u5230\u8f93\u51fa\u5e27\u4e2d\n\n} x264_picture_t ;\n<\/code><\/pre>\n<ul>\n<li>x264_nal_t<\/li>\n<\/ul>\n<pre><code class=\"language-cpp\">\n\/****************************************************************************************************************\n\nx264_nal_t\u4e2d\u7684\u6570\u636e\u5728\u4e0b\u4e00\u6b21\u8c03\u7528x264_encoder_encode\u4e4b\u540e\u5c31\u65e0\u6548\u4e86\uff0c\u56e0\u6b64\u5fc5\u987b\u5728\u8c03\u7528\n\nx264_encoder_encode \u6216 x264_encoder_headers \u4e4b\u524d\u4f7f\u7528\u6216\u62f7\u8d1d\u5176\u4e2d\u7684\u6570\u636e\u3002\n\n*****************************************************************************************************************\/\n\ntypedef struct\n\n{\n\nint  i_ref_idc;        \/\/ Nal\u7684\u4f18\u5148\u7ea7\n\nint  i_type;           \/\/ Nal\u7684\u7c7b\u578b\n\nint  b_long_startcode; \/\/ \u662f\u5426\u91c7\u7528\u957f\u524d\u7f00\u78010x00000001\n\nint  i_first_mb;       \/\/ \u5982\u679cNal\u4e3a\u4e00\u6761\u5e26\uff0c\u5219\u8868\u793a\u8be5\u6761\u5e26\u7b2c\u4e00\u4e2a\u5b8f\u5757\u7684\u6307\u6570\n\n    int  i_last_mb;        \/\/ \u5982\u679cNal\u4e3a\u4e00\u6761\u5e26\uff0c\u5219\u8868\u793a\u8be5\u6761\u5e26\u6700\u540e\u4e00\u4e2a\u5b8f\u5757\u7684\u6307\u6570\n\n    int  i_payload;        \/\/ payload \u7684\u5b57\u8282\u5927\u5c0f\n\n    uint8_t *p_payload;    \/\/ \u5b58\u653e\u7f16\u7801\u540e\u7684\u6570\u636e\uff0c\u5df2\u7ecf\u5c01\u88c5\u6210Nal\u5355\u5143\n\n} x264_nal_t;<\/code><\/pre>\n<ul>\n<li>cli_opt_t<\/li>\n<\/ul>\n<pre><code class=\"language-cpp\">\/****************************************************************************************************************\n\ncli_opt_t\u7ed3\u6784\u4f53\u4e3b\u8981\u8bb0\u5f55\u4e00\u4e9b\u4e0e\u7f16\u7801\u5173\u7cfb\u8f83\u5c0f\u7684\u8bbe\u7f6e\u4fe1\u606f\uff0c\u5176\u53d8\u91cf\u53ef\u901a\u8fc7\u8bfb\u53d6main()\u7684\u53c2\u6570\u83b7\u5f97\u3002\n\n*****************************************************************************************************************\/\n\ntypedef struct\n\n{\n\n       int   b_progress;     \/\/ bool\u7c7b\u578b\u7684\u53d8\u91cf,\u7528\u6765\u63a7\u5236\u662f\u5426\u663e\u793a\u7f16\u7801\u8fdb\u5ea6\u3002\u53d6\u503c\u4e3a0\u62161\u3002\n\n       int   i_seek;             \/\/ \u6574\u6570\u7c7b\u578b \u8868\u793a\u5f00\u59cb\u4ece\u54ea\u4e00\u5e27\u5f00\u59cb\u7f16\u7801\u3002\n\n                                                 \/\/ \u56e0\u4e3a\u4e0d\u4e00\u5b9a\u4ece\u6587\u4ef6\u7684\u7b2c\u4e00\u5e27\u5f00\u59cb\u7f16\u7801\uff0c\u8fd9\u662f\u53ef\u4ee5\u63a7\u5236\u7684\u3002\n\n   \/* hnd_t(hnd=handle)\u662f\u4e00\u4e2a\u7a7a\u6307\u9488\uff0c \u5b9a\u4e49\u5728x264cli.h \u4e2d\u3002void *\u5728C\u8bed\u8a00\u91cc\u7a7a\u6307\u9488\u662f\u6709\u51e0\u4e2a\n\n    \u7279\u6027\u7684\uff0c\u5b83\u662f\u4e00\u4e2a\u4e00\u822c\u5316\u6307\u9488\uff0c\u53ef\u4ee5\u6307\u5411\u4efb\u4f55\u4e00\u79cd\u7c7b\u578b\uff0c\u4f46\u5374\u4e0d\u80fd\u89e3\u5f15\u7528\uff0c\u9700\u8981\u89e3\u5f15\n\n    \u7528\u7684\u65f6\u5019\uff0c\u9700\u8981\u8fdb\u884c\u5f3a\u5236\u8f6c\u6362\u3002\u91c7\u7528\u7a7a\u6307\u9488\u7684\u7b56\u7565\uff0c\u662f\u4e3a\u4e86\u58f0\u660e\u53d8\u91cf\u7684\u7b80\u4fbf\u548c\u7edf\u4e00\u3002 *\/\n\n       hnd_t   hin;              \/\/ \u6307\u5411\u8f93\u5165yuv\u6587\u4ef6\u7684\u6307\u9488\n\n       hnd_t  hout;            \/\/ \u6307\u5411\u7f16\u7801\u8fc7\u540e\u751f\u6210\u7684\u6587\u4ef6\u7684\u6307\u9488\u3002\n\n   \/* \u4e00\u4e2a\u6307\u5411\u6587\u4ef6\u7c7b\u578b\u7684\u6307\u9488\uff0c\u5b83\u662f\u6587\u672c\u6587\u4ef6\uff0c\u5176\u6bcf\u4e00\u884c\u7684\u683c\u5f0f\u662f \uff1aframenum frametye  \n\n      QP\u7528\u4e8e\u5f3a\u5236\u6307\u5b9a\u67d0\u4e9b\u5e27\u6216\u8005\u5168\u90e8\u5e27\u7684\u5e27\u7c7b\u578b\u548cQP(quant param\u91cf\u5316\u53c2\u6570)\u7684\u503c. *\/\n\n       FILE   *qpfile;\n\n} cli_opt_t;<\/code><\/pre>\n<h3>sps\u53e5\u6cd5\u5143\u7d20<\/h3>\n<p><a href=\"https:\/\/blog.csdn.net\/houxiaoni01\/article\/details\/100013749\">https:\/\/blog.csdn.net\/houxiaoni01\/article\/details\/100013749<\/a><\/p>\n<button class=\"simplefavorite-button\" data-postid=\"10297\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"\">\u6536\u85cf <i class=\"sf-icon-star-empty\"><\/i><\/button>","protected":false},"excerpt":{"rendered":"<p>https:\/\/zhuanlan.zhihu.com\/p\/147315845?utm_id=0 \u5982\u679c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[816],"tags":[],"_links":{"self":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10297"}],"collection":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10297"}],"version-history":[{"count":8,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10297\/revisions"}],"predecessor-version":[{"id":11327,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=\/wp\/v2\/posts\/10297\/revisions\/11327"}],"wp:attachment":[{"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10297"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/xinyiworld.top\/wordpress_it\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}