| | 188 | ==== Camera Capture ==== |
| | 189 | |
| | 190 | Capture a raw stream from a V4L2 camera device and encode it as H.264: |
| | 191 | {{{ |
| | 192 | ffmpeg -vaapi_device /dev/dri/renderD128 -f v4l2 -video_size 1920x1080 -i /dev/video0 -vf 'format=nv12,hwupload' -c:v h264_vaapi output.mp4 |
| | 193 | }}} |
| | 194 | |
| | 195 | Capture an MJPEG stream from a V4L2 camera device (e.g. a UVC webcam), decode it and encode it as H.264: |
| | 196 | {{{ |
| | 197 | ffmpeg -f v4l2 -input_format mjpeg -video_size 1920x1080 -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i /dev/video0 -vf 'scale_vaapi=format=nv12' -c:v h264_vaapi output.mp4 |
| | 198 | }}} |
| | 199 | The extra scale_vaapi instance is needed here to convert the VAAPI surfaces to the correct format for encoding - webcams will typically supply images in YUV 4:2:2 format. |
| | 200 | |
| | 201 | ==== Screen Capture ==== |
| | 202 | |