当前位置: 首页 > news >正文

Nvidia Jetson 编解码开发(1)介绍

前言

由于项目需要,需要开发Jetson平台的硬件编解码;

优化CPU带宽,后续主要以介绍硬件编解码为主

1.Jetson各平台编解码性能说明

如下是拿了Jetson nano/tx2/Xavier等几个平台做对比;

这里说明的编解码性能主要是对硬件来说的

2. 编解码实现说明

2.1 软件编解码

优点:功能强大、实现容易,工具强大

缺点: 占用CPU很大

常用工具有如下: ffmpeg、gstreamer,只做简单介绍

2.1.1 ffmpeg

FFMPEG是领先的多媒体框架,提供了音视频的编码,解码,转码,封装,解封装,流,滤镜,播放等功能。

它几乎支持所有的音视频格式,不管是标准委员会,社区,还是公司设计的。

它是高度可移植,跨平台的:

可以在Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris等系统上,在

各种不同的编译环境,机器架构,配置下编译,运行,并通过测试。

FFmpeg 一共包含 8 个库:

avcodec 编解码(最重要的库) 
avformat 封装格式处理 
avfilter 滤镜特效处理 
avdevice 各种设备的输入输出 
avutil 工具库 
postproc 后加工 
swresample 音频采样数据格式转换 
swscale 视频像素数据格式转换

2.1.2 gstreamer

Gstreamer是一个支持Windows,Linux,Android, iOS的跨平台的多媒体框架,

应用程序可以通过管道(Pipeline)的方式,将多媒体处理的各个步骤串联起来,达到预期的效果。

每个步骤通过元素(Element)基于GObject对象系统通过插件(plugins)的方式实现,方便了各项功能的扩展。

2.2 硬件编解码

优点: 占用CPU很小, 功能实现更灵活

缺点: 不通用,需要调用平台相关API,有些硬件方面的限制

2.2.1 Multimedia API

Multimedia API为那些不使用GStreamer等框架或利用自定义框架的开发人员提供了另一条应用程序开发路径。

Multimedia API是支持灵活的应用程序开发的低级API的集合。

这些低级API通过提供对底层硬件块的更好控制来实现灵活性。

多媒体API包括:

•    libargus for imaging applications
•    V4L2 API for encoding, decoding, scaling, and other media functions
•    NVOSD for On-Screen display
•    Buffer Utility for buffer allocation, management, and sharing, transform, composition, and blending 
Example applications are provided to demonstrate:
•    Video decode (dual decode support with NVDEC)
•    Video encode (dual encode support with NVENC)
•    Video decode and DRM based render
•    Video convert
•    Video decode with multi-channels
•    Multivideo decode (decoding of multiple video streams in parallel)
•    JPEG decode and JPEG encode
•    Image/video processing with CUDA
•    Camera JPEG capture and video record
•    Camera capture and CUDA processing
•    Multicamera capture with composition
•    Object detection and classification with cuDNN
•    TensorRT and OpenCV usage

2.2.2 Accelerated GStreamer

由于Jetson平台可支持GStreamer方面得加速;

所以也可以达到降低CPU带宽的目的

2.2.2.1 Encode 示例

(1)Video Encode Examples Using gst-launch-1.0

Video Encode Using gst-omx

//H.264 Encode (NVIDIA Accelerated Encode)
gst-launch-1.0 videotestsrc ! \ 'video/x-raw, format=(string)I420, width=(int)640, 
\ height=(int)480' ! omxh264enc ! 
\ 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! 
\ qtmux ! filesink location=test.mp4 -e //H.265 Encode (NVIDIA Accelerated Encode) g
st-launch-1.0 videotestsrc ! 
\ 'video/x-raw, format=(string)I420, width=(int)640, 
\ height=(int)480' ! omxh265enc ! filesink location=test.h265 -e

Video Encode Using gst-v4l2

