20230403在WIN10下通过ffmpeg调用NVIDIA的硬件加速wmv视频转码为MP4格式

本文主要是介绍20230403在WIN10下通过ffmpeg调用NVIDIA的硬件加速wmv视频转码为MP4格式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

20230403在WIN10下通过ffmpeg调用NVIDIA的硬件加速wmv视频转码为MP4格式
2023/4/3 15:50


最近向学习日语,找到日语发音的视频中,大多数是MP4格式,少量是WMV格式,PR2023貌似不能识别WMV格式。
于是:万能的ffmpeg上场了!

 


手动指定编解码器
通过 ffmpeg -codecs | findstr "vc1" 查看 vc1 的编解码器
可以看到有 i卡 专用的 vc1_qsv 和 N卡 专用的 vc1_cuivid 解码器

加入参数-c:v来指定解码器:ffmpeg -c:v vc1_cuvid -i input2.wmv -c:v h264_nvenc output.mp4 (根据你的显卡选择对应的编解码器,我这里是 N卡 所以选择了 vc1_cuvid 作为解码器,h264_nvenc 作为编码器)

可以看到转码速度非常快,并且硬件编解码器也得到了充分的利用,CPU 占用也较低。


同样也是注意 nvenc 默认编码输出为 2000k 码率,可以手动设置码率来降低画质损失。


ffmpeg -c:v vc1_cuvid -i input2.wmv -c:v h264_nvenc output.mp4

C:\Users\Sun>cd G:\迅雷下载\三上悠亚(三上悠亜-Mikami Yua)\TEK-067

C:\Users\Sun>g:

G:\迅雷下载\三上悠亚(三上悠亜-Mikami Yua)\TEK-067>
G:\迅雷下载\三上悠亚(三上悠亜-Mikami Yua)\TEK-067>dir
 驱动器 G 中的卷是 18680688682
 卷的序列号是 2A59-69C0

 G:\迅雷下载\三上悠亚(三上悠亜-Mikami Yua)\TEK-067 的目录

2023/03/18  19:03    <DIR>          .
2023/03/18  19:03    <DIR>          ..
2023/03/18  19:03           137,393 TEK-067.jpg
2023/03/17  10:46     7,785,976,422 TEK-067.wmv
               2 个文件  7,786,113,815 字节
               2 个目录 133,153,181,696 可用字节

G:\迅雷下载\三上悠亚(三上悠亜-Mikami Yua)\TEK-067>ffmpeg -c:v vc1_cuvid -i TEK-067.wmv  -c:v h264_nvenc d:\2.mp4
ffmpeg version git-2020-06-28-4cfcfb3 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200621
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 55.100 / 56. 55.100
  libavcodec     58. 93.100 / 58. 93.100
  libavformat    58. 47.100 / 58. 47.100
  libavdevice    58. 11.100 / 58. 11.100
  libavfilter     7. 86.100 /  7. 86.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
  libpostproc    55.  8.100 / 55.  8.100
Input #0, asf, from 'TEK-067.wmv':
  Metadata:
    copyright       : MUTEKI
    DeviceConformanceTemplate: AP@L3
    WM/WMADRCPeakReference: 32767
    WM/WMADRCPeakTarget: 32767
    WM/WMADRCAverageReference: 3283
    WM/WMADRCAverageTarget: 3283
    artist          : MUTEKI
    IsVBR           : 0
    WMFSDKNeeded    : 0.0.0.0000
    WMFSDKVersion   : 12.0.7601.17514
  Duration: 02:56:19.69, start: 0.000000, bitrate: 5887 kb/s
    Stream #0:0(jpn): Audio: wmapro (b[1][0][0] / 0x0162), 44100 Hz, stereo, fltp, 256 kb/s
    Stream #0:1(jpn): Video: vc1 (Advanced) (WVC1 / 0x31435657), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 5744 kb/s, 29.97 tbr, 1k tbn, 59.94 tbc
Stream mapping:
  Stream #0:1 -> #0:0 (vc1 (vc1_cuvid) -> h264 (h264_nvenc))
  Stream #0:0 -> #0:1 (wmapro (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'd:\2.mp4':
  Metadata:
    copyright       : MUTEKI
    DeviceConformanceTemplate: AP@L3
    WM/WMADRCPeakReference: 32767
    WM/WMADRCPeakTarget: 32767
    WM/WMADRCAverageReference: 3283
    WM/WMADRCAverageTarget: 3283
    artist          : MUTEKI
    IsVBR           : 0
    WMFSDKNeeded    : 0.0.0.0000
    WMFSDKVersion   : 12.0.7601.17514
    encoder         : Lavf58.47.100
    Stream #0:0(jpn): Video: h264 (h264_nvenc) (Main) (avc1 / 0x31637661), nv12(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 29.97 fps, 30k tbn, 29.97 tbc
    Metadata:
      encoder         : Lavc58.93.100 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
    Stream #0:1(jpn): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      encoder         : Lavc58.93.100 aac
