• 音视频 ffmpeg命令视频录制(Windows)


    先安装dshow软件 Screen Capturer Recorder,
    项目地址:https://sourceforge.net/projects/screencapturer/files/
    然后查看可用设备名字:ffmpeg -list_devices true -f dshow -i dummy

    [dshow @ 0509d6c0] DirectShow video devices (some may be both video and audio devices)
    [dshow @ 0509d6c0] "Integrated Webcam" //笔记本摄像头
    [dshow @ 0509d6c0] Alternative name 
    "@device_pnp_\\?\usb#vid_0bda&pid_5689&mi_00#6&233dd6c7&0&0000#{65e8773d-8f56-11
    d0-a3b9-00a0c9223196}\global"
    [dshow @ 0509d6c0] "e2eSoft VCam"
    [dshow @ 0509d6c0] Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\e2eSoft 
    VCam"
    [dshow @ 0509d6c0] "screen-capture-recorder"
    [dshow @ 0509d6c0] Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-
    00A0C911CE86}\{4EA6930A-2C8A-4AE6-A561-56E4
    B5044439}"
    [dshow @ 0509d6c0] DirectShow audio devices
    [dshow @ 0509d6c0] "楹﹀厠椋?(Realtek Audio)"
    [dshow @ 0509d6c0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-
    00A0C911CE86}\wave_{8B8892E5-D3E5-47EC-8B5E
    -CEEBF54014E7}"
    [dshow @ 0509d6c0] "virtual-audio-capturer"
    [dshow @ 0509d6c0] Alternative name "@device_sw_{33D9A762-90C8-11D0-BD43-
    00A0C911CE86}\{8E14549B-DB61-4309-AFA1-3578
    2
    E927E935}"
    dummy: Immediate exit requested
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23

    录制视频(默认参数)

    桌面:ffmpeg -f dshow -i video="screen-capture-recorder" v-out.mp4 
    摄像头: ffmpeg -f dshow -i video="Integrated Webcam" -y v-out2.flv (要根据自己摄像头名称)
    
    • 1
    • 2

    录制声音(默认参数)

    系统声音:ffmpeg -f dshow -i audio="virtual-audio-capturer" a-out.aac
    系统+麦克风声音:ffmpeg -f dshow -i audio="麦克风 (Realtek Audio)" -f dshow -i audio="virtual-audio-capturer" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 a-out2.aac
    
    • 1
    • 2

    同时录制声音和视频(默认参数)

    ffmpeg -f dshow -i audio="麦克风 (Realtek Audio)" -f dshow -i audio="virtualaudio-capturer" -filter_complex amix=inputs=2:duration=first:dropout_transition=2 -f dshow -i video="screen-capture-recorder" -y av-out.flv
    
    • 1

    查看视频录制的可选参数

    ffmpeg -f dshow -list_options true -i video="screen-capture-recorder"
    
    
    [dshow @ 02f0d6c0] DirectShow video device options (from video devices)
    [dshow @ 02f0d6c0] Pin "Capture" (alternative pin name "1")
    [dshow @ 02f0d6c0] pixel_format=bgr0 min s=1x1 fps=0.02 max s=1920x1080 fps=30
    [dshow @ 02f0d6c0] pixel_format=bgr0 min s=1x1 fps=0.02 max s=1920x1080 fps=30
    [dshow @ 02f0d6c0] pixel_format=bgr24 min s=1x1 fps=0.02 max s=1920x1080 fps=30
    [dshow @ 02f0d6c0] pixel_format=rgb555le min s=1x1 fps=0.02 max s=1920x1080 
    fps=30
    [dshow @ 02f0d6c0] pixel_format=rgb555le min s=1x1 fps=0.02 max s=1920x1080 
    fps=30
    [dshow @ 02f0d6c0] pixel_format=rgb8 min s=1x1 fps=0.02 max s=1920x1080 fps=30
    [dshow @ 02f0d6c0] pixel_format=yuv420p min s=1x1 fps=0.02 max s=1920x1080 
    fps=30
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    查看视频录制的可选参数

    ffmpeg -f dshow -list_options true -i audio="virtual-audio-capturer“
    
    [dshow @ 05a2d6c0] DirectShow audio only device options (from audio devices)
    [dshow @ 05a2d6c0] Pin "Capture Virtual Audio Pin" (alternative pin name "1")
    [dshow @ 05a2d6c0] min ch=2 bits=16 rate= 48000 max ch=2 bits=16 rate= 48000
    
    
    ffmpeg -f dshow -list_options true -i audio="麦克风 (Realtek Audio)"
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    指定参数录制音视频

    ffmpeg -f dshow -i audio="麦克风 (Realtek Audio)" -f dshow -i
    audio="virtual-audio-capturer" -filter_complex
    amix=inputs=2:duration=first:dropout_transition=2 -f dshow -video_size
    1920x1080 -framerate 15 -pixel_format yuv420p -i video="screen-capturerecorder" -vcodec h264_qsv -b:v 3M -y av-out.flv
    
    ffmpeg -f dshow -i audio="麦克风 (Realtek Audio)" -f dshow -i
    audio="virtual-audio-capturer" -filter_complex
    amix=inputs=2:duration=first:dropout_transition=2 -f dshow -i
    video="screen-capture-recorder" -vcodec h264_qsv -b:v 3M -r 15 -y avout2.mp4
    
    ffmpeg -f dshow -i audio="麦克风 (Realtek Audio)" -f dshow -i
    audio="virtual-audio-capturer" -filter_complex
    amix=inputs=2:duration=first:dropout_transition=2 -f dshow -framerate 15
    -pixel_format yuv420p -i video="screen-capture-recorder" -vcodec
    h264_qsv -b:v 3M -r 15 -y av-out3.mp4
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15

    推荐一个零声学院项目课,个人觉得老师讲得不错,分享给大家:
    零声白金学习卡(含基础架构/高性能存储/golang云原生/音视频/Linux内核)
    https://xxetb.xet.tech/s/VsFMs

  • 相关阅读:
    【Vue项目复习笔记】详情页的展示
    中国传统节日春节网页HTML代码 春节大学生网页设计制作成品下载 学生网页课程设计期末作业下载 DW春节节日网页作业代码下载
    缓存穿透、缓存雪崩、缓存击穿问题的解决思路
    c语言编程实例
    springboot + rabbitmq + redis实现秒杀
    QT:工业软件开发的首选“
    Golang爬虫如何触发JavaScript代码
    网络中其他重要技术与协议(DNS系统,ICMP协议,NAT技术与代理服务器)
    Vue3新的状态管理库-Pinia(保姆级别教程)
    微前端四:qiankun在开发中遇到的问题
  • 原文地址:https://blog.csdn.net/qq_40135848/article/details/132591304