我正在寻找一种使用Windows ffmpeg录制音频输出(扬声器)的方法。 我需要这样做而不安装任何额外的dshow过滤器并且没有启用StereoMix输入(因为这在许多计算机上不可用)。
我已经在ffmpeg文档中读到-map允许重定向音频输出,以便ffmpeg将其视为音频输入,但我找不到任何如何操作的示例。
在Linux中,我设法做到了这样:
ffmpeg -f pulse -ac 2 -ar 44100 -i alsa_output.pci-0000_00_1f.4.analog-stereo.monitor -f pulse -ac 2 -ar 44100 -i alsa_input.pci-0000_00_1f.4.analog-stereo -filter_complex amix=inputs=2 test.mp4
但是我无法在Windows和MacOSX中找到类似的方法。
简而言之,Windows ffmpeg是否可以在没有额外的dshow过滤器(开箱即用)的情况下从扬声器录制音频?同样的问题适用于MacOSX。
谢谢!
答案 0 :(得分:0)
C:\DIR>choco install ffmpeg
C:\DIR>ffmpeg -list_devices true -f dshow -i dummy
[...]
[dshow @ 00000000005d1140] DirectShow audio devices
[dshow @ 00000000005d1140] "Microphone Array (Realtek High "
[dshow @ 00000000005d1140] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\Microphone Array (Realtek High "
[...]
C:\DIR>ffmpeg -f dshow -i audio="Microphone Array (Realtek High " NAME.wav
[...]
[press 'q' to quit]
[...]
要播放文件,我认为我需要对Windows SDL输出设备配置中的错误应用变通方法,
C:\DIR>@rem https://trac.ffmpeg.org/ticket/6891
C:\DIR>@rem set SDL_AUDIODRIVER=directsound or winmm
C:\DIR>set SDL_AUDIODRIVER=winmm
C:\DIR>ffplay -i NAME.wav
观看ffplay的实时频谱图很有趣。
C:\DIR>ffplay -f dshow -i audio="Microphone Array (Realtek High "
[...]
[press 'm' to mute the echo]
[...]
[press 'q' to quit]
[...]
我看到了使用Python或其媒体播放器提供的Windows API播放音频文件的其他方式。
C:\DIR>type winsound-play.py
import sys, winsound
winsound.PlaySound(sys.argv[1], winsound.SND_FILENAME)
C:\DIR>c:\Python27\python winsound-play.py NAME.wav
C:\DIR>explorer NAME.wav
C:\DIR>"%ProgramFiles%\Windows Media Player\wmplayer.exe" /task NowPlaying %CD%\NAME.wav