You don't mention which version of the Pi you have (Original Pi, Pi2, Pi3, Pi4)? Any of them are capable of handling the raw data rate of a compressed 1080p mp4 video just as a file transfer, but I believe that actually encoding such a video in real time at 30 fps requires the GPU hardware. At least, that is what happens with the official RPi camera that attaches with the flex cable and uses 'raspivid' to record. I don't know what image or video format your USB webcam delivers. It is possible that ffmpeg is trying to first decode whatever format the webcam provides, and then re-encode that to H.264 format, which is a lot of computation to try in realtime, especially if it is trying to do this all in software (ARM CPU, not GPU). If the USB camera is streaming a set of still images (eg JPEG or MJPEG or raw/uncompressed) there might even be a Pi USB bandwidth problem at 1080p/30 in addition to the compute limit.
I don't fully understand this thread https://www.raspberrypi.org/forums/view ... 8&t=199775
but it appears to make the claim that you need to take specific steps to make ffmpeg take advantage of the GPU (hardware acceleration) for video on the Pi hardware, instead of trying to make do with the CPU. Also, depending on source resolution and quality settings, even the GPU may not be enough to reach 30 fps:
FFMPEG: BENCHMARK RESULTS FOR MY SOURCE-BUILT VERSION ON THE RASPBERRY PI 3B+:
ENCODING HIGH-COMPLEXITY 30 FPS VIDEO FROM A 1920 X 1080 JPEG IMAGE SEQUENCE – SIGNIFICANT MOTION AND INTRAFRAME DETAIL – HIGH QUALITY SETTINGS:
Software-Based H.264 Encoding (CPU): 2.6 FPS (11.5 times slower than real time)
Hardware-Based H.264 Encoding (GPU): 6.3 FPS (4.8 times slower than real time)
from: https://www.raspberrypi.org/forums/view ... 8&t=199775