1

I've been testing different parameters to capture my desktop video and audio (desktop audio, not mic) and I find that no matter what settings I have, the resulting webm file's framerate is around 5fps and is horribly inconsistent. It starts at around 20fps and slowly drops over time until about 4-5fps. I'm not really sure what I'm doing wrong, but here is the basic command I'm using:

ffmpeg -y -video_size 1920x1080 -f gdigrab -framerate 60 -i desktop -c:v libvpx-vp9 -acodec libvorbis -c:a libopus -b:v 2M -threads 4 output.webm

I've tried anywhere between 30-60 fps and tested different bitrates but nothing seems to affect the output framerate.

Also, I know that acodec and c:a are for audio but I'm not sure how to specify the audio device to use.

So my issues are horrible framerate for webm and how to include desktop audio in the recording.

VagrantC
  • 687
  • 2
  • 13
  • 31

2 Answers2

2

You can use arecord and pipe it through stdout and ffmpeg can read it from stdin.

aplay piping to arecord using a file instead of stdin and stdout

Replacing the aplay command with your ffmpeg. Dont forget to add '-i -' in ffmpeg.

A doubt: why are you defining audio encoder two times?

It's impossible to say why the video frame rate is low from the question. It can be an issue with encoder. Or issue in reading input. Remove the video encoding option. See if the issue persists. If it's working fine, try some other encoders.

1

Use -c:v libx264 instead of -c:v libvpx-vp9. libvpx-vp9's realtime encoding quality is really bad, even regular libvpx (i.e. VP8) is much better. If you insist on using libvpx, use options like -deadline realtime and -cpu-used -4