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

news2024/11/19 16:24:31

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 修改

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/418960.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

使用GPT-4生成QT代码

一、概述最近ChatGPT火爆起来了&#xff0c;ChatGPT是一种基于GPT的自然语言处理模型&#xff0c;可以用于生成自然语言文本&#xff0c;例如对话、文章等。最近又发现了一个优秀且免费的代码生成工具Cursor &#xff0c;Cursor集成了 GPT-4 &#xff0c;可以帮助你快速编写、编…

动态规划:状态机DP和买卖股票问题【零神基础精讲】

买卖股票的最佳时机&#xff1a;无限次/冷冻期/k次【基础算法精讲 21】 来自0x3f&#xff1a;https://www.bilibili.com/video/BV1ho4y1W7QK/ 介绍了【买卖股票系列问题】与【状态机 DP】&#xff0c;包括【至多/恰好/至少】的讲解。 文章目录买卖股票问题和状态机DP(无限次)[1…

【CocosCreator入门】CocosCreator组件 | DragonBones(骨骼动画)组件

Cocos Creator 是一款流行的游戏开发引擎&#xff0c;具有丰富的组件和工具&#xff0c;其中DragonBones&#xff0c;它可以帮助您创建出色的2D骨骼动画。在本文中&#xff0c;我们将探讨CocosCreator引擎的DragonBones组件&#xff0c;以及如何使用它来创建精美的动画。 目录 …

VisualGC插件使用

下载安装VisualVM 下载地址&#xff1a;Visual VM mac系统选择macOS Application Bundle&#xff0c;下载完成后&#xff0c;双击dmg包安装即可&#xff0c;之后双击启动。 安装Visual GC 插件 点击菜单栏Tools&#xff0c;选择Pulgins&#xff0c;在第二个选项中找到Visua…

【CSS】更改用户界面样式 ③ ( 取消文本域拖拽 | 代码示例 )

文章目录一、取消文本域拖拽二、文本域拖拽示例三、取消文本域拖拽示例一、取消文本域拖拽 textarea 文本域 在 默认状态下是可以进行拖拽的 , 在网页布局中 , 一般不会允许这种情况发生 , 任意拖拽文本域会影响网页的整体布局 ; 设置文本域不可拖拽样式 : resize: none;文本…

windows编程(4) - GDI绘图基础

基础概念 GDI&#xff1a;Graphic Device Interface 图形设备接口。GUI&#xff1a;Graphic User Interface 图形用户接口。HDC&#xff1a;Handle of Device Context&#xff1a; 图形设备上下文句柄。 字符界面的基本单位是字符。 图形界面的基本单位是像素。 像素&#…

从数据展示中汉字缺失了解字符编码知识

有人在使用皕杰报表时遇到如下问题&#xff1a; 有些汉字变成了“&#xff1f;”&#xff0c;这是为什么呢&#xff1f;实际上就是你用的字符集里没有这个汉字导致的&#xff0c;要想搞懂这个问题&#xff0c;还得从字符、字符集、字符编码说起。 所谓字符&#xff0c;就是各…

定时任务练习----Linux 定时发送邮件 ( QQ 邮箱 为例)

邮件设置 &#xff1a; 在 QQ 邮箱的最上面 &#xff0c;点击设置。 在账户 这一栏&#xff0c;往下面走 找POP3 开头的栏目 在 POP3/SMTP 服务这一行&#xff0c;点击开启 &#xff08; 本身是 关闭状态 &#xff09; 关于 POP3 和 SMTP 服务需要做以说明 ; >>> 我…

技术管理笔记1

看点杂篇&#xff0c;整理下笔记&#xff1a; 目录&#xff1a; 1技术的本质 2 技术团队管理的本质 3 技术管理者的能力要求 4 技术管理者风格类型 5 实战案例分析&#xff1a; 一技术的本质 技术存在感低&#xff0c;缺乏话语权&#xff0c;以业务导向为主。 二 技术团…

Spring Cloud第二季--OpenFeign和Feign

文章目录一、Feign二、Feign和OpenFeign的区别三、案例测试1、eureka注册中心集群7001/70022、两个微服务3、OpenFeign一、Feign Spring Cloud Feign的介绍在Spring Cloud学习–声明式调用&#xff08;Feign&#xff09;中详细介绍。 简单回顾下&#xff0c;Feign是一个声明式…