[aac @ 000001804f1195c0] Queue input is backward in time.94 bitrate=1954.7kbits/s speed=6.95x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 508373, current: 507900; changing to 508374. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.08 bitrate=2291.3kbits/s speed=7.56x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 2442202, current: 2441200; changing to 2442203. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.32 bitrate=2222.9kbits/s speed=8.25x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 9405416, current: 9403840; changing to 9405417. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 9405417, current: 9404864; changing to 9405418. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.36 bitrate=2137.0kbits/s speed=8.08x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 12993524, current: 12992477; changing to 12993525. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 12993525, current: 12993501; changing to 12993526. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.16 bitrate=2195.6kbits/s speed=7.77x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 30819293, current: 30818271; changing to 30819294. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.65 bitrate=2178.4kbits/s speed=7.88x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 39093227, current: 39092180; changing to 39093228. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 39093228, current: 39093204; changing to 39093229. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.19 bitrate=2189.7kbits/s speed= 7.9x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 40715225, current: 40714223; changing to 40715226. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.89 bitrate=2210.5kbits/s speed=6.41x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 84823029, current: 84821984; changing to 84823030. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 84823030, current: 84823008; changing to 84823031. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.48 bitrate=2189.7kbits/s speed=6.27x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93422573, current: 93421528; changing to 93422574. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93422574, current: 93422552; changing to 93422575. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.48 bitrate=2189.6kbits/s speed=6.27x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93619173, current: 93617597; changing to 93619174. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93619174, current: 93618621; changing to 93619175. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.35 bitrate=2188.6kbits/s speed=6.27x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93668344, current: 93666768; changing to 93668345. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93668345, current: 93667792; changing to 93668346. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.62 bitrate=2189.1kbits/s speed=6.26x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93897708, current: 93896662; changing to 93897709. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 93897709, current: 93897686; changing to 93897710. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.20 bitrate=2188.1kbits/s speed=6.26x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94405608, current: 94404605; changing to 94405609. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.54 bitrate=2186.4kbits/s speed=6.25x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94831589, current: 94830567; changing to 94831590. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.51 bitrate=2185.3kbits/s speed=6.25x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94946274, current: 94945271; changing to 94946275. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.58 bitrate=2185.2kbits/s speed=6.25x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94995445, current: 94994399; changing to 94995446. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 94995446, current: 94995423; changing to 94995447. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.39 bitrate=2183.1kbits/s speed=6.24x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 95241215, current: 95240168; changing to 95241216. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 95241216, current: 95241192; changing to 95241217. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time.76 bitrate=2193.1kbits/s speed=6.21x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 98436078, current: 98435037; changing to 98436079. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 98436079, current: 98436061; changing to 98436080. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time2.88 bitrate=2200.1kbits/s speed=7.11x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 215712746, current: 215711710; changing to 215712747. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 215712747, current: 215712734; changing to 215712748. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time1.08 bitrate=2196.4kbits/s speed=7.12x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 216945622, current: 216944614; changing to 216945623. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time6.74 bitrate=2197.6kbits/s speed=7.14x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 221201399, current: 221200352; changing to 221201400. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 221201400, current: 221201376; changing to 221201401. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time5.43 bitrate=2213.6kbits/s speed=7.43x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 316339164, current: 316338164; changing to 316339165. This may result in incorrect timestamps in the output file.
[aac @ 000001804f1195c0] Queue input is backward in time3.78 bitrate=2203.3kbits/s speed=7.44x
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 321651673, current: 321650141; changing to 321651674. This may result in incorrect timestamps in the output file.
[mp4 @ 000001804f5a3580] Non-monotonous DTS in output stream 0:1; previous: 321651674, current: 321651165; changing to 321651675. This may result in incorrect timestamps in the output file.
frame=317078 fps=229 q=24.0 Lsize= 2851835kB time=02:56:19.80 bitrate=2208.2kbits/s dup=6 drop=0 speed=7.64x
video:2677348kB audio:165245kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.325136%
[aac @ 000001804f1195c0] Qavg: 521.184

G:\迅雷下载\三上悠亚(三上悠亜-Mikami Yua)\TEK-067>

 

 

 


转码过程中,CPU和GPU的消耗都比较大,可能是我用的电脑比较古老/经典吧!

 

 


参考资料:
https://blog.csdn.net/ramondq/article/details/127803494
ffmpeg 硬件加速 wmv 视频转码
kotlean已于 2022-12-22 22:41:39 修改

这篇关于20230403在WIN10下通过ffmpeg调用NVIDIA的硬件加速wmv视频转码为MP4格式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/404797

相关文章

流媒体平台/视频监控/安防视频汇聚EasyCVR播放暂停后视频画面黑屏是什么原因?

