Messing with FFMPEG
I’m trying to get a useful 1080p output from my Logitech C930e webcam.
1
2
3
4
5
6
7
FFMPEG_GLOBAL="-hide_banner -hwaccel_device drm"
INPUT_VIDEO="-f v4l2 -input_format mjpeg -framerate 24 -video_size 1920x1080 -i /dev/video0"
INPUT_AUDIO="-f alsa -channels 2 -ac 2 -i hw:CARD=C930e,DEV=0"
VIDEO_CODEC="-c:v h264_v4l2m2m -pix_fmt yuv420p -g 24 -b:v 4500K -bufsize 18M -maxrate 4500K"
AUDIO_CODEC="-c:a aac -b:a 96k"
OUTPUT_STREAM="-f flv rtmp://127.0.0.1/webcam/live"
ffmpeg $FFMPEG_GLOBAL $INPUT_VIDEO $INPUT_AUDIO $VIDEO_CODEC $AUDIO_CODEC $OUTPUT_STREAM
Important to include -pix_fmt yuv420 or the mjpeg transcoding will not work.
720p (1280x720) gives me a 72% CPU usage and 1080p (1920x1080) reports 120% in top (where’s the extra 20% coming from?!). I suspect that the CPU is doing the heavy lifting mjpeg decoding
Supposedly, the camera also has h264 output - if only I could get to it…
This post is licensed under
CC BY 4.0
by the author.