惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
V
Vulnerabilities – Threatpost
Google Online Security Blog
Google Online Security Blog
Hugging Face - Blog
Hugging Face - Blog
L
LINUX DO - 热门话题
云风的 BLOG
云风的 BLOG
P
Proofpoint News Feed
D
Docker
C
Cyber Attacks, Cyber Crime and Cyber Security
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
T
Tenable Blog
P
Privacy International News Feed
Google DeepMind News
Google DeepMind News
小众软件
小众软件
Cisco Talos Blog
Cisco Talos Blog
aimingoo的专栏
aimingoo的专栏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
A
Arctic Wolf
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
T
Threat Research - Cisco Blogs
NISL@THU
NISL@THU
The Hacker News
The Hacker News
Project Zero
Project Zero
AWS News Blog
AWS News Blog
Simon Willison's Weblog
Simon Willison's Weblog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
T
Threatpost
V
Visual Studio Blog
The GitHub Blog
The GitHub Blog
The Cloudflare Blog
Last Week in AI
Last Week in AI
Jina AI
Jina AI
Cyberwarzone
Cyberwarzone
The Register - Security
The Register - Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
Vercel News
Vercel News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
MongoDB | Blog
MongoDB | Blog
U
Unit 42
Scott Helme
Scott Helme
A
About on SuperTechFans
WordPress大学
WordPress大学
F
Fortinet All Blogs
大猫的无限游戏
大猫的无限游戏
G
GRAHAM CLULEY
Latest news
Latest news
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
S
Schneier on Security

博客园 - yeren2046

RedCoins,一个免费的类似bluecoins的个人财务管理软件 记录一个栈溢出导致的崩溃问题 一个免费的图片数据标注工具 常用zip命令 git版本导致的"Permission denied (publickey). fatal: Could not read from remote repository." 只显示全部特定进程名的top信息的shell脚本 linux 上用 core 文件定位线上问题 ffmpeg 时基转换 昇腾卡通道号范围 ffmpeg视频截取 英伟达硬解码错误汇总 DVPP问题汇总 TensorRT生成INT8校准文件 结构体指定初始化 C++11 获取当前时间戳 基于CUDA查询显卡型号和显存大小 nvjpeg 简单使用 AV_PIX_FMT_CUDA 数据转 RGB C++ do{ } while(0)
ffmpeg命令行基于英伟达显卡编解码的转码
yeren2046 · 2022-09-28 · via 博客园 - yeren2046

1. 支持性

进行转码前,需要确认所用显卡是否支持源格式的解码和目标格式的编码。

英伟达显卡编解码的格式支持性查看网址: Video Encode and Decode GPU Support Matrix

2. ffmpeg转码命令:

./ffmpeg -vsync 0 -hwaccel cuvid -hwaccel_device 1 -c:v h264_cuvid -i /home/cmhu/data/input.mp4 \
-c:a copy -vf scale_npp=800:480 -c:v h264_nvenc /home/cmhu/data/output_800x480.mp4 \
-c:a copy -vf scale_npp=1024:534 -c:v h264_nvenc /home/cmhu/data/output_1024x534.mp4 \
-c:a copy -vf scale_npp=1280:720 -c:v h264_nvenc /home/cmhu/data/output_1280x720.mp4

最多支持同时转3路,超过3路会报以下错误

[h264_nvenc @ 0x564823cf57c0] OpenEncodeSessionEx failed: out of memory (10)
Error initializing output stream 3:0 -- Error while opening encoder for output stream #3:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!

原因是英伟达显卡编码器被设定了最多同时进行三路编码,如何突破限制可以参考 突破NVIDIA NVENC并发Session数目限制 (本人未尝试过,不对此博客有效性做保证,只是感觉应该有效)

命令行解释

(1) -hwaccel cuvid

没有 -hwaccel cuvid 选项,解码后的原始帧将通过 PCIe 总线复制回系统内存,然后又通过 PCIe 复制回 GPU 内存,以便在 GPU 上进行编码。这两个额外的传输由于传输时间而造成延迟,并将增加 PCIe 带宽占用。

添加该项后,解码后的数据不再拷贝到内存中,直接在显卡中进入编码,没有数据在内存和显存之间的拷贝过程(这相当费时间)

(2)-hwaccel_device 1

指定所用的GPU

更多的解释可以参见 NVIDIA FFmpeg 转码指南