Ramin Bateni
Ramin Bateni

Reputation: 17405

Why the result of FFmpeg capture process has no audio to create a webm file?

The result of my bellow FFmpeg command has no audio (is silent):

ffmpeg -f gdigrab -framerate 30 -i desktop -video_size 720x480 -c:v libvpx-vp9 -c:a libopus -b:v 1M -b:a 128K -auto-alt-ref 0 -crf 10 -preset ultrafast output.webm

But this one has audio:

ffmpeg -f gdigrab -i desktop -f dshow -i audio="Microphone (4- High Definition Audio Device)" output.mkv

My FFmpeg version:

ffmpeg version N-93439-gb073fb9eea 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. 47.105 / 58. 47.105
  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

Upvotes: 0

Views: 1033

Answers (1)

Gyan
Gyan

Reputation: 92928

Issues are best troubleshooted by changing one variable at a time. Your 2nd command has two changes - an audio input and a different container profile (webm -> mkv).

gdigrab is a video grabber, so no audio is supplied. You need to feed an audio input.

ffmpeg -f gdigrab -framerate 30 -video_size 720x480 -i desktop -f dshow -i audio="Microphone (4- High Definition Audio Device)" -c:v libvpx-vp9 -b:v 1M -crf 10 -auto-alt-ref 0 -c:a libopus -b:a 128K output.webm

Upvotes: 4

Related Questions