ffmpeg无法在Windows 10

时间:2019-04-08 19:23:37

标签: audio ffmpeg windows-10

我正在使用ffmpeg抓屏。它曾经在Win7下使用UScreenCapture和virtual-audio-capturer(所有x86版本)运行良好。在win10上,不会记录音频。 (播放时我听不到声音)。我正在使用ffmpeg / uscreencapture / virtual-audio-capturer所有的win32版本,因为virtual-audio-capturer没有x64版本。

所以我的问题是:如何使用ffmpeg正确记录视频和音频?

这是屏幕转储: 首先是我系统上的直接显示设备

C:\ffmpeg-20190403-ee16d14-win32-static\bin>ffmpeg -list_devices true -f dshow -i dummy
ffmpeg version N-93528-gee16d14b0a Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  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-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-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.101 / 58. 48.101
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
[dshow @ 06303ac0] DirectShow video devices (some may be both video and audio devices)
[dshow @ 06303ac0]  "UScreenCapture"
[dshow @ 06303ac0]     Alternative name "@device_sw_{860BB310-5D01-11D0-BD3B-00A0C911CE86}\UScreenCapture"
[dshow @ 06303ac0] DirectShow audio devices
[dshow @ 06303ac0]  "Microphone Array (Realtek(R) Audio)"
[dshow @ 06303ac0]     Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{9F102091-1843-44C8-B20E-C6F2E0F11A0F}"
[dshow @ 06303ac0]  "virtual-audio-capturer"
[dshow @ 06303ac0]     Alternative name "@device_sw_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\{8E14549B-DB61-4309-AFA1-3578E927E935}"
dummy: Immediate exit requested

2,当我使用虚拟音频捕获器时,ffmpeg只是失败了:

C:\ffmpeg-20190403-ee16d14-win32-static\bin>ffmpeg -f dshow -i video="UScreenCapture":audio="Microphone Array (Realtek(R) Audio)" -vf crop=1075:717:189:81 -vcodec mpeg4 -qscale 0 -framerate 60 -acodec libmp3lame -ab 128000 -async 1 output.aviffmpeg -f dshow -i video="UScreenCapture":audio="virtual-audio-capturer" -vf crop=1075:717:189:81 -vcodec mpeg4 -qscale 0 -framerate 60 -acodec libmp3lame -ab 128000 -async 1 output.avi
ffmpeg version N-93528-gee16d14b0a Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 8.2.1 (GCC) 20190212
  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-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-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
  libavutil      56. 26.100 / 56. 26.100
  libavcodec     58. 48.101 / 58. 48.101
  libavformat    58. 26.101 / 58. 26.101
  libavdevice    58.  7.100 / 58.  7.100
  libavfilter     7. 48.100 /  7. 48.100
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, dshow, from 'video=UScreenCapture:audio=Microphone Array (Realtek(R) Audio)':
  Duration: N/A, start: 6333.289000, bitrate: N/A
    Stream #0:0: Video: rawvideo, bgr24, 3200x1080, 15 fps, 15 tbr, 10000k tbn, 10000k tbc
    Stream #0:1: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
IMMDeviceEnumerator::GetDefaultAudioEndpoint failed: hr = 0x80070490
[dshow @ 062f4ac0] real-time buffer [UScreenCapture] [video input] too full or near too full (340% of size: 3041280 [rtbufsize parameter])! frame dropped!

当我使用其他音频设备时,它似乎可以工作,但是没有录制音频:

