added VAAPI acceleration

This commit is contained in:
cpu
2023-12-21 01:24:59 +01:00
parent 74f18cb037
commit 8ee0742297

View File

@@ -120,7 +120,7 @@ Or using ffmpeg
Compressed: mjpeg : Motion-JPEG : 160x120 176x144 320x240 352x288 640x480 800x600 960x720 Compressed: mjpeg : Motion-JPEG : 160x120 176x144 320x240 352x288 640x480 800x600 960x720
Raw : yuyv422 : YUYV 4:2:2 : 160x120 176x144 320x240 352x288 640x480 800x600 960x720 1600x1200 Raw : yuyv422 : YUYV 4:2:2 : 160x120 176x144 320x240 352x288 640x480 800x600 960x720 1600x1200
``` ```
Lists all available recording devices Lists all available audio recording devices
> `arecord -l` > `arecord -l`
``` ```
**** List of CAPTURE Hardware Devices **** **** List of CAPTURE Hardware Devices ****
@@ -154,6 +154,13 @@ Note: Does not work on Waylad ([What is Wayland in Linux Distros and Should You
### Live stream white text on black background [ffmpeg create blank screen with text video](https://stackoverflow.com/questions/22710099/ffmpeg-create-blank-screen-with-text-video) ### Live stream white text on black background [ffmpeg create blank screen with text video](https://stackoverflow.com/questions/22710099/ffmpeg-create-blank-screen-with-text-video)
> `ffmpeg -hide_banner -f lavfi -i color=size=320x240:rate=25:color=black -vf "drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:fontsize=30:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text='Stream začne čoskoro...'" -vcodec libx264 -preset slow -f flv rtmp://peertube.virtonline.eu:1935/live/LIVE-STREAM-KEY` > `ffmpeg -hide_banner -f lavfi -i color=size=320x240:rate=25:color=black -vf "drawtext=fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:fontsize=30:fontcolor=white:x=(w-text_w)/2:y=(h-text_h)/2:text='Stream začne čoskoro...'" -vcodec libx264 -preset slow -f flv rtmp://peertube.virtonline.eu:1935/live/LIVE-STREAM-KEY`
### Live stream camera using h.264 hardware acceleration [VAAPI](https://trac.ffmpeg.org/wiki/Hardware/VAAPI) (e.g. on Intel iGPU)
Use the dockerized ffmpeg with precompiled vaapi support, adjust `/dev/video2`
> `alias ffmpeg='docker run --rm -w $(pwd) -v $(pwd):$(pwd) --device=/dev/dri --device=/dev/video2 jrottenberg/ffmpeg:vaapi'`
Adjust `/dev/video2`, `-video_size 1920x1080 -framerate 60` and stream to peertube (if it can handle that much)
> `ffmpeg -hide_banner -y -f v4l2 -input_format mjpeg -video_size 1920x1080 -framerate 60 -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i /dev/video2 -vf 'scale_vaapi=format=nv12' -c:v h264_vaapi -b:v 10M -f flv rtmp://peertube.virtonline.eu:1935/live/LIVE-STREAM-KEY`
Adjusting camera functions Adjusting camera functions
-------------------------- --------------------------
Brightness, zoom, focus, etc, can be adjusted Brightness, zoom, focus, etc, can be adjusted