UTF-8(Unicode Transformation Format)

文章目录一、Unicode示例代码&#xff1a;二、网络传输与Unicode三、UTF-8如何编码四、使用UTF-8转换传输Unicode五、利用Java-API进行UTF8编码和解码六、利用代码输出Unicode编码和UTF8编码七、手写UTF8编码、解码八、总结UTF8一、Unicode 示例代码&#xff1a; package demo…

【Ubuntu安装选项】

关于Ubuntu系统安装选项 [TOC](关于Ubuntu系统安装选项) 安装选项选择 一、*Try or Install Ubuntu 二、Ubunru (safe graphics) 三、OEM install &#xff08;for manufacturers&#xff09; 四、Test memory 总结 安装选项选择 在安装Ubuntu系统时会有四个选项&#xff0c;搜…

模型部署学习--有三AI(视频要收费So没学完)

视频地址&#xff1a;深度学习之模型部署 模型的整个使用流程 从模型训练到部署 一 部署平台选择&#xff1a; 1、在线服务器端部署&#xff0c;精度优先&#xff1a; 大模型/分布式&#xff08;如千亿级参数模型GPT-3&#xff09; 延迟不敏感&#xff08;如以图搜图应用&am…

chatgpt批量写作-chatgpt批量生成文章

cchatgpt写作 ChatGPT是一种基于Transformer架构的自然语言处理技术&#xff0c;它可以用于文本生成和对话场景&#xff0c;可以辅助写作、创作等任务。以下是一些使用ChatGPT进行写作的方法和技巧&#xff1a; Fine-tuning预训练模型&#xff1a;ChatGPT模型预训练时需要大量…

数字孪生卫星:概念、关键技术及应用

源自&#xff1a;软件定义世界 摘 要 在分析卫星产业发展趋势与升级转型新需求后&#xff0c;为推动卫星与新技术融合发展&#xff0c;提升大型卫星工程的整体管理水平与流程管控能力&#xff0c;促进卫星产业数字化、网络化、智能化、服务化转型升级&#xff0c;将数字孪生技…

百度天工AIoT设备应用使能平台助力企业低成本开发

数字中国建设的顶层文件《数字中国建设整体布局规划》&#xff08;以下简称《规划》&#xff09;于近日印发&#xff0c;作为数字中国建设的重要基础&#xff0c;《规划》指出&#xff0c;要全面赋能经济社会发展&#xff0c;推动数字技术和实体经济的深度融合&#xff0c;产业…

C++语法(15)---- 继承

C语法&#xff08;14&#xff09;---- 模板进阶_哈里沃克的博客-CSDN博客https://blog.csdn.net/m0_63488627/article/details/130092939?spm1001.2014.3001.5501 目录 1.继承概念和定义 1.概念 2.定义 1.格式 2. 继承关系和访问限定符 2.基类和派生类对象赋值转换 3.…

ERTEC200P-2 PROFINET设备完全开发手册(5-2)

5.2 TIA 数据记录操作 在PLC的程序中&#xff0c;可以通过指令RDREC和WRREC读写数据记录&#xff0c;在参考代码里可以看到读写操作都实现了index 2的记录数据&#xff0c;并且初始化为&#xff1a; #define DEMO_RECORD "ABCDEFGH" 首先定义要写入和读出的数据…

【LeetCode】剑指 Offer(26)

目录 题目&#xff1a;剑指 Offer 51. 数组中的逆序对 - 力扣&#xff08;Leetcode&#xff09; 题目的接口&#xff1a; 解题思路&#xff1a; 代码&#xff1a; 过啦&#xff01;&#xff01;&#xff01; 写在最后&#xff1a; 题目&#xff1a;剑指 Offer 51. 数组中…

数据库MySQL —— 锁

目录 一、概述 二、全局锁 三、表级锁 1. 表锁 2. 元数据锁 3. 意向锁 四、行级锁 1. 行锁 2. 间隙锁 / 临键锁 一、概述 锁 是计算机协调多个进程或线程并发访问某一资源的机制。在数据库中&#xff0c;除传统的计算资源&#xff08;CPU、RAM、I/O)的争用以外&…