ffmpeg -f dshow -i video="UScreenCapture":audio="Microphone Array (Realtek(R) Audio)" -vf crop=1075:717:189:81 -vcodec mpeg4 -qscale 0 -framerate 60 -acodec libmp3lame -ab 128000 -async 1 output.avi

    C:\ffmpeg-20190403-ee16d14-win32-static\bin>ffmpeg -f dshow -i video="UScreenCapture":audio="Microphone Array (Realtek(R) Audio)" -vf crop=1075:717:189:81 -vcodec mpeg4 -qscale 0 -framerate 60 -acodec libmp3lame -ab 128000 -async 1 output.avi
    ffmpeg version N-93528-gee16d14b0a Copyright (c) 2000-2019 the FFmpeg developers
      built with gcc 8.2.1 (GCC) 20190212
      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-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-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt
      libavutil      56. 26.100 / 56. 26.100
      libavcodec     58. 48.101 / 58. 48.101
      libavformat    58. 26.101 / 58. 26.101
      libavdevice    58.  7.100 / 58.  7.100
      libavfilter     7. 48.100 /  7. 48.100
      libswscale      5.  4.100 /  5.  4.100
      libswresample   3.  4.100 /  3.  4.100
      libpostproc    55.  4.100 / 55.  4.100
    Guessed Channel Layout for Input Stream #0.1 : stereo
    Input #0, dshow, from 'video=UScreenCapture:audio=Microphone Array (Realtek(R) Audio)':
      Duration: N/A, start: 6168.067000, bitrate: N/A
        Stream #0:0: Video: rawvideo, bgr24, 3200x1080, 15 fps, 15 tbr, 10000k tbn, 10000k tbc
        Stream #0:1: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
    Please use -q:a or -q:v, -qscale is ambiguous
    Stream mapping:
      Stream #0:0 -> #0:0 (rawvideo (native) -> mpeg4 (native))
      Stream #0:1 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))
    Press [q] to stop, [?] for help
    -async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
    Output #0, avi, to 'output.avi':
      Metadata:
        ISFT            : Lavf58.26.101
        Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p(progressive), 1075x717, q=2-31, 200 kb/s, 15 fps, 15 tbn, 15 tbc
        Metadata:
          encoder         : Lavc58.48.101 mpeg4
        Side data:
          cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
        Stream #0:1: Audio: mp3 (libmp3lame) (U[0][0][0] / 0x0055), 44100 Hz, stereo, s16p, 128 kb/s
        Metadata:
          encoder         : Lavc58.48.101 libmp3lame
    frame=    8 fps=0.0 q=0.0 size=     522kB time=00:00:00.53 bitrate=8013.1kbitsframe=   16 fps= 16 q=0.0 size=    1034kB time=00:00:01.06 bitrate=7938.7kbitsframe=   23 fps= 15 q=0.0 size=    1546kB time=00:00:01.53 bitrate=8258.0kbitsframe=   31 fps= 15 q=0.0 size=    2058kB time=00:00:02.06 bitrate=8156.4kbitsframe=   38 fps= 15 q=0.0 size=    2058kB time=00:00:02.53 bitrate=6653.9kbitsframe=   46 fps= 15 q=0.0 size=    2570kB time=00:00:03.06 bitrate=6864.4kbitsframe=   54 fps= 15 q=0.0 size=    3082kB time=00:00:03.60 bitrate=7012.6kbitsframe=   61 fps= 15 q=0.0 size=    3338kB time=00:00:04.06 bitrate=6723.5kbitsframe=   69 fps= 15 q=0.0 size=    3850kB time=00:00:04.60 bitrate=6855.8kbitsframe=   76 fps= 15 q=0.0 size=    4106kB time=00:00:05.06 bitrate=6638.2kbitsframe=   84 fps= 15 q=0.0 size=    4618kB time=00:00:05.60 bitrate=6755.0kbitsframe=   91 fps= 15 q=0.0 size=    4874kB time=00:00:06.06 bitrate=6581.1kbitsframe=   99 fps= 15 q=0.0 size=    5130kB time=00:00:06.60 bitrate=6367.0kbitsframe=  106 fps= 15 q=0.0 size=    5642kB time=00:00:07.06 bitrate=6540.1kbitsframe=  114 fps= 15 q=0.0 size=    6154kB time=00:00:07.66 bitrate=6575.3kbitsframe=  121 fps= 15 q=0.0 size=    6410kB time=00:00:08.13 bitrate=6455.9kbitsframe=  129 fps= 15 q=0.0 size=    6666kB time=00:00:08.66 bitrate=6300.6kbitsframe=  136 fps= 15 q=0.0 size=    6922kB time=00:00:09.13 bitrate=6208.3kbitsframe=  144 fps= 15 q=0.0 size=    7434kB time=00:00:09.66 bitrate=6299.7kbitsframe=  151 fps= 15 q=0.0 size=    7690kB time=00:00:10.13 bitrate=6216.5kbitsframe=  159 fps= 15 q=0.0 size=    7946kB time=00:00:10.66 bitrate=6102.3kbitsframe=  167 fps= 15 q=0.0 size=    8458kB time=00:00:11.20 bitrate=6186.2kbitsframe=  174 fps= 15 q=0.0 size=    8970kB time=00:00:11.66 bitrate=6298.3kbitsframe=  182 fps= 15 q=0.0 size=    8970kB time=00:00:12.20 bitrate=6022.9kbitsframe=  189 fps= 15 q=0.0 size=    9482kB time=00:00:12.66 bitrate=6132.2kbitsframe=  190 fps= 15 q=0.0 Lsize=    9602kB time=00:00:12.73 bitrate=6177.3kbits/s speed=   1x
    video:9382kB audio:194kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.265721%
    [dshow @ 06393f40] real-time buffer [UScreenCapture] [video input] too full or near too full (340% of size: 3041280 [rtbufsize parameter])! frame dropped!
    Exiting normally, received signal 2.

1 个答案:

答案 0 :(得分:0)

我终于在Windows 10下解决了这个问题: 麦克风只能从空中获取声音,这可能会捕获不想要的声音,并且质量可能不佳。幸运的是,我们有替代解决方案:

  1. https://www.vb-audio.com/Cable/下载vb电缆
  2. 解压缩并在管理员模式下运行vbcable_setup.exe
  3. 打开声音设置,添加了两个设备:用于回放的电缆输入和用于记录的电缆输出

  4. 将这两个设备设为默认设备

  5. 选择记录设备电缆输出并选择属性。
  6. 选中“收听此设备”,然后选择播放设备作为扬声器。 (声音最终会传到扬声器上)

之后,通过运行以下命令转到ffmpeg: ffmpeg -list_devices -f dshow -i虚拟 将显示以下设备名称: “音频电缆输出(VB音频虚拟电缆)”

将此设备用作音频捕获设备,即可解决问题。