{"id":1,"date":"2024-10-25T16:28:00","date_gmt":"2024-10-25T08:28:00","guid":{"rendered":"http:\/\/160.251.209.97\/?p=1"},"modified":"2024-11-25T14:40:41","modified_gmt":"2024-11-25T06:40:41","slug":"video-transcoding","status":"publish","type":"post","link":"https:\/\/prinice.org\/index.php\/2024\/10\/25\/video-transcoding\/","title":{"rendered":"\u4f7f\u7528FFmpeg\u548cIntel QSV\u5c06\u84dd\u5149\u539f\u76d8\u8f6c\u7801\u4e3aHEVC\u683c\u5f0f\u4ee5\u9002\u5e94\u7f51\u7edc\u64ad\u653e"},"content":{"rendered":"\n<p>\u7531\u4e8e\u7fa4\u6656NAS\u4e0d\u518d\u652f\u6301Video Station\uff0c\u56e0\u6b64\u51b3\u5b9a\u5c06NAS\u4e0a\u7684\u84dd\u5149\u539f\u76d8\u89c6\u9891\u8f6c\u7801\u4e3a\u9002\u5408\u7f51\u7edc\u64ad\u653e\u7684\u4f4e\u7801\u7387\u683c\u5f0f\u3002\u5728\u7efc\u5408\u8003\u8651\u8d28\u91cf\u548c\u8f6c\u7801\u901f\u5ea6\u540e\uff0c\u6700\u7ec8\u9009\u62e9\u4f7f\u7528FFmpeg\u914d\u5408Intel Quick Sync Video (QSV)\u5c06\u89c6\u9891\u8f6c\u7801\u4e3aH.265 (HEVC) Main10\u683c\u5f0f\u3002<\/p>\n\n\n\n<p>\u672c\u6587\u4e3a\u4e2a\u4eba\u7b14\u8bb0\uff0c\u5185\u5bb9\u7b80\u6d01\uff0c\u4e0d\u8ba8\u8bba\u9009\u62e9\u80cc\u540e\u7684\u539f\u56e0\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u786c\u4ef6\u914d\u7f6e\u9700\u6c42<\/h2>\n\n\n\n<p>\u8be5\u65b9\u6848\u81f3\u5c11\u9700\u8981Kaby Lake\uff087\u4ee3Intel\u00ae Core\u2122\uff09\u6216\u66f4\u65b0\u7248\u672c\u7684\u5e26\u6838\u663eIntel\u5904\u7406\u5668\uff0c\u6216Intel\u00ae Arc\u2122\u72ec\u7acb\u663e\u5361\uff0c\u4ee5\u4fbf\u652f\u6301QSV\u786c\u4ef6\u52a0\u901f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u89c6\u9891\u683c\u5f0f\u60c5\u51b5<\/h2>\n\n\n\n<p>\u6536\u85cf\u7684\u84dd\u5149\u539f\u76d8\u89c6\u9891\u51e0\u4e4e\u5747\u4e3aNTSC\u683c\u5f0f\uff0c\u6309\u4ee5\u4e0b\u4e09\u79cd\u60c5\u51b5\u5904\u7406\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u9010\u884c\u626b\u63cf\uff1a\u5e38\u89c1\u4e3a24p\u621630p\uff0c\u5e27\u7387\u4e3a24000\/1001\u621630000\/1001\uff0c\u6b64\u7c7b\u89c6\u9891\u65e0\u9700\u989d\u5916\u5904\u7406\u3002<\/li>\n\n\n\n<li>\u9694\u884c\u626b\u63cf\uff1a\u5e38\u89c1\u4e3a30i\uff0c\u5e27\u7387\u4e3a30000\/1001\uff0c\u6b64\u7c7b\u89c6\u9891\u9700\u8981\u53cd\u4ea4\u9519\u5904\u7406\u3002<\/li>\n\n\n\n<li>24p\u63d2\u5e27\uff1a\u89c6\u9891\u4e3a30i\u621630p\uff0c\u5e27\u7387\u4e3a30000\/1001\uff0c\u6b64\u7c7b\u89c6\u9891\u9700\u8fdb\u884cInverse Telecine (IVTC)\u6216\u5e27\u7387\u8f6c\u6362\u3002<\/li>\n<\/ul>\n\n\n\n<p>\u4f7f\u7528vpp_qsv\u53ef\u4ee5\u667a\u80fd\u5730\u9009\u62e9\u9002\u5f53\u7684\u53cd\u4ea4\u9519\u7b97\u6cd5\u548c\u5e27\u7387\u8f6c\u6362\u65b9\u6cd5\uff0c\u56e0\u6b64\u65e0\u9700\u624b\u52a8\u6307\u5b9a\u5904\u7406\u65b9\u5f0f\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u97f3\u9891\u5904\u7406<\/h2>\n\n\n\n<p>\u5bf9\u4e8e\u6d41\u5a92\u4f53\u64ad\u653e\u7684\u97f3\u9891\u90e8\u5206\uff0c\u4f7f\u7528AAC 48000Hz 256Kbps\u7f16\u7801\u5df2\u8db3\u591f\uff0c\u539f\u76d8\u4e2d\u5982\u670996000Hz\u6216\u5176\u4ed6\u683c\u5f0f\u7684\u97f3\u9891\uff0c\u4e5f\u7edf\u4e00\u8f6c\u6362\u4e3a48000Hz\u5904\u7406\u3002\u7531\u4e8e\u672c\u4eba\u6536\u85cf\u7684\u84dd\u5149\u539f\u76d8\u4e3b\u8981\u4e3a\u7535\u89c6\u52a8\u753b\uff0c\u8fd9\u91cc\u4e0d\u8003\u8651\u591a\u97f3\u8f68\u7684\u60c5\u51b5\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Powershell\u4ee3\u7801<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># \u6dfb\u52a0 FFmpeg \u5230 PATH\n$env:PATH += \";$env:PUBLIC\\ffmpeg-7.1-full_build\\bin\"\n\n# \u89c6\u9891\u8f93\u5165\u53c2\u6570\n$VideoInputParams = @(\n    '-init_hw_device', 'qsv:hw,child_device_type=d3d11va',\n    '-hwaccel', 'qsv',\n    '-hwaccel_output_format', 'qsv',\n    '-c:v', 'h264_qsv'\n)\n\n# \u89c6\u9891\u8f93\u51fa\u53c2\u6570\n$VideoOutputParams = @(\n    '-c:v', 'hevc_qsv',\n    '-global_quality', '25',\n    '-extbrc', '1',\n    '-b_strategy', '1',\n    '-bf', '7',\n    '-refs', '4',\n    '-g', '256',\n    '-fps_mode', 'passthrough'\n)\n\n# \u97f3\u9891\u8f93\u51fa\u53c2\u6570\n$AudioOutputParams = @('-b:a', '256k')\n\n# \u97f3\u9891\u6ee4\u955c\n$AudioFilters = @('-af', 'aresample=resampler=soxr:precision=28:out_sample_rate=48000')\n\n# \u9009\u62e9\u6a21\u5f0f\nSwitch (Read-Host \"1. HD to HEVC.`n2. HD to HEVC with Deinterlace.`n3. HD to HEVC with IVTC.`n4. HD to HEVC with Audio SRC.`n5. HD to HEVC with Deinterlace &amp; Audio SRC.`n6. HD to HEVC with IVTC &amp; Audio SRC.`n`n`tPlease select a mode\") {\n    1 { $VideoFilters = @('-vf', 'vpp_qsv=format=p010le') }\n    2 { $VideoFilters = @('-vf', 'vpp_qsv=format=p010le:deinterlace=2') }\n    3 { $VideoFilters = @('-vf', 'vpp_qsv=format=p010le:deinterlace=2:framerate=24000\/1001') }\n    4 { $VideoFilters = @('-vf', 'vpp_qsv=format=p010le'); $UseAudioFilters = $true }\n    5 { $VideoFilters = @('-vf', 'vpp_qsv=format=p010le:deinterlace=2'); $UseAudioFilters = $true }\n    6 { $VideoFilters = @('-vf', 'vpp_qsv=format=p010le:deinterlace=2:framerate=24000\/1001'); $UseAudioFilters = $true }\n}\n\n# \u5904\u7406\u89c6\u9891\u6587\u4ef6\nGet-ChildItem *.m2ts, *.mkv, *.mov | ForEach-Object {\n    $params = $VideoInputParams + '-i' + $_.FullName + $VideoFilters + $VideoOutputParams\n\n    if ($UseAudioFilters) {\n        $params += $AudioFilters\n    }\n    \n    $params += $AudioOutputParams\n\n    # \u6267\u884c FFmpeg\n    try {\n        ffmpeg.exe $params -y \"$($_.BaseName).mp4\"\n    } catch {\n        Write-Host \"Error processing $($_.Name): $_\"\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u7531\u4e8e\u7fa4\u6656NAS\u4e0d\u518d\u652f\u6301Video Station\uff0c\u56e0\u6b64\u51b3\u5b9a\u5c06NAS\u4e0a\u7684\u84dd\u5149\u539f\u76d8\u89c6\u9891\u8f6c\u7801\u4e3a\u9002\u5408\u7f51\u7edc\u64ad\u653e\u7684\u4f4e\u7801\u7387\u683c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3],"tags":[7,5,10,8,6,9,11],"class_list":["post-1","post","type-post","status-publish","format-standard","hentry","category-ffmpeg","tag-ffmpeg","tag-h-265-hevc","tag-intel-quick-sync-video","tag-ntsc","tag-6","tag-9","tag-11"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/posts\/1","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/comments?post=1"}],"version-history":[{"count":2,"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/posts\/1\/revisions"}],"predecessor-version":[{"id":11,"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/posts\/1\/revisions\/11"}],"wp:attachment":[{"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/media?parent=1"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/categories?post=1"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prinice.org\/index.php\/wp-json\/wp\/v2\/tags?post=1"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}