//H.264 Encode (NVIDIA Accelerated Encode) 
gst-launch-1.0 nvarguscamerasrc ! 
\ 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, 
\ format=(string)NV12, framerate=(fraction)30/1' ! nvv4l2h264enc ! 
\ bitrate=8000000 ! h264parse ! qtmux ! filesink 
\ location=<filename_h264.mp4> -e //H.265 Encode (NVIDIA Accelerated Encode) 
gst-launch-1.0 nvarguscamerasrc ! 
\ 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, 
\ format=(string)NV12, framerate=(fraction)30/1' ! nvv4l2h265enc 
\ bitrate=8000000 ! h265parse ! qtmux ! filesink \ location=<filename_h265.mp4> -e

(2)Image Encode Examples Using gst-launch-1.0

gst-launch-1.0 videotestsrc num-buffers=1 ! 
\ 'video/x-raw, width=(int)640, height=(int)480, 
\ format=(string)I420' ! nvjpegenc ! filesink location=test.jpg -e

2.2.2.2 Decode 示例

(1)Video Decode Examples Using gst-launch-1.0

Video Decode Using gst-omx

//H.264 Decode (NVIDIA Accelerated Decode) 
gst-launch-1.0 filesrc location=<filename.mp4> ! 
\ qtdemux name=demux demux.video_0 ! queue ! h264parse ! omxh264dec ! 
\ nveglglessink -e //H.265 Decode (NVIDIA Accelerated Decode) 
gst-launch-1.0 filesrc location=<filename.mp4> ! 
\ qtdemux name=demux demux.video_0 ! queue ! h265parse ! omxh265dec ! \ nvoverlaysink -e

Video Decode Using gst-v4l2

//H.264 Decode (NVIDIA Accelerated Decode) 
gst-launch-1.0 filesrc location=<filename_h264.mp4> ! 
\ qtdemux ! queue ! h264parse ! nvv4l2decoder ! nv3dsink -e //H.265 Decode (NVIDIA Accelerated Decode) 
gst-launch-1.0 filesrc location=<filename_h265.mp4> ! 
\ qtdemux ! queue ! h265parse ! nvv4l2decoder ! nv3dsink -e

(2)Image Decode Examples Using gst-launch-1.0

//JPEG Decode (NVIDIA Accelerated Decode) gst-launch-1.0 filesrc location=<filename.jpg> ! nvjpegdec ! 
\ imagefreeze ! xvimagesink -e

http://www.lryc.cn/news/131832.html

相关文章:

  • 【操作系统】24王道考研笔记——第一章 计算机系统概述
  • 菜鸟Vue教程 - 实现带国际化的注册登陆页面
  • Mybatis ORDER BY 排序失效 ORDER BY 与 CASE WHEN THEN 排序问题
  • 日常BUG——微信小程序提交代码报错
  • 1048:有一门课不及格的学生
  • 数据结构——B-树、B+树、B*树
  • 2023国赛数学建模思路 - 案例:FPTree-频繁模式树算法
  • GPT系列总结
  • 【福建事业单位-综合基础知识】05民法典
  • 微服务篇
  • C++ 的关键字(保留字)完整介绍
  • C#小轮子:MiniExcel,快速操作Excel
  • Ribbon负载均衡
  • LeetCode--HOT100题(33)
  • 【docker练习】
  • 韦东山-电子量产工具项目:业务系统
  • React(6)
  • RabbitMq-2安装与配置
  • 论文笔记:Continuous Trajectory Generation Based on Two-Stage GAN
  • redis实战-缓存数据解决缓存与数据库数据一致性
  • 【排序】选择排序
  • 深入浅出Pytorch函数——torch.nn.init.trunc_normal_
  • 探索高级UI、源码解析与性能优化,了解开源框架及Flutter,助力Java和Kotlin筑基,揭秘NDK的魅力!
  • 国外服务器怎么有效降低延迟
  • AI百度文心一言大语言模型接入使用(中国版ChatGPT)
  • vue 安装并配置vuex
  • 有一种新型病毒在 3Ds Max 环境中传播,如何避免?
  • 基于Java/springboot铁路物流数据平台的设计与实现
  • 比较杂的html元素
  • Docker基本管理