This repository was archived by the owner on Dec 15, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathREADME.CAMERA
105 lines (92 loc) · 3.79 KB
/
README.CAMERA
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
Introduction
=============
Media SDK Gstreamer plug-ins are compatible with v4l2src plug-in representing camera support.
Usually cameras produce raw YUV memory for low resolution and JPEG for Full HD.
To get a list of of supported color formats and resolutions run:
v4l2-ctl --list-formats-ext
Example of output:
octl: VIDIOC_ENUM_FMT
Index : 0
Type : Video Capture
Pixel Format: 'YUYV'
Name : YUYV 4:2:2
Size: Discrete 640x360
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
...
Size: Discrete 1280x720
Interval: Discrete 0.100s (10.000 fps)
Interval: Discrete 0.200s (5.000 fps)
Size: Discrete 1920x1080
Interval: Discrete 0.200s (5.000 fps)
Index : 1
Type : Video Capture
Pixel Format: 'MJPG' (compressed)
Name : Motion-JPEG
Size: Discrete 640x360
Interval: Discrete 0.033s (30.000 fps)
Interval: Discrete 0.040s (25.000 fps)
Interval: Discrete 0.050s (20.000 fps)
v4l2src can produce system memory and DMA memory. In case of hardware VPP or encoder plug-ins DMA memory is a preferable option.
gst-inspect-1.0 v4l2src:
io-mode : I/O mode
flags: readable, writable
Enum "GstV4l2IOMode" Default: 0, "auto"
(0): auto - GST_V4L2_IO_AUTO
(1): rw - GST_V4L2_IO_RW
(2): mmap - GST_V4L2_IO_MMAP
(3): userptr - GST_V4L2_IO_USERPTR
(4): dmabuf - GST_V4L2_IO_DMABUF
(5): dmabuf-import - GST_V4L2_IO_DMABUF_IMPORT
In case of io-mode=4 v4l2src produces DMA memory.
Command Line Examples
=====================
# Make sure that camera support works.
# Using some default resolution and framerate and rendering images to the screen
gst-launch-1.0 \
v4l2src ! \
autovideoconvert ! \
ximagesink
# To specify resolution and framerate
gst-launch-1.0 \
v4l2src num-buffers=1500 ! \
video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! \
autovideoconvert ! \
ximagesink
# MediaSDK VPP with scaling and CSC YUY2->NV12.
gst-launch-1.0 \
v4l2src ! \
video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! \
mfx_gst_vpp width=352 height=288 memory=system ! \
autovideoconvert ! \
ximagesink
# v4l2src produces DMA memory. Doing VPP with scaling and CSC YUY2->NV12.
gst-launch-1.0 \
v4l2src io-mode=4 ! \
video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! \
mfx_gst_vpp width=352 height=288 memory=system ! \
autovideoconvert ! \
ximagesink
# Capturing -> VPP -> encode -> muxing -> writing to file.
gst-launch-1.0 \
v4l2src io-mode=4 ! \
video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! \
mfx_gst_vpp width=352 height=288 memory=system ! \
mfx_gst_h264ve RateControlMethod=cbr TargetKbps=3000 GopRefDist=1 ! \
qtmux ! \
filesink location=camera.mp4
# More complicated case:
# capturing -> VPP -> encode -> muxing -> writing to file
# |------> VPP -> screen rendering.
gst-launch-1.0 \
v4l2src num-buffers=150 io-mode=4 ! \
video/x-raw,format=YUY2,width=640,height=480,framerate=30/1 ! \
tee name=t ! queue ! \
mfx_gst_vpp width=352 height=288 memory=video ! \
mfx_gst_h264ve RateControlMethod=cbr TargetKbps=3000 GopRefDist=1 ! \
qtmux ! \
filesink location=camera.mp4 \
t. ! queue ! \
mfx_gst_vpp width=640 height=480 memory=system ! \
autovideoconvert ! \
ximagesink