本文目标

        使用Akamai Cloud VPU资源完成一个视频转码任务。具体为将一个1080P的H.264格式视频转出成H.265格式。以此让读者熟悉基于VPU资源构建转码服务的基本步骤。

测试结论

资源转码时长转码后体积
VPU2.898s14MB
CPU1m25.862s8.2MB

相关资源

实例规格:NETINT Quadra T1U x1 Small
操作系统:ubuntu 24.04lts

VPU软件包位置:https://docs.netint.com/vpu/quadra/
当前版本:Release: v5.4.0(2025年11月7日)

源视频位置:https://github.com/chthomos/video-media-samples#

准备工作

创建VPU实例

系统更新

sudo apt update && sudo apt upgrade -y && sudo apt install unzip nvme-cli

下载安装包

wget https://releases.netint.com/quadra/POFCG6D02HW7XXX//Quadra_V5.4.0.zip
unzip Quadra_V5.4.0.zip
cd Quadra_V5.4.0/

安装软件

bash quadra_quick_installer.sh

进入安装步骤

设置系统参数

设置权限

安装依赖包

安装Libxcoder

安装ffmpeg软件,具体版本可以根据需求进行选择

下载样例视频

git clone https://github.com/chthomos/video-media-samples.git

转码测试

使用VPU转码

time ffmpeg -y -hide_banner -nostdin -vsync 0 -c:v h264_ni_quadra_dec -i /root/video-media-samples/big-buck-bunny-1080p-30sec.mp4 -c:v h265_ni_quadra_enc /root/output.h265.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/root/video-media-samples/big-buck-bunny-1080p-30sec.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.25.101
  Duration: 00:00:30.02, start: 0.000000, bitrate: 6053 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5860 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
[SID=7e3f]|| ni_set_custom_dec_template height 1080 width 1920 fps_number 24 fps_denominator 1
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (h264_ni_quadra_dec) -> hevc (h265_ni_quadra_enc))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
[h265_ni_quadra_enc @ 0x13de3400] Session state: 0 allocate frame fifo.
[h265_ni_quadra_enc @ 0x13de3400] pix_fmt is 0, sw_pix_fmt is -1 resolution 1920x1080
[h265_ni_quadra_enc @ 0x13de3400] sw_pix_fmt assigned to pix_fmt was 0, is now -1
[h265_ni_quadra_enc @ 0x13de3400] dts offset: 3, gop_offset_count: 0
[SID=2249]|| Encoder_complete_info:session_id 0x2249, total frames input:0 buffered: 0 completed: 0 output: 0 dropped: 0 error: 0
[h265_ni_quadra_enc @ 0x13de3400] xcoder_setup_encoder sw_pix_fmt 0 ori_pix_fmt 0
Output #0, mp4, to '/root/output.h265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.45.100
    Stream #0:0(und): Video: hevc (h265_ni_quadra_enc) (hvc1 / 0x31637668), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 24 fps, 12288 tbn, 24 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      encoder         : Lavc58.91.100 h265_ni_quadra_enc
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 341 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      encoder         : Lavc58.91.100 aac
frame=  720 fps=252 q=27.0 Lsize=   14005kB time=00:00:30.01 bitrate=3822.4kbits/s speed=10.5x    
video:12729kB audio:1255kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.152426%
[SID=7e3f]|| Decoder_complete_info:session_id 0x7e3f, total frames input:720 buffered: 0 completed: 720 output: 720 dropped: 0 error: 0 corrupted: 0
[SID=d277]|| Encoder_complete_info:session_id 0xd277, total frames input:720 buffered: 0 completed: 720 output: 720 dropped: 0 error: 0
[aac @ 0x13daf580] Qavg: 3155.695

real    0m2.898s
user    0m0.658s
sys     0m0.468s

使用CPU转码

time ffmpeg -y -hide_banner -nostdin -vsync 0 -c:v h264 -i /root/video-media-samples/big-buck-bunny-1080p-30sec.mp4 -c:v hevc /root/output-libx265.h265.mp4
-vsync is deprecated. Use -fps_mode
Passing a number to -vsync is deprecated, use a string argument as described in the manual.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/root/video-media-samples/big-buck-bunny-1080p-30sec.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.25.101
  Duration: 00:00:30.00, start: 0.000000, bitrate: 6058 kb/s
  Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 5860 kb/s, 24 fps, 24 tbr, 12288 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 192 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
x265 [info]: HEVC encoder version 3.5+1-f0c1022b6
x265 [info]: build info [Linux][GCC 13.2.0][64 bit] 8bit+10bit+12bit
x265 [info]: using cpu capabilities: MMX2 SSE2Fast LZCNT SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
x265 [info]: Main profile, Level-4 (Main tier)
x265 [info]: Thread pool created using 2 threads
x265 [info]: Slices                              : 1
x265 [info]: frame threads / pool features       : 1 / wpp(17 rows)
x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge         : hex / 57 / 2 / 3
x265 [info]: Keyframe min / max / scenecut / bias  : 24 / 250 / 40 / 5.00 
x265 [info]: Lookahead / bframes / badapt        : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
x265 [info]: References / ref-limit  cu / depth  : 3 / off / on
x265 [info]: AQ: mode / str / qg-size / cu-tree  : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress            : CRF-28.0 / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 early-skip rskip mode=1 signhide tmvp
x265 [info]: tools: b-intra strong-intra-smoothing lslices=6 deblock sao
Output #0, mp4, to '/root/output-libx265.h265.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf60.16.100
  Stream #0:0(und): Video: hevc (hev1 / 0x31766568), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 12288 tbn (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.31.102 libx265
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 341 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
      encoder         : Lavc60.31.102 aac
[out#0/mp4 @ 0x595320c85340] video:7079kB audio:1253kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.293141%
frame=  720 fps=8.4 q=35.9 Lsize=    8357kB time=00:00:29.99 bitrate=2282.4kbits/s speed=0.35x    
x265 [info]: frame I:      6, Avg QP:26.25  kb/s: 29779.26
x265 [info]: frame P:    248, Avg QP:27.78  kb/s: 4515.13 
x265 [info]: frame B:    466, Avg QP:34.80  kb/s: 199.29  
x265 [info]: Weighted P-Frames: Y:11.3% UV:3.6%
x265 [info]: consecutive B-frames: 26.8% 15.0% 9.8% 44.9% 3.5% 

encoded 720 frames in 85.63s (8.41 fps), 1932.36 kb/s, Avg QP:32.31
[aac @ 0x595320c95840] Qavg: 451.761

real    1m25.862s
user    2m47.321s
sys     0m0.812s

Akamai Cloud VPU 产品简介

        Akamai Linode 提供的 VPU 实例(Video Processing Unit) 基于 NETINT Quadra T1U 硬件卡,专为高密度视频编解码和 AI 视频分析场景设计。该卡采用 SoC 架构,集成硬件级编码、解码、AI 推理引擎(NNP)以及 NVMe 接口,具备低功耗、高吞吐的优势。

Logo

火山引擎视频云技术社区,是面向 AI 音视频开发者的技术交流平台。这里汇聚源自抖音、豆包等亿级 DAU 产品的 RTC、直播、点播、AI 媒体处理、音视频互动技术,提供接入指南、最佳实践、性能调优、场景案例、Demo 代码、开源项目、白皮书和 API 文档。社区汇聚官方工程师与一线开发者,为 AI 视频通话、数字人、AI 视频处理等应用的开发与落地提供技术支持。

更多推荐