ffmpeg录屏原理(windows 10 使用ffmpeg录屏和录音)

您所在的位置:网站首页 ffmpeg录制屏幕 ffmpeg录屏原理(windows 10 使用ffmpeg录屏和录音)

ffmpeg录屏原理(windows 10 使用ffmpeg录屏和录音)

2022-09-29 21:02| 来源: 网络整理| 查看: 265

1. 下载7z2107-x64.exe, 双击安装

https://www.7-zip.org

2. 下载 ffmpeg-4.4.1-full_build.7z,用7z解压得到exe文件,无需安装

https://www.gyan.dev/ffmpeg/builds/

3. 下载Setup Screen Capturer Recorder v0.12.11.exe,双击安装

https://sourceforge.net/projects/screencapturer/

4. cd到解压的ffmpeg的bin文件夹,查看版本号:

ffmpeg -version

5. 检查可用的设备

ffmpeg -list_devices true -f dshow -i dummy

因为安装了Screen Capturer Recorder,我们会看到virtual-audio-capturer 和 screen-capture-recorder 两个设备。

6. 录制屏幕和声音

ffmpeg -f dshow -i audio="virtual-audio-capturer":video="screen-capture-recorder" -pix_fmt yuv420p iqiyi.mp4

命令解读:

(1) -f fmt (input/output) Force input or output file format. The format is normally auto detected for input files and guessed from the file extension for output files, so this option is not needed in most cases.

(2) -i url (input)

input file url,输入视频

(3)-pix_fmt[:stream_specifier] format (input/output,per-stream) Set pixel format. Use -pix_fmts to show all the supported pixel formats. If the selected pixel format can not be selected, ffmpeg will print a warning and select the best pixel format supported by the encoder. If pix_fmt is prefixed by a +, ffmpeg will exit with an error if the requested pixel format can not be selected, and automatic conversions inside filtergraphs are disabled. If pix_fmt is a single +, ffmpeg selects the same pixel format as the input (or graph output) and automatic conversions are disabled.

 

7. 截取视频的一部分区域

// 将四周各减去100个像素,截取中间区域的视频 ffmpeg -y -i iqiyi.mp4 -vf crop=iw-200:ih-200:100:100 -c:a copy iqiyi_crop.mp4 // 宽度不变,高度上从顶部减去137个像素,从底部减去138个像素 ffmpeg -y -i iqiyi.mp4 -vf crop=iw:ih-275:0:137 -c:a copy iqiyi_crop2.mp4

命令解读:

(1)-vf filtergraph (output)

Create the filtergraph specified by filtergraph and use it to filter the stream. This is an alias for -filter:v, see the -filter option.

(2)iw, ih为输入视频的宽度和高度,iw-200, ih-200 为输出视频的宽度和高度,100,100为输出视频在输入视频中的起始位置

(3)-c[:stream_specifier] codec (input/output,per-stream)

Select an encoder (when used before an output file) or a decoder (when used before an input file) for one or more streams. codec is the name of a decoder/encoder or a special value copy (output only) to indicate that the stream is not to be re-encoded.

(4)-y 如果同名的输出视频存在,则覆盖

 

8. 截取视频的一部分长度

ffmpeg -y -ss 0:0:8 -t 0:0:12 -i iqiyi_crop.mp4 iqiyi_crop_time.mp4

命令解读:

(1) -ss

起始时间,从第8秒开始截取

(2) -t

时间长度,12秒

(3) -i url (input)

input file url,输入视频

 

9. 查看视频的信息

ffprobe iqiyi_crop_time.mp4 windows 10 使用ffmpeg录屏和录音,截取视频区域和时长


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3