视频智能分析/视频监控/安防监控综合管理系统EasyCVR视频汇聚融合平台,是TSINGSEE青犀视频垂直深耕音视频流媒体技术、AI智能技术领域的杰出成果。该平台以其强大的视频处理、汇聚与融合能力,在构建全栈视频监控系统中展现出了独特的优势。视频监控管理系统EasyCVR平台内置了强大的视频解码、转码、压缩等技术,能够处理多种视频流格式,并以多种格式(RTMP、RTSP、HTTP-FLV、WebS

综合安防管理平台LntonAIServer视频监控汇聚抖动检测算法优势

LntonAIServer视频质量诊断功能中的抖动检测是一个专门针对视频稳定性进行分析的功能。抖动通常是指视频帧之间的不必要运动,这种运动可能是由于摄像机的移动、传输中的错误或编解码问题导致的。抖动检测对于确保视频内容的平滑性和观看体验至关重要。 优势 1. 提高图像质量 - 清晰度提升:减少抖动,提高图像的清晰度和细节表现力,使得监控画面更加真实可信。 - 细节增强:在低光条件下,抖

如何在页面调用utility bar并传递参数至lwc组件

1.在app的utility item中添加lwc组件: 2.调用utility bar api的方式有两种: 方法一,通过lwc调用: import {LightningElement,api ,wire } from 'lwc';import { publish, MessageContext } from 'lightning/messageService';import Ca

webm怎么转换成mp4?这几种方法超多人在用!

webm怎么转换成mp4?WebM作为一种新兴的视频编码格式,近年来逐渐进入大众视野,其背后承载着诸多优势,但同时也伴随着不容忽视的局限性,首要挑战在于其兼容性边界,尽管WebM已广泛适应于众多网站与软件平台,但在特定应用环境或老旧设备上,其兼容难题依旧凸显,为用户体验带来不便,再者,WebM格式的非普适性也体现在编辑流程上,由于它并非行业内的通用标准,编辑过程中可能会遭遇格式不兼容的障碍,导致操

easyui同时验证账户格式和ajax是否存在

accountName: {validator: function (value, param) {if (!/^[a-zA-Z][a-zA-Z0-9_]{3,15}$/i.test(value)) {$.fn.validatebox.defaults.rules.accountName.message = '账户名称不合法(字母开头,允许4-16字节,允许字母数字下划线)';return fal

音视频入门基础:WAV专题(10)——FFmpeg源码中计算WAV音频文件每个packet的pts、dts的实现

一、引言 从文章《音视频入门基础:WAV专题(6)——通过FFprobe显示WAV音频文件每个数据包的信息》中我们可以知道,通过FFprobe命令可以打印WAV音频文件每个packet(也称为数据包或多媒体包)的信息,这些信息包含该packet的pts、dts: 打印出来的“pts”实际是AVPacket结构体中的成员变量pts,是以AVStream->time_base为单位的显

《x86汇编语言:从实模式到保护模式》视频来了

《x86汇编语言:从实模式到保护模式》视频来了 很多朋友留言,说我的专栏《x86汇编语言:从实模式到保护模式》写得很详细,还有的朋友希望我能写得更细,最好是覆盖全书的所有章节。 毕竟我不是作者,只有作者的解读才是最权威的。 当初我学习这本书的时候,只能靠自己摸索,网上搜不到什么好资源。 如果你正在学这本书或者汇编语言,那你有福气了。 本书作者李忠老师,以此书为蓝本,录制了全套视频。 试

【LabVIEW学习篇 - 21】:DLL与API的调用

文章目录 DLL与API调用DLLAPIDLL的调用 DLL与API调用 LabVIEW虽然已经足够强大,但不同的语言在不同领域都有着自己的优势,为了强强联合,LabVIEW提供了强大的外部程序接口能力,包括DLL、CIN(C语言接口)、ActiveX、.NET、MATLAB等等。通过DLL可以使用户很方便地调用C、C++、C#、VB等编程语言写的程序以及windows自带的大

SAM2POINT:以zero-shot且快速的方式将任何 3D 视频分割为视频

摘要 我们介绍 SAM2POINT,这是一种采用 Segment Anything Model 2 (SAM 2) 进行零样本和快速 3D 分割的初步探索。 SAM2POINT 将任何 3D 数据解释为一系列多向视频,并利用 SAM 2 进行 3D 空间分割,无需进一步训练或 2D-3D 投影。 我们的框架支持各种提示类型,包括 3D 点、框和掩模,并且可以泛化到不同的场景,例如 3D 对象、室

树莓派5_opencv笔记27:Opencv录制视频(无声音)

今日继续学习树莓派5 8G:(Raspberry Pi,简称RPi或RasPi)  本人所用树莓派5 装载的系统与版本如下:  版本可用命令 (lsb_release -a) 查询: Opencv 与 python 版本如下: 今天就水一篇文章,用树莓派摄像头,Opencv录制一段视频保存在指定目录... 文章提供测试代码讲解,整体代码贴出、测试效果图 目录 阶段一:录制一段