1

I'm trying to record lossless videos with ffmpeg of

  • My screen
  • My computer audio
  • My microphone audio

using this script:

MIC="alsa_input.usb-Logitech_Logitech_USB_Headset-00.mono-fallback"
MONITOR="alsa_output.usb-Logitech_Logitech_USB_Headset-00.analog-stereo.monitor"

AUDIO0=$(pactl list short | grep "$MIC" | grep -Po "[0-9]+" | head -1)
AUDIO1=$(pactl list short | grep "$MONITOR" | grep -Po "[0-9]+" | head -1)

ffmpeg \
-video_size 1920x1080 \
-framerate 60 \
-f x11grab -i :0.0 \
-f pulse -i $AUDIO0 \
-f pulse -i $AUDIO1 \
-map 0 -map 1 -map 2 \
-c:a copy \
-c:v libx264rgb \
-crf 0 \
-preset ultrafast \
video.mkv

On my slow computer it only records at about 7 FPS. Is there a way to record at a higher FPS while keeping it lossless and the file size fairly small?

The 3 tracks also appear to be about a second out of sync with each other, with the screen first, the mic second, and the sound output third. I think it's because it recognizes them in that order when the recording is started. I can manually resync them, but it would be easier to fix the problem.

2
  • I'd recommend an external HDMI recorder. They're easier to use and more reliable than screen capture. Otherwise, aside from getting a faster computer, you could try reducing frame rate, lowering resolution, switching codecs.
    – xiota
    Commented Oct 16, 2020 at 16:08
  • I'm getting a faster computer soon, so I'll probably just wait until then.
    – LostXOR
    Commented Oct 16, 2020 at 16:35

1 Answer 1

1

There are no faster presets for x264 than ultrafast, so you could:

  • Reduce framerate from 60 to cinematic 24 or even 15 since we are talking about screen casting
  • Use a different video codec
  • Use hardware video encoding acceleration if your GPU supports it
  • Add -thread_queue_size 1024 as encoding options.
  • Some people say the output rate matters to have everything in sync, so try adding -r 60.

I see no other options. Your computer is really slow by today's standards.

1
  • Adding -r 60 doesn't put it in sync. I'm getting a new computer soon so hopefully it'll run faster.
    – LostXOR
    Commented Oct 16, 2020 at 13:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .