windows10|音视频剪辑|FFMPEG录屏和网络推流源初步的生成

前言:

FFMPEG的功能强大是毋庸置疑的,那么录屏的需求大家在某些时候大家可能是非常需要的,例如,现有的项目需要演示,因此录制一段演示视频;亦或者做内容分发直播的,比如游戏主播,需要录制在玩某个游戏的精彩片段,以创建一个后期的视频素材库;亦或者通过FFMPEG抓取摄像头的实时画面,满足某些人的疯狂的偷窥欲(友情提醒:大家还是需要做一个守法公民,不要看了我的文章然后去做坏事!!!!!);亦或者遇到了某些非常好听或者好看的视频,但无法保存,此时就需要录屏功能来弥补这些遗憾了;亦或者在服务器运维的时候,需要做运维审计工作等等录屏需求

而在FFMPEG面前,这些功能的实现通常都是一条简简单单的命令就可以完成了

Windows下ffmpeg录屏的主要方式是dshow(directshow)、vfwcap、gdigrab,其中dshow可以用来抓取摄像头、采集卡、麦克风等,vfwcap主要用来采集摄像头类设备,gdigrab则是抓取Windows窗口的程序。

下面将就如何录屏,如何确保录屏的质量以及网络推流的一些基本概念做一个简单的介绍

一,

电脑录屏和网络推流的概念

电脑录屏指的是在一定的时间内,录制电脑上的所有活动,比如,打开网页,播放视频,播放音乐等等动作,统统都记录,最后将这些实时产生的音视频数据流写入指定的文件,这些都是本地的活动,通常电脑端的录屏活动生成的本地文件是作为视频素材库使用的,也就是说后期还需要通过音视频剪辑工具按需裁剪,最后按需求分发到网络或者保留在本地自己欣赏

网络推流指的是通过特定软件比如利用摄像头实时捕捉音视频数据流,将这些数据主动推送到远程的指定的网络端,一般情况下,直播,实时摄像头这些最终都是网络推流,本地是不保存音视频数据的(后台本地有时候可能会保存,毕竟直播什么的有时候还需要一些审计,或者比如交通摄像头,事故发生的时候可能需要视频回溯)

网络推流和拉流需要一些相应的网络协议支持,比如rmtp协议,这里就不展开说了

二,

基本的录屏

这里说的基本录屏是指的Windows10,win7,或者win11 ,无需其它驱动,基于Windows操作系统的gdigrab直接录屏,但录制的只有视频,没有音频

无疑的,这样的方式是比较简单的,但缺点也是比较大的:没有声音,只能录制Windows内的整个桌面

命令如下:

fmpeg -f gdigrab -i desktop -f mp4 d:/out.mp4 -y

注意,这个命令生成的out.mp4文件可能Windows media可能打不开,需要使用vlc播放器播放

输出支持的格式也可以是wma,flv   按q退出录屏

一般不需要特别设置,比如视频的比特率什么的,直接默认就可以了,在现在的硬件条件下,清晰度基本可以满足,录屏主要是CPU运算

注意:经过实践,在本次实验中,mp4格式的视频清晰度最高,效果最好

ffmpeg -f gdigrab -i desktop  d:/out.flv -y
ffmpeg -f gdigrab -i desktop  d:/out.wma -y

🆗,这个基本录屏只能录制视频,有点不太能满足需求,比如翻录某些视频的情况下,下面就来一个进阶录屏:可以同时录制高清视频和高清音频

三,

高清音视频录制

此种方式需要安装虚拟屏幕驱动并启用声卡录音功能,主要是基于dshow驱动来进行的

常用的驱动如UScreenCapture,screen-capture-recorder

本例中使用screen-capture-recorder,该驱动程序下载地址:http://sourceforge.net/projects/screencapturer/files/

###注意,该驱动更新频率比较低,直接选择最新版本就可以了,本例使用的是Setup Screen Capturer Recorder v0.12.11

此程序默认安装就可以了,安装完毕后,会有一个新的FFMPEG,这个FFMPEG版本是比较低的,但后面的录屏还只能用这个低版本的FFMPEG,高版本的FFMPEG好像用不了:

查询dshow驱动执行情况: 

ffmpeg -list_devices true -f dshow -i dummy

旧新版本的FFMPEG查询现在支持的录屏驱动,新的FFMPEG可能是不支持的,现在暂时还没有办法(第一个命令是旧版FFMPEG,第二个命令是新版FFMPEG):

C:\Users\Administrator>"C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -list_devices true -f dshow -i dummy
ffmpeg version N-44080-gdfb4757 Copyright (c) 2000-2012 the FFmpeg developersbuilt on Aug 31 2012 16:58:51 with gcc 4.7.1 (GCC)configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zliblibavutil      51. 70.100 / 51. 70.100libavcodec     54. 55.100 / 54. 55.100libavformat    54. 25.104 / 54. 25.104libavdevice    54.  2.100 / 54.  2.100libavfilter     3. 15.101 /  3. 15.101libswscale      2.  1.101 /  2.  1.101libswresample   0. 15.100 /  0. 15.100libpostproc    52.  0.100 / 52.  0.100
[dshow @ 0292bc80] DirectShow video devices
[dshow @ 0292bc80]  "screen-capture-recorder"
[dshow @ 0292bc80] DirectShow audio devices
[dshow @ 0292bc80]  "楹﹀厠椋?(Realtek(R) Audio)"
[dshow @ 0292bc80]  "virtual-audio-capturer"
[dshow @ 0292bc80]  "绔嬩綋澹版贩闊?(Realtek(R) Audio)"
dummy: Immediate exit requestedC:\Users\Administrator>ffmpeg -list_devices true -f dshow -i dummy
ffmpeg version 6.1.1-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developersbuilt with gcc 12.2.0 (Rev10, Built by MSYS2 project)configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable-d3d11va --enable-libvpl --enable-libshaderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libcodec2 --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprintlibavutil      58. 29.100 / 58. 29.100libavcodec     60. 31.102 / 60. 31.102libavformat    60. 16.100 / 60. 16.100libavdevice    60.  3.100 / 60.  3.100libavfilter     9. 12.100 /  9. 12.100libswscale      7.  5.100 /  7.  5.100libswresample   4. 12.100 /  4. 12.100libpostproc    57.  3.100 / 57.  3.100
[dshow @ 000001d0b92ba200] "UScreenCapture" (video)
[dshow @ 000001d0b92ba200]   Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\UScreenCapture"
[dshow @ 000001d0b92ba200] "screen-capture-recorder" (video)
[dshow @ 000001d0b92ba200]   Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\{4EA69364-2C8A-4AE6-A561-56E4B5044439}"
[dshow @ 000001d0b92ba200] "麦克风 (Realtek(R) Audio)" (audio)
[dshow @ 000001d0b92ba200]   Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{9A0CE0E2-9E7D-4F81-857D-CF4BA1D888E3}"
[dshow @ 000001d0b92ba200] "virtual-audio-capturer" (audio)
[dshow @ 000001d0b92ba200]   Alternative name "@device_sw_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\{8E146464-DB61-4309-AFA1-3578E927E935}"
[dshow @ 000001d0b92ba200] "立体声混音 (Realtek(R) Audio)" (audio)
[dshow @ 000001d0b92ba200]   Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{E3B2D1FC-6202-4AFE-AC1C-2BD8DD95EB72}"
[in#0 @ 000001d0b92ba080] Error opening input: Immediate exit requested
Error opening input file dummy.

Setup Screen Capturer Recorder v0.12.11安装完毕后,不需要重启服务器,立刻就生效了

这个时候还需要安装Java环境,jdk下载地址:https://www.java.com/en/download/  ,如何安装jdk就不用说了,有手就可以安装了,没办法jdk是Setup Screen Capturer Recorder v0.12.11的强依赖

还需要打开Windows的录制功能:

🆗,现在可以开始录制带音频的录屏文件了:

"C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -f dshow -rtbufsize 1202000k    -i video="screen-capture-recorder":audio="virtual-audio-capturer" -sameq  -ar 22050 d:\out1.flv -y
"C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -f dshow -rtbufsize 1202000k    -i video="screen-capture-recorder":audio="virtual-audio-capturer" -sameq  -ar 22050 d:\out1.wma -y

指定输出格式为mp4的时候报错了,报错如下:

看样子mp4编码转码的时候失败了,也就是说该驱动不支持mp4,或者和操作系统有关吧???

C:\Users\Administrator>"C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -f dshow -rtbufsize 1202000k    -i video="screen-capture-recorder":audio="virtual-audio-capturer" -sameq  -ar 22050 -f mp4 d:\out1.mp4 -y
ffmpeg version N-44080-gdfb4757 Copyright (c) 2000-2012 the FFmpeg developersbuilt on Aug 31 2012 16:58:51 with gcc 4.7.1 (GCC)configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zliblibavutil      51. 70.100 / 51. 70.100libavcodec     54. 55.100 / 54. 55.100libavformat    54. 25.104 / 54. 25.104libavdevice    54.  2.100 / 54.  2.100libavfilter     3. 15.101 /  3. 15.101libswscale      2.  1.101 /  2.  1.101libswresample   0. 15.100 /  0. 15.100libpostproc    52.  0.100 / 52.  0.100
leaving aero on[dshow @ 029cbe40] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, dshow, from 'video=screen-capture-recorder:audio=virtual-audio-capturer':Duration: N/A, start: 30738.314000, bitrate: 1536 kb/sStream #0:0: Video: rawvideo, bgra, 2560x1440, 30 tbr, 10000k tbn, 30 tbcStream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[libx264 @ 04065b40] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2 AVX AVX2 FMA3 BMI1 BMI2
[libx264 @ 04065b40] profile High, level 5.0
[libx264 @ 04065b40] 264 - core 125 r2208 d9d2288 - H.264/MPEG-4 AVC codec - Copyleft 2003-2012 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=24 lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'd:\out1.mp4':Metadata:encoder         : Lavf54.25.104Stream #0:0: Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 2560x1440, q=-1--1, 10000k tbn, 30 tbcStream #0:1: Audio: aac ([64][0][0][0] / 0x0040), 22050 Hz, stereo, s16, 128 kb/s
Stream mapping:Stream #0:0 -> #0:0 (rawvideo -> libx264)Stream #0:1 -> #0:1 (pcm_s16le -> libvo_aacenc)
Press [q] to stop, [?] for help
x264 [error]: malloc of size 15786496 failedime=00:00:27.74 bitrate= 109.3kbits/s dup=3 drop=0
Video encoding failed
Received stop event after 2795 passes

换成flv格式的输出文件,第二次在执行录屏的时候报错了:

[dshow @ 02a2be40] real-time buffer 100% full! frame dropped!

这个报错说的是buffer溢出了,根本原因是输出的文件里有内容了,录制的视频不知道如何把数据流写到文件的哪个位置了,很简单,换一个输出文件名或者把原来的输出文件删除就可以继续录制了

C:\Users\Administrator>"C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -f dshow -rtbufsize 1202000k    -i video="screen-capture-recorder":audio="virtual-audio-capturer" -sameq  -ar 22050 -vol 200 d:\out1.flv -y
ffmpeg version N-44080-gdfb4757 Copyright (c) 2000-2012 the FFmpeg developersbuilt on Aug 31 2012 16:58:51 with gcc 4.7.1 (GCC)configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zliblibavutil      51. 70.100 / 51. 70.100libavcodec     54. 55.100 / 54. 55.100libavformat    54. 25.104 / 54. 25.104libavdevice    54.  2.100 / 54.  2.100libavfilter     3. 15.101 /  3. 15.101libswscale      2.  1.101 /  2.  1.101libswresample   0. 15.100 /  0. 15.100libpostproc    52.  0.100 / 52.  0.100
leaving aero on[dshow @ 02a2be40] Estimating duration from bitrate, this may be inaccurate
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, dshow, from 'video=screen-capture-recorder:audio=virtual-audio-capturer':Duration: N/A, start: 31001.957000, bitrate: 1536 kb/sStream #0:0: Video: rawvideo, bgra, 2560x1440, 30 tbr, 10000k tbn, 30 tbcStream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
File 'd:\out1.flv' already exists. Overwrite ? [y/N] real-time buffer 63% full! frame dropped!
[dshow @ 02a2be40] real-time buffer 66% full! frame dropped!
[dshow @ 02a2be40] real-time buffer 68% full! frame dropped!
[dshow @ 02a2be40] real-time buffer 71% full! frame dropped!
[dshow @ 02a2be40] real-time buffer 73% full! frame dropped!
[dshow @ 02a2be40] real-time buffer 76% full! frame dropped!Last message repeated 1 times
[dshow @ 02a2be40] real-time buffer 78% full! frame dropped!Last message repeated 1 times
[dshow @ 02a2be40] real-time buffer 80% full! frame dropped!Last message repeated 19 times
[dshow @ 02a2be40] real-time buffer 83% full! frame dropped!Last message repeated 1 times
[dshow @ 02a2be40] real-time buffer 85% full! frame dropped!Last message repeated 1 times
[dshow @ 02a2be40] real-time buffer 88% full! frame dropped!Last message repeated 2 times
[dshow @ 02a2be40] real-time buffer 90% full! frame dropped!Last message repeated 2 times
[dshow @ 02a2be40] real-time buffer 93% full! frame dropped!Last message repeated 2 times
[dshow @ 02a2be40] real-time buffer 95% full! frame dropped!Last message repeated 32 times
[dshow @ 02a2be40] real-time buffer 98% full! frame dropped!Last message repeated 2 times
[dshow @ 02a2be40] real-time buffer 100% full! frame dropped!

录制好的视频播放后,可以看到确实录制到声音了,我的QQ音乐播放的歌曲完全录制进视频内了,开心…………^……^

那么,到这里就很清楚了,如果只需要录制视频,那就把audio="virtual-audio-capturer"这一段删除,反之亦然!!!!!

上面的录屏参数说明:

  • -f dshow 指定输入的数据流使用dshow驱动
  • -rtbufsize 1202000k 录制时的最大缓存使用量
  • -i video="screen-capture-recorder":audio="virtual-audio-capturer" 从哪抓取数据流,这里指定了具体执行动作的驱动
  • -sameq  -ar 22050  如果是flv输出的话,不使用此参数会报错[flv @ 0295caa0] flv does not support that sample rate, choose from (44100, 22050, 11025),因此,我选择了22050,这三个数【44100, 22050, 11025】里面选择一个就可以了
  •  -vol 200 这里是调节声音大小,如果电脑内的声音本身比较小,放大两倍
  • -s 1940*1440  这里是设置录屏的大小,以及-v 15(帧率)等等,等同于-video_size 1280x720注意注意,这些录屏属性设置需要放在命令的后面,最好是在输出文件之前  例如这样:
  • "C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -f dshow -rtbufsize 1202000k    -i video="screen-capture-recorder":audio="virtual-audio-capturer" -sameq  -ar 22050 -vol 200 -s 1920*1440  d:\out1.flv -y

  • -preset ultrafast  视频非常清晰,但文件会很大(这个效果真的非常nice,但我录制了20分钟的游戏视频竟然有7.5G大小)

  • 但这样的参数位置将会报错,需要特别注意哦:

C:\Users\Administrator>"C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -f dshow -rtbufsize 1202000k    -ar 22050 -i video="screen-capture-recorder":audio="virtual-audio-capturer" -sameq   -vol 200 -s 1920*1440  d:\out1.flv -y
ffmpeg version N-44080-gdfb4757 Copyright (c) 2000-2012 the FFmpeg developersbuilt on Aug 31 2012 16:58:51 with gcc 4.7.1 (GCC)configuration: --enable-gpl --enable-version3 --disable-pthreads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zliblibavutil      51. 70.100 / 51. 70.100libavcodec     54. 55.100 / 54. 55.100libavformat    54. 25.104 / 54. 25.104libavdevice    54.  2.100 / 54.  2.100libavfilter     3. 15.101 /  3. 15.101libswscale      2.  1.101 /  2.  1.101libswresample   0. 15.100 /  0. 15.100libpostproc    52.  0.100 / 52.  0.100
leaving aero on[dshow @ 0286bf20] Could not set audio options
video=screen-capture-recorder:audio=virtual-audio-capturer: Input/output error

再次强调,参数位置问题,音视频属性参数一定要在-i 的后面,下面是一个完整的例子

"C:\Program Files (x86)\Screen Capturer Recorder\configuration_setup_utility\vendor\ffmpeg\bin\ffmpeg.exe" -f dshow -rtbufsize 1202000k    -i video="screen-capture-recorder":audio="virtual-audio-capturer" -sameq     -ar 22050 -vol 200 -preset ultrafast -s 1980*1440 d:\out1.flv  -y

顺便说一句,音视频剪辑对于硬件也就是cpu和内存的性能要求比较高,至少i7 13代+32G内存吧

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

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

相关文章

人力资源智能化管理项目(day07:员工详情)

学习源码可以看我的个人前端学习笔记 (github.com):qdxzw/humanResourceIntelligentManagementProject 页面结构和路由 <template><div class"dashboard-container"><div class"app-container"><div class"edit-form">…

使用python给程序添加授权码,设置授权时间、撤销授权和管理授权

文章目录 引言思路1思路2思路3客户端逻辑注册机逻辑服务器逻辑源码引言 有很多同学在开发程序的同时想要保护自己的源码不被他人窃取,这时候给程序添加授权就显得非常有必要了,下面主要分三块来讲述下如何开发,可以直接嵌入在你的程序中。 思路1 软件授权方案大概分成两个…

【实战】一、Jest 前端自动化测试框架基础入门(三) —— 前端要学的测试课 从Jest入门到TDD BDD双实战(三)

文章目录 一、Jest 前端自动化测试框架基础入门7.异步代码的测试方法8.Jest 中的钩子函数9.钩子函数的作用域 学习内容来源&#xff1a;Jest入门到TDD/BDD双实战_前端要学的测试课 相对原教程&#xff0c;我在学习开始时&#xff08;2023.08&#xff09;采用的是当前最新版本&a…

python 通过ssh增量同步文件夹

要通过 SSH 使用 Python 进行文件夹的增量同步&#xff0c;你可以使用 paramiko 库来创建 SSH 连接并执行文件传输操作。paramiko 是一个 Python 实现的 SSHv2 协议库&#xff0c;可以用于进行 SSH 连接、文件传输等任务。 以下是一个简单的示例&#xff0c;展示如何使用 para…

ES实战-高级聚合

多桶型聚合 1.词条聚合–terms 2.范围聚合–range 3,直方图聚合–histogram 4.嵌套聚合 5.地理距离聚合 include(包含)exclude(不包含) GET /get-together/_search?pretty {"size": 0,"aggs": {"tags": {"terms": {"field"…

【教3妹学编程-算法题】捕获黑皇后需要的最少移动次数

3妹&#xff1a;2哥&#xff0c;新年好鸭~ 2哥 : 新年好&#xff0c;3妹这么早啊 3妹&#xff1a;是啊&#xff0c;新年第一天要起早&#xff0c;这样就可以起早一整年 2哥 :得&#xff0c;我还不了解你&#xff0c;每天晒到日上三竿 3妹&#xff1a;嘿嘿嘿嘿&#xff0c;一年是…

LeetCode、901. 股票价格跨度【中等,单调栈】

文章目录 前言LeetCode、901. 股票价格跨度【中等&#xff0c;单调栈】题目链接及分类思路思路1&#xff1a;暴力思路2&#xff1a;单调栈写法优化&#xff1a;单调栈简化写法(数组替代栈集合) 资料获取 前言 博主介绍&#xff1a;✌目前全网粉丝2W&#xff0c;csdn博客专家、…

别人卖了 2W 的一套 ChatGPT 自动身份提示词!

别人卖了 2W 的一套 ChatGPT 自动身份提示词! 英文版 You are an Expert level ChatGPT Prompt Engineer with expertise in various subject matters. Throughout our interaction, you will refer to me as (your name). Lets collaborate to create the best possible Cha…

深度学习-吴恩达L1W2作业

作业1&#xff1a;吴恩达《深度学习》L1W2作业1 - Heywhale.com 作业2&#xff1a;吴恩达《深度学习》L1W2作业2 - Heywhale.com 作业1 你需要记住的内容&#xff1a; -np.exp&#xff08;x&#xff09;适用于任何np.array x并将指数函数应用于每个坐标 -sigmoid函数及其梯度…

springboot180基于spring boot的医院挂号就诊系统

医院挂号就诊系统设计与实现 摘 要 传统办法管理信息首先需要花费的时间比较多&#xff0c;其次数据出错率比较高&#xff0c;而且对错误的数据进行更改也比较困难&#xff0c;最后&#xff0c;检索数据费事费力。因此&#xff0c;在计算机上安装医院挂号就诊系统软件来发挥其…

Excel练习:折线图突出最大最小值

Excel练习&#xff1a;折线图突出最大最小值 ​​ 要点&#xff1a;NA值在折现图中不会被绘制&#xff0c;看似一条线&#xff0c;实际是三条线。换成0值和""都不行。 ‍ 查看所有已分享Excel文件-阿里云 ‍ 学习的这个视频&#xff1a;Excel折线图&#xff0c…

使用文件读取的open 函数,让你的csv pandas 尾部插入快如闪电

文章目录 简介1. pandas loc 尾部插入方法loc 尾部插入的速度 2. open 方法open方法 处理csv的速度open方法 处理csv代码 简介 笔者在处理稍大型(几十万条)的csv文件时&#xff0c;发现在csv文件中&#xff0c;使用panda的loc方法进行拼接&#xff0c;速度太过于缓慢。 笔者提…

盐值1111

盐值处理简介 1.1 定义与概述 "盐值"是一个术语&#xff0c;通常在密码哈希中使用。当存储或传输密码时&#xff0c;系统不会&#xff08;或不应&#xff09;直接存储或传输用户的明文密码。相反&#xff0c;会通过哈希函数将密码转换成哈希值。问题在于&#xff0…

【面试】国家公务员考试复试,面试内容准备方向(非技术面试考察点)

【面试】国家公务员考试复试&#xff0c;面试内容准备方向&#xff08;非技术面试考察点&#xff09; 说明&#xff1a; csdn无法发部分考试相关例题&#xff08;提示涉z&#xff09;&#xff0c;所以本文主要还是针对评分标准和仪表等相关因素。 文章目录 1、面试试卷与评分1.…

前端架构: 实现脚手架处理简单的命令注册和参数解析

实现简单的命令注册和参数解析 1 &#xff09;概述 这里不会使用任何第三方工具&#xff0c;而是给大家讲解一下参数解析的一个实现原理实现两个目标 第一目标是注册一个命令 $ xyzcli init 这个命令就可以完成一个自己的操作第二个是实现参数解析 希望能够实现 --version 的一…

春节专题|产业7问:区块链厂商的现在和未来——基础设施厂商

2023转瞬即逝&#xff0c;不同于加密领域沉寂一整年后在年末集中爆发&#xff0c;对于我国的区块链厂商而言&#xff0c;稳中求胜才是关键词&#xff0c;在平稳发展的基调下&#xff0c;产业洗牌也悄无声息的到来。 从产业总体而言&#xff0c;在经过了接近3年的快速发展后&…

C语言系列1——详解C语言:变量、常量与数据类型

目录 写在开始1. 变量与常量的概念1.1. 变量1.2. 常量1.3. 变量与常量的比较1.4. 选择变量还是常量 2. C语言中的基本数据类型2.1. 整型&#xff08;Integer Types&#xff09;2.2. 浮点型&#xff08;Floating-Point Types&#xff09;2.3. 字符型&#xff08;Character Type&…

android studio下开发flutter

文章目录 1. 配置环境 https://flutter.cn/docs/get-started/install2. android studio下开发flutter 1. 配置环境 https://flutter.cn/docs/get-started/install 2. android studio下开发flutter 打开Android Studio -> File -> Settings -> Plugins 搜索Dart插件 …

Linux和Windows文件共享实现方式

安装 samba 服务 sudo apt-get install samba samba-common新增用户 groupadd sfp -g 6000 useradd sfp -u 6000 -g 6000 -s /sbin/nologin -d /dev/null设置密码 sudo smbpasswd -a sfp修改配置文件 sudo vi /etc/samba/smb.conf追加参数 [file]comment sfpfile #说明…

C++ 动态规划 计数类DP 整数划分

一个正整数 n 可以表示成若干个正整数之和&#xff0c;形如&#xff1a;nn1n2…nk &#xff0c;其中 n1≥n2≥…≥nk,k≥1 。 我们将这样的一种表示称为正整数 n 的一种划分。 现在给定一个正整数 n &#xff0c;请你求出 n 共有多少种不同的划分方法。 输入格式 共一行&…