728x90

출처

GStreamer 기본 패키지 설치

pi@raspberrypi:~$ sudo apt-get install gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly gstreamer1.0-tools libgstreamer1.0-dev libgstreamer1.0-0-dbg libgstreamer1.0-0 libgstreamer-plugins-base1.0-dev gtk-doc-tools

GStreamer Camera Source 설치

소스 다운로드

pi@raspberrypi:~$ git clone https://github.com/thaytan/gst-rpicamsrc.git
pi@raspberrypi:~$ cd gst-rpicamsrc

빌드

pi@raspberrypi:~/gst-rpicamsrc$ ./autogen.sh
pi@raspberrypi:~/gst-rpicamsrc$ make

설치

pi@raspberrypi:~/gst-rpicamsrc$ sudo make install
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/arm-linux-gnueabihf/gstreamer-1.0
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'

테스트

pi@raspberrypi:~$ gst-inspect-1.0 | grep rpicamsrc
rpicamsrc:  rpicamsrcdeviceprovider (GstDeviceProviderFactory)
rpicamsrc:  rpicamsrc: Raspberry Pi Camera Source

GStreamer RTSP Server 설치

소스 다운로드

pi@raspberrypi:~$ git clone git://anongit.freedesktop.org/gstreamer/gst-rtsp-server
pi@raspberrypi:~$ cd gst-rtsp-server
pi@raspberrypi:~/gst-rtsp-server$ git checkout 1.12.5

빌드

pi@raspberrypi:~/gst-rtsp-server$ sudo apt install meson
pi@raspberrypi:~/gst-rtsp-server$ meson buil
The Meson build system
Version: 0.52.1
Source dir: /home/pi/gst-rtsp-server
Build dir: /home/pi/gst-rtsp-server/buil
Build type: native build
Project name: gst-rtsp-server
Project version: 1.12.5
C compiler for the host machine: cc (gcc 8.3.0 "cc (Raspbian 8.3.0-6+rpi1) 8.3.0")
C linker for the host machine: GNU ld.bfd 2.31.1
Host machine cpu family: arm
Host machine cpu: armv7l
Configuring config.h using configuration
Found pkg-config: /usr/bin/pkg-config (0.29)
Run-time dependency glib-2.0 found: YES 2.58.3
Run-time dependency gstreamer-1.0 found: YES 1.14.4
Run-time dependency gstreamer-rtsp-1.0 found: YES 1.14.4
Run-time dependency gstreamer-rtp-1.0 found: YES 1.14.4
Run-time dependency gstreamer-sdp-1.0 found: YES 1.14.4
Run-time dependency gstreamer-app-1.0 found: YES 1.14.4
Run-time dependency gstreamer-net-1.0 found: YES 1.14.4
Program g-ir-scanner found: NO
Found CMake: /usr/bin/cmake (3.13.4)
Run-time dependency libcgroup found: NO (tried pkgconfig and cmake)
Configuring gstreamer-rtsp-server-1.0.pc using configuration
Configuring gstreamer-rtsp-server-1.0-uninstalled.pc using configuration
pkgconfig/meson.build:22: WARNING: The variable(s) 'srcdir' in the input file 'pkgconfig/gstreamer-rtsp-server-uninstalled.pc.in' are not present in the given configuration data.
Build targets in project: 18
Found ninja-1.8.2 at /usr/bin/ninja

설치

pi@raspberrypi:~/gst-rpicamsrc$ sudo make install
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib/arm-linux-gnueabihf/gstreamer-1.0
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'
pi@raspberrypi:~/gst-rtsp-server$ ./autogen.sh
 
Configuration
        Version                    : 1.12.5
        Source code location       : .
        Prefix                     : /usr/local
        Compiler                   : gcc
        CGroups example            : no

gst-rtsp-server configured. Type 'make' to build.

Now type 'make' to compile gst-rtsp-server.
pi@raspberrypi:~/gst-rtsp-server$ make

GStreamer RTSP Server 설치

pi@raspberrypi:~/gst-rtsp-server$ sudo make install
 
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib/gstreamer-1.0
 
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the '-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the 'LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the 'LD_RUN_PATH' environment variable
     during linking
   - use the '-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to '/etc/ld.so.conf'
  
-- Installing ./html/GstRTSPAddressPool.html
-- Installing ./html/GstRTSPAuth.html
-- Installing ./html/GstRTSPClient.html
-- Installing ./html/GstRTSPContext.html
-- Installing ./html/GstRTSPMedia.html
-- Installing ./html/GstRTSPMediaFactory.html
-- Installing ./html/GstRTSPMediaFactoryURI.html
-- Installing ./html/GstRTSPMountPoints.html
-- Installing ./html/GstRTSPPermissions.html
-- Installing ./html/GstRTSPServer.html
-- Installing ./html/GstRTSPSession.html
-- Installing ./html/GstRTSPSessionMedia.html
-- Installing ./html/GstRTSPSessionPool.html
-- Installing ./html/GstRTSPStream.html
-- Installing ./html/GstRTSPStreamTransport.html
-- Installing ./html/GstRTSPThreadPool.html
-- Installing ./html/GstRTSPToken.html
-- Installing ./html/annotation-glossary.html
-- Installing ./html/api-index-full.html
-- Installing ./html/ch01.html
-- Installing ./html/gst-rtsp-server-GstRTSPParams.html
-- Installing ./html/gst-rtsp-server-GstRTSPSdp.html
-- Installing ./html/index.html
-- Installing ./html/rtsp-server-hierarchy.html
-- Installing ./html/home.png
-- Installing ./html/left-insensitive.png
-- Installing ./html/left.png
-- Installing ./html/right-insensitive.png
-- Installing ./html/right.png
-- Installing ./html/up-insensitive.png
-- Installing ./html/up.png
-- Installing ./html/style.css
-- Installing ./html/gst-rtsp-server-1.0.devhelp2

RTSP Server 실행

pi@raspberrypi:~/gst-rtsp-server$ cd examples/
pi@raspberrypi:~/gst-rtsp-server/examples$ ./test-launch "( rpicamsrc preview=false bitrate=2000000 keyframe-interval=15 ! video/x-h264, framerate=15/1 ! h264parse ! rtph264pay name=pay0 pt=96 )"
stream ready at rtsp://127.0.0.1:8554/test

재생

Raspberry Pi Camera 정보 조희

pi@raspberrypi:~/gst-rtsp-server$ gst-inspect-1.0 rpicamsrc
Factory Details:
  Rank                     none (0)
  Long-name                Raspberry Pi Camera Source
  Klass                    Source/Video
  Description              Raspberry Pi camera module source
  Author                   Jan Schmidt <jan@centricular.com>
 
Plugin Details:
  Name                     rpicamsrc
  Description              Raspberry Pi Camera Source
  Filename                 /usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstrpicamsrc.so
  Version                  1.0.0
  License                  LGPL
  Source module            gstrpicamsrc
  Binary package           GStreamer
  Origin URL               http://gstreamer.net/
 
GObject
 +----GInitiallyUnowned
       +----GstObject
             +----GstElement
                   +----GstBaseSrc
                         +----GstPushSrc
                               +----GstRpiCamSrc
 
Implemented Interfaces:
  GstColorBalance
  GstVideoDirection
  GstVideoOrientation
 
Pad Templates:
  SRC template: 'src'
    Availability: Always
    Capabilities:
      video/x-h264
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
          stream-format: byte-stream
              alignment: nal
                profile: { (string)constrained-baseline, (string)baseline, (string)main, (string)high }
      image/jpeg
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
      video/x-raw
                 format: { (string)I420, (string)RGB, (string)BGR, (string)RGBA }
                  width: [ 1, 2147483647 ]
                 height: [ 1, 2147483647 ]
              framerate: [ 0/1, 2147483647/1 ]
 
Element has no clocking capabilities.
Element has no URI handling capabilities.
 
Pads:
  SRC: 'src'
    Pad Template: 'src'
 
Element Properties:
  video-direction     : Video direction: rotation and flipping
                        flags: readable, writable, controllable
                        Enum "GstVideoOrientationMethod" Default: 0, "identity"
                           (0): identity         - GST_VIDEO_ORIENTATION_IDENTITY
                           (1): 90r              - GST_VIDEO_ORIENTATION_90R
                           (2): 180              - GST_VIDEO_ORIENTATION_180
                           (3): 90l              - GST_VIDEO_ORIENTATION_90L
                           (4): horiz            - GST_VIDEO_ORIENTATION_HORIZ
                           (5): vert             - GST_VIDEO_ORIENTATION_VERT
                           (6): ul-lr            - GST_VIDEO_ORIENTATION_UL_LR
                           (7): ur-ll            - GST_VIDEO_ORIENTATION_UR_LL
                           (8): auto             - GST_VIDEO_ORIENTATION_AUTO
                           (9): custom           - GST_VIDEO_ORIENTATION_CUSTOM
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "rpicamsrc0"
  parent              : The parent of the object
                        flags: readable, writable
                        Object of type "GstObject"
  blocksize           : Size in bytes to read per buffer (-1 = default)
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 4294967295 Default: 4096 
  num-buffers         : Number of buffers to output before sending EOS (-1 = unlimited)
                        flags: readable, writable
                        Integer. Range: -1 - 2147483647 Default: -1 
  typefind            : Run typefind before negotiating (deprecated, non-functional)
                        flags: readable, writable, deprecated
                        Boolean. Default: false
  do-timestamp        : Apply current stream time to buffers
                        flags: readable, writable
                        Boolean. Default: true
  camera-number       : Which camera to use on a multi-camera system - 0 or 1
                        flags: readable, writable
                        Integer. Range: 0 - 1 Default: 0 
  bitrate             : Bitrate for encoding. 0 for VBR using quantisation-parameter
                        flags: readable, writable
                        Integer. Range: 0 - 25000000 Default: 17000000 
  keyframe-interval   : Interval (in frames) between I frames. -1 = automatic, 0 = single-keyframe
                        flags: readable, writable
                        Integer. Range: -1 - 2147483647 Default: -1 
  preview             : Display preview window overlay
                        flags: readable, writable
                        Boolean. Default: true
  preview-encoded     : Display encoder output in the preview
                        flags: readable, writable
                        Boolean. Default: true
  preview-opacity     : Opacity to use for the preview window
                        flags: readable, writable
                        Integer. Range: 0 - 255 Default: 255 
  preview-x           : Start X coordinate of the preview window (in pixels)
                        flags: readable, writable
                        Integer. Range: 0 - 2048 Default: 0 
  preview-y           : Start Y coordinate of the preview window (in pixels)
                        flags: readable, writable
                        Integer. Range: 0 - 2048 Default: 0 
  preview-w           : Width of the preview window (in pixels)
                        flags: readable, writable
                        Integer. Range: 0 - 2048 Default: 1024 
  preview-h           : Height of the preview window (in pixels)
                        flags: readable, writable
                        Integer. Range: 0 - 2048 Default: 768 
  fullscreen          : Display preview window full screen
                        flags: readable, writable
                        Boolean. Default: true
  sharpness           : Image capture sharpness
                        flags: readable, writable
                        Integer. Range: -100 - 100 Default: 0 
  contrast            : Image capture contrast
                        flags: readable, writable
                        Integer. Range: -100 - 100 Default: 0 
  brightness          : Image capture brightness
                        flags: readable, writable
                        Integer. Range: 0 - 100 Default: 50 
  saturation          : Image capture saturation
                        flags: readable, writable
                        Integer. Range: -100 - 100 Default: 0 
  iso                 : ISO value to use (0 = Auto)
                        flags: readable, writable
                        Integer. Range: 0 - 3200 Default: 0 
  video-stabilisation : Enable or disable video stabilisation
                        flags: readable, writable
                        Boolean. Default: false
  exposure-compensation: Exposure Value compensation
                        flags: readable, writable
                        Integer. Range: -10 - 10 Default: 0 
  exposure-mode       : Camera exposure mode to use
                        flags: readable, writable
                        Enum "GstRpiCamSrcExposureMode" Default: 1, "auto"
                           (0): off              - GST_RPI_CAM_SRC_EXPOSURE_MODE_OFF
                           (1): auto             - GST_RPI_CAM_SRC_EXPOSURE_MODE_AUTO
                           (2): night            - GST_RPI_CAM_SRC_EXPOSURE_MODE_NIGHT
                           (3): nightpreview     - GST_RPI_CAM_SRC_EXPOSURE_MODE_NIGHTPREVIEW
                           (4): backlight        - GST_RPI_CAM_SRC_EXPOSURE_MODE_BACKLIGHT
                           (5): spotlight        - GST_RPI_CAM_SRC_EXPOSURE_MODE_SPOTLIGHT
                           (6): sports           - GST_RPI_CAM_SRC_EXPOSURE_MODE_SPORTS
                           (7): snow             - GST_RPI_CAM_SRC_EXPOSURE_MODE_SNOW
                           (8): beach            - GST_RPI_CAM_SRC_EXPOSURE_MODE_BEACH
                           (9): verylong         - GST_RPI_CAM_SRC_EXPOSURE_MODE_VERYLONG
                           (10): fixedfps         - GST_RPI_CAM_SRC_EXPOSURE_MODE_FIXEDFPS
                           (11): antishake        - GST_RPI_CAM_SRC_EXPOSURE_MODE_ANTISHAKE
                           (12): fireworks        - GST_RPI_CAM_SRC_EXPOSURE_MODE_FIREWORKS
  metering-mode       : Camera exposure metering mode to use
                        flags: readable, writable
                        Enum "GstRpiCamSrcExposureMeteringMode" Default: 0, "average"
                           (0): average          - GST_RPI_CAM_SRC_EXPOSURE_METERING_MODE_AVERAGE
                           (1): spot             - GST_RPI_CAM_SRC_EXPOSURE_METERING_MODE_SPOT
                           (2): backlist         - GST_RPI_CAM_SRC_EXPOSURE_METERING_MODE_BACKLIST
                           (3): matrix           - GST_RPI_CAM_SRC_EXPOSURE_METERING_MODE_MATRIX
  awb-mode            : White Balance mode
                        flags: readable, writable
                        Enum "GstRpiCamSrcAWBMode" Default: 1, "auto"
                           (0): off              - GST_RPI_CAM_SRC_AWB_MODE_OFF
                           (1): auto             - GST_RPI_CAM_SRC_AWB_MODE_AUTO
                           (2): sunlight         - GST_RPI_CAM_SRC_AWB_MODE_SUNLIGHT
                           (3): cloudy           - GST_RPI_CAM_SRC_AWB_MODE_CLOUDY
                           (4): shade            - GST_RPI_CAM_SRC_AWB_MODE_SHADE
                           (5): tungsten         - GST_RPI_CAM_SRC_AWB_MODE_TUNGSTEN
                           (6): fluorescent      - GST_RPI_CAM_SRC_AWB_MODE_FLUORESCENT
                           (7): incandescent     - GST_RPI_CAM_SRC_AWB_MODE_INCANDESCENT
                           (8): flash            - GST_RPI_CAM_SRC_AWB_MODE_FLASH
                           (9): horizon          - GST_RPI_CAM_SRC_AWB_MODE_HORIZON
  awb-gain-red        : Manual AWB Gain for red channel when awb-mode=off
                        flags: readable, writable
                        Float. Range:               0 -               8 Default:               0 
  awb-gain-blue       : Manual AWB Gain for blue channel when awb-mode=off
                        flags: readable, writable
                        Float. Range:               0 -               8 Default:               0 
  image-effect        : Visual FX to apply to the image
                        flags: readable, writable
                        Enum "GstRpiCamSrcImageEffect" Default: 0, "none"
                           (0): none             - GST_RPI_CAM_SRC_IMAGEFX_NONE
                           (1): negative         - GST_RPI_CAM_SRC_IMAGEFX_NEGATIVE
                           (2): solarize         - GST_RPI_CAM_SRC_IMAGEFX_SOLARIZE
                           (3): posterize        - GST_RPI_CAM_SRC_IMAGEFX_POSTERIZE
                           (4): whiteboard       - GST_RPI_CAM_SRC_IMAGEFX_WHITEBOARD
                           (5): blackboard       - GST_RPI_CAM_SRC_IMAGEFX_BLACKBOARD
                           (6): sketch           - GST_RPI_CAM_SRC_IMAGEFX_SKETCH
                           (7): denoise          - GST_RPI_CAM_SRC_IMAGEFX_DENOISE
                           (8): emboss           - GST_RPI_CAM_SRC_IMAGEFX_EMBOSS
                           (9): oilpaint         - GST_RPI_CAM_SRC_IMAGEFX_OILPAINT
                           (10): hatch            - GST_RPI_CAM_SRC_IMAGEFX_HATCH
                           (11): gpen             - GST_RPI_CAM_SRC_IMAGEFX_GPEN
                           (12): pastel           - GST_RPI_CAM_SRC_IMAGEFX_PASTEL
                           (13): watercolour      - GST_RPI_CAM_SRC_IMAGEFX_WATERCOLOUR
                           (14): film             - GST_RPI_CAM_SRC_IMAGEFX_FILM
                           (15): blur             - GST_RPI_CAM_SRC_IMAGEFX_BLUR
                           (16): saturation       - GST_RPI_CAM_SRC_IMAGEFX_SATURATION
                           (17): colourswap       - GST_RPI_CAM_SRC_IMAGEFX_COLOURSWAP
                           (18): washedout        - GST_RPI_CAM_SRC_IMAGEFX_WASHEDOUT
                           (19): posterise        - GST_RPI_CAM_SRC_IMAGEFX_POSTERISE
                           (20): colourpoint      - GST_RPI_CAM_SRC_IMAGEFX_COLOURPOINT
                           (21): colourbalance    - GST_RPI_CAM_SRC_IMAGEFX_COLOURBALANCE
                           (22): cartoon          - GST_RPI_CAM_SRC_IMAGEFX_CARTOON
  rotation            : Rotate captured image (0, 90, 180, 270 degrees)
                        flags: readable, writable
                        Integer. Range: 0 - 270 Default: 0 
  hflip               : Flip capture horizontally
                        flags: readable, writable
                        Boolean. Default: false
  vflip               : Flip capture vertically
                        flags: readable, writable
                        Boolean. Default: false
  roi-x               : Normalised region-of-interest X coord
                        flags: readable, writable
                        Float. Range:               0 -               1 Default:               0 
  roi-y               : Normalised region-of-interest Y coord
                        flags: readable, writable
                        Float. Range:               0 -               1 Default:               0 
  roi-w               : Normalised region-of-interest W coord
                        flags: readable, writable
                        Float. Range:               0 -               1 Default:               1 
  roi-h               : Normalised region-of-interest H coord
                        flags: readable, writable
                        Float. Range:               0 -               1 Default:               1 
  quantisation-parameter: Set a Quantisation Parameter approx 10-40 with bitrate=0 for VBR encoding. 0 = off
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  inline-headers      : Set to TRUE to insert SPS/PPS before each IDR packet
                        flags: readable, writable
                        Boolean. Default: false
  shutter-speed       : Set a fixed shutter speed, in microseconds. (0 = Auto)
                        flags: readable, writable
                        Integer. Range: 0 - 6000000 Default: 0 
  sensor-mode         : Manually set the camera sensor mode
                        flags: readable, writable
                        Enum "GstRpiCamSrcSensorMode" Default: 0, "automatic"
                           (0): automatic        - Automatic
                           (1): 1920x1080        - 1920x1080 16:9 1-30fps
                           (2): 2592x1944-fast   - 2592x1944 4:3 1-15fps / 3240x2464 15fps w/ v.2 board
                           (3): 2592x1944-slow   - 2592x1944 4:3 0.1666-1fps / 3240x2464 15fps w/ v.2 board
                           (4): 1296x972         - 1296x972 4:3 1-42fps
                           (5): 1296x730         - 1296x730 16:9 1-49fps
                           (6): 640x480-slow     - 640x480 4:3 42.1-60fps
                           (7): 640x480-fast     - 640x480 4:3 60.1-90fps
  drc                 : Dynamic Range Control level
                        flags: readable, writable
                        Enum "GstRpiCamSrcDRCLevel" Default: 0, "off"
                           (0): off              - GST_RPI_CAM_SRC_DRC_LEVEL_OFF
                           (1): low              - GST_RPI_CAM_SRC_DRC_LEVEL_LOW
                           (2): medium           - GST_RPI_CAM_SRC_DRC_LEVEL_MEDIUM
                           (3): high             - GST_RPI_CAM_SRC_DRC_LEVEL_HIGH
  annotation-mode     : Flags to control annotation of the output video
                        flags: readable, writable
                        Flags "GstRpiCamSrcAnnotationMode" Default: 0x00000000, "(none)"
                           (0x00000001): custom-text      - GST_RPI_CAM_SRC_ANNOTATION_MODE_CUSTOM_TEXT
                           (0x00000002): text             - GST_RPI_CAM_SRC_ANNOTATION_MODE_TEXT
                           (0x00000004): date             - GST_RPI_CAM_SRC_ANNOTATION_MODE_DATE
                           (0x00000008): time             - GST_RPI_CAM_SRC_ANNOTATION_MODE_TIME
                           (0x00000010): shutter-settings - GST_RPI_CAM_SRC_ANNOTATION_MODE_SHUTTER_SETTINGS
                           (0x00000020): caf-settings     - GST_RPI_CAM_SRC_ANNOTATION_MODE_CAF_SETTINGS
                           (0x00000040): gain-settings    - GST_RPI_CAM_SRC_ANNOTATION_MODE_GAIN_SETTINGS
                           (0x00000080): lens-settings    - GST_RPI_CAM_SRC_ANNOTATION_MODE_LENS_SETTINGS
                           (0x00000100): motion-settings  - GST_RPI_CAM_SRC_ANNOTATION_MODE_MOTION_SETTINGS
                           (0x00000200): frame-number     - GST_RPI_CAM_SRC_ANNOTATION_MODE_FRAME_NUMBER
                           (0x00000400): black-background - GST_RPI_CAM_SRC_ANNOTATION_MODE_BLACK_BACKGROUND
  annotation-text     : Text string to annotate onto video when annotation-mode flags include 'custom-text'
                        flags: readable, writable
                        String. Default: ""
  annotation-text-size: Set the size of annotation text (in pixels) (0 = Auto)
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  annotation-text-colour: Set the annotation text colour, as the integer corresponding to a VUY value eg 0x8080FF = 8421631, -1 for default
                        flags: readable, writable
                        Integer. Range: -1 - 2147483647 Default: -1 
  annotation-text-bg-colour: Set the annotation text background colour, as the integer corresponding to a VUY value eg 0x8080FF = 8421631, -1 for default
                        flags: readable, writable
                        Integer. Range: -1 - 2147483647 Default: -1 
  intra-refresh-type  : Type of Intra Refresh to use, -1 to disable intra refresh
                        flags: readable, writable
                        Enum "GstRpiCamSrcIntraRefreshType" Default: -1, "none"
                           (-1): none             - GST_RPI_CAM_SRC_INTRA_REFRESH_TYPE_NONE
                           (0): cyclic           - GST_RPI_CAM_SRC_INTRA_REFRESH_TYPE_CYCLIC
                           (1): adaptive         - GST_RPI_CAM_SRC_INTRA_REFRESH_TYPE_ADAPTIVE
                           (2): both             - GST_RPI_CAM_SRC_INTRA_REFRESH_TYPE_BOTH
                           (2130706433): cyclic-rows      - GST_RPI_CAM_SRC_INTRA_REFRESH_TYPE_CYCLIC_ROWS
  use-stc             : Use the camera STC for timestamping buffers
                        flags: readable, writable
                        Boolean. Default: true
728x90
728x90

출처

openssl 라이브러리 소스 다운로드

pi@bpi-iot-ros-ai:~$ wget http://www.openssl.org/source/openssl-1.1.1g.tar.gz
pi@bpi-iot-ros-ai:~$ tar xvf openssl-1.1.1g.tar.gz

PCRE 라이브러리 설치

pi@bpi-iot-ros-ai:~$ wget https://acc.dl.osdn.jp/sfnet/p/pc/pcre/pcre/8.32/pcre-8.32.tar.gz
pi@bpi-iot-ros-ai:~$ tar xvf pcre-8.32.tar.gz
pi@bpi-iot-ros-ai:~$ cd pcre-8.32/
pi@bpi-iot-ros-ai:~/pcre-8.32$ ./configure --prefix=/usr/local
pi@bpi-iot-ros-ai:~/pcre-8.32$ make
pi@bpi-iot-ros-ai:~/pcre-8.32$ sudo make install

zip 라이브러리 설치

pi@bpi-iot-ros-ai:~$ wget https://zlib.net/fossils/zlib-1.2.8.tar.gz
pi@bpi-iot-ros-ai:~$ tar xvf zlib-1.2.8.tar.gz 
pi@bpi-iot-ros-ai:~$ cd zlib-1.2.8/
pi@bpi-iot-ros-ai:~/zlib-1.2.8$ ./configure --prefix=/usr/localmake
pi@bpi-iot-ros-ai:~/zlib-1.2.8$ make -j4
pi@bpi-iot-ros-ai:~/zlib-1.2.8$ sudo make install

nginx 설치

nginx-vod-module 소스 다운로드

pi@bpi-iot-ros-ai:~$ git clone https://github.com/kaltura/nginx-vod-module.git

nginx 소스 다운로드

pi@bpi-iot-ros-ai:~$ wget http://nginx.org/download/nginx-1.19.7.tar.gz
pi@bpi-iot-ros-ai:~$ tar xvf nginx-1.19.7.tar.gz
pi@bpi-iot-ros-ai:~$ cd nginx-1.19.7/

빌드 환경 설정 - configure

  • --add-module=../nginx-vod-module : 스트리밍 관련 라이브러리 추가
  • --pid-path : pid 파일 생성 기본 경로 / 해당 옵션이 없는 경우 nginx.conf에서 설정 가능
pi@bpi-iot-ros-ai:~/nginx-1.19.7$ ./configure \
  --add-module=../nginx-vod-module \
  --prefix=/usr/local/nginx \
  --conf-path=/usr/local/nginx/conf/nginx.conf \
  --error-log-path=/usr/local/nginx/logs/error.log \
  --http-log-path=/usr/local/nginx/logs/access.log \
  --user=nginx \
  --group=nginx \
  --lock-path=/usr/local/nginx/system/nginx.lock \
  --pid-path=/usr/local/nginx/system/nginx.pid \
  --without-http_autoindex_module \
  --without-http_ssi_module \
  --with-file-aio \
  --with-http_ssl_module \
  --with-openssl=../openssl-1.1.1g \
  --with-openssl-opt=enable-weak-ssl-ciphers \
  --with-http_gunzip_module \
  --with-http_gzip_static_module \
  --with-http_random_index_module \
  --with-http_secure_link_module \
  --with-http_stub_status_module \
  --with-http_auth_request_module \
  --with-http_addition_module \
  --with-http_realip_module \
  --with-http_stub_status_module \
  --with-threads --with-stream \
  --with-stream_ssl_module \
  --with-http_v2_module \
  --http-client-body-temp-path=/var/cache/nginx/client_body_temp \
  --http-proxy-temp-path=/var/cache/nginx/proxy_temp \
  --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp \
  --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp \
  --http-scgi-temp-path=/var/cache/nginx/scgi_temp

빌드

pi@bpi-iot-ros-ai:~/nginx-1.19.7$ make -j4

설치

pi@bpi-iot-ros-ai:~/nginx-1.19.7$ sudo make install
make -f objs/Makefile install
make[1]: Entering directory '/home/pi/nginx-1.19.7'
cp objs/nginx '/usr/local/nginx/sbin/nginx'
cp conf/koi-win '/usr/local/nginx/conf'
cp conf/koi-utf '/usr/local/nginx/conf'
cp conf/win-utf '/usr/local/nginx/conf'
cp conf/mime.types '/usr/local/nginx/conf/mime.types.default'
cp conf/fastcgi_params \
        '/usr/local/nginx/conf/fastcgi_params.default'
cp conf/fastcgi.conf '/usr/local/nginx/conf/fastcgi.conf.default'
cp conf/uwsgi_params \
        '/usr/local/nginx/conf/uwsgi_params.default'
cp conf/scgi_params \
        '/usr/local/nginx/conf/scgi_params.default'
cp conf/nginx.conf '/usr/local/nginx/conf/nginx.conf.default'
test -d '/usr/local/nginx/system' \
        || mkdir -p '/usr/local/nginx/system'
test -d '/usr/local/nginx/logs' \
        || mkdir -p '/usr/local/nginx/logs'
test -d '/usr/local/nginx/html' \
        || cp -R html '/usr/local/nginx'
test -d '/usr/local/nginx/logs' \
        || mkdir -p '/usr/local/nginx/logs'
make[1]: Leaving directory '/home/pi/nginx-1.19.7'

nginx 계정 추가

error.log에 해당 오류 발견시 계정 추가 필요 nginx: [emerg] getpwnam("nginx") failed

pi@bpi-iot-ros-ai:~$ sudo groupadd nginx
pi@bpi-iot-ros-ai:~$ sudo useradd -g nginx -s /bin/bash -m nginx

nginx 서비스 등록

nginx.service 파일 생성

pi@bpi-iot-ros-ai:~$ sudo vi /etc/systemd/system/nginx.service

 

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target

[Service]
Type=forking
PIDFile=/usr/local/nginx/system/nginx.pid
ExecStartPre=/usr/local/nginx/sbin/nginx -t
ExecStart=/usr/local/nginx/sbin/nginx
ExecReload=/usr/local/nginx/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true

[Install]
WantedBy=multi-user.target

nginx.service 서비스 등록

pi@bpi-iot-ros-ai:~$ sudo systemctl enable nginx.service
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /etc/systemd/system/nginx.service.

nginx.service 서비스 시작

pi@bpi-iot-ros-ai:~$ sudo systemctl start nginx.service

nginx.service 서비스 상태확인

pi@bpi-iot-ros-ai:~$ sudo systemctl status nginx.service

nginx 스트리밍 관련 환경 설정

nginx.conf 수정

pi@bpi-iot-ros-ai:~$ sudo vi /usr/local/nginx/conf/nginx.conf

 

    server {
        listen       80;
        server_name  localhost;

        # vod settings
        vod_mode local;
        vod_fallback_upstream_location /fallback;
        vod_last_modified 'Sun, 19 Nov 2000 08:52:00 GMT';
        vod_last_modified_types *;
        vod_metadata_cache metadata_cache 512m;
        vod_response_cache response_cache 128m;
        gzip on;
        gzip_types application/vnd.apple.mpegurl;

        vod_segment_duration 1000;

        open_file_cache          max=1000 inactive=5m;
        open_file_cache_valid    2m;
        open_file_cache_min_uses 1;
        open_file_cache_errors   on;
        aio on;
        location /content/ {
                root /media_content/;
                vod hls;
                add_header Access-Control-Allow-Headers '*';
                add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
                add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
                add_header Access-Control-Allow-Origin '*';
                expires 100d;
        }

nginx.service 서비스 재시작

pi@bpi-iot-ros-ai:~$ sudo systemctl restart nginx.service

동영상 파일 복사

pi@bpi-iot-ros-ai:~$ sudo mkdir -p /media_content/content
pi@bpi-iot-ros-ai:~$ cd /media_content/content
pi@bpi-iot-ros-ai:/media_content/content$ wget https://www.radiantmediaplayer.com/media/big-buck-bunny-360p.mp4

동영상 구현 (hls.js)

pi@bpi-iot-ros-ai:~$ cd /usr/local/nginx/html
pi@bpi-iot-ros-ai:/usr/local/nginx/html$ sudo vi player.htm

 

<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
<video id="video" controls></video>
<script>
  if(Hls.isSupported()) {
    var video = document.getElementById('video');
    var hls = new Hls();
    hls.loadSource('http://192.168.0.87/content/big-buck-bunny-360p.mp4/index.m3u8');
    hls.attachMedia(video);
    hls.on(Hls.Events.MANIFEST_PARSED,function() {
      // video.play();
    });
  }
</script>

확인

728x90
728x90

출처

알리에서 구입한 핀해더가 납땜이된 Raspberry Pi Pico와 Pimoroni에서 구입한 Raspberry Pi Pico

Raspberry Pi Pico의 앞면과 뒷면

USB로 PC와 연결시 Windows의 드라이브로 표시

Raspberry Pi Pico Spec

Raspberry Pi Pico는 Raspberry Pi에서 설계된 실리콘에 구축 된 유연한 디지털 인터페이스를 갖춘 저가형 고성능 마이크로 컨트롤러 보드입니다.

  • 영국의 Raspberry Pi가 설계 한 RP2040 마이크로 컨트롤러 칩
  • 듀얼 코어 ARM Cortex M0+ 프로세서, 최대 133MHz로 실행되는 유연한 클록
  • 264kB SRAM 및 2MB 온보드 플래시 메모리
  • Castellated 모듈로 캐리어 보드에 직접 납땜 가능
  • USB 1.1 호스트 및 장치 지원
  • 저전력 절전 및 휴면 모드
  • 드래그 앤 드롭으로 프로그램밍한 결과를을 USB를 통한 대용량 저장 장치에 적용
  • 26 개의 다기능 GPIO 핀
  • 2×SPI, 2×I2C, 2×UART, 3×12-bit ADC, 16×제어 할 수 있는 PWM 채널
  • 정확한 클록 및 타이머 온칩
  • 온도 센서
  • Accelerated floating point libraries on-chip
  • 8×Programmable IO (PIO) state machines for custom peripheral support
728x90
728x90

출처

NanoPi M4V2 : 카메라(ov13850)

이지미출처 : File:M4-mipi-single-camera.jpg - FriendlyARM WiKi

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ dmesg | grep ov13850
[    1.137232] ov13850 1-0010: driver version: 00.01.01
[    1.137688] ov13850 1-0010: could not get module information!
[    1.138295] ov13850 1-0010: GPIO lookup for consumer reset
[    1.138308] ov13850 1-0010: using device tree for GPIO lookup
[    1.138344] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/i2c@ff110000/ov13850@10[0]' - status (0)
[    1.138380] ov13850 1-0010: GPIO lookup for consumer pwdn
[    1.138391] ov13850 1-0010: using device tree for GPIO lookup
[    1.138423] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff110000/ov13850@10[0]' - status (0)
[    1.142534] ov13850 1-0010: Detected OV00d850 sensor, REVISION 0xb1
[    1.143438] ov13850 2-0010: driver version: 00.01.01
[    1.143893] ov13850 2-0010: could not get module information!
[    1.144472] ov13850 2-0010: GPIO lookup for consumer reset
[    1.144484] ov13850 2-0010: using device tree for GPIO lookup
[    1.144519] of_get_named_gpiod_flags: parsed 'reset-gpios' property of node '/i2c@ff120000/ov13850@10[0]' - status (0)
[    1.144556] ov13850 2-0010: GPIO lookup for consumer pwdn
[    1.144567] ov13850 2-0010: using device tree for GPIO lookup
[    1.144597] of_get_named_gpiod_flags: parsed 'pwdn-gpios' property of node '/i2c@ff120000/ov13850@10[0]' - status (0)
[    1.149264] ov13850 2-0010: Unexpected sensor id(000000), ret(-5)

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ v4l2-ctl -V -d /dev/video0
Format Video Capture Multiplanar:
        Width/Height      : 640/480
        Pixel Format      : 'YUYV'
        Field             : None
        Number of planes  : 1
        Flags             : 
        Colorspace        : Default
        Transfer Function : Default
        YCbCr Encoding    : Default
        Quantization      : Full Range
        Plane 0           :
           Bytes per Line : 1280
           Size Image     : 614400
pi@NanoPi-M4v2:~$ v4l2-ctl -V -d /dev/video1
Format Video Capture Multiplanar:
        Width/Height      : 1920/1568
        Pixel Format      : 'YUYV'
        Field             : None
        Number of planes  : 1
        Flags             : 
        Colorspace        : Default
        Transfer Function : Default
        YCbCr Encoding    : Default
        Quantization      : Full Range
        Plane 0           :
           Bytes per Line : 3840
           Size Image     : 6021120
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev0 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev1 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0
pi@NanoPi-M4v2:~$ v4l2-ctl -d /dev/v4l-subdev2 --all
Driver Info (not using libv4l2):
        Driver name   : 
        Card type     : 
        Bus info      : 
        Driver version: 0.0.0
        Capabilities  : 0x00000000
 
User Controls
 
                       exposure 0x00980911 (int)    : min=4 max=1660 step=1 default=1536 value=1536
 
Image Source Controls
 
              vertical_blanking 0x009e0901 (int)    : min=96 max=31199 step=1 default=96 value=96
            horizontal_blanking 0x009e0902 (int)    : min=2688 max=2688 step=1 default=2688 value=2688 flags=read-only
                  analogue_gain 0x009e0903 (int)    : min=16 max=248 step=1 default=16 value=16
 
Image Processing Controls
 
                 link_frequency 0x009f0901 (intmenu): min=0 max=0 default=0 value=0 flags=read-only
                     pixel_rate 0x009f0902 (int64)  : min=0 max=0 step=0 default=0 value=120000000 flags=read-only
                   test_pattern 0x009f0903 (menu)   : min=0 max=4 default=0 value=0

카메라(ov13850) 모듈 확인

pi@NanoPi-M4v2:~$ media-ctl -d /dev/media0 -p
Media controller API version 0.1.0
 
Media device information
------------------------
driver          rkisp1
model           rkisp1
serial          
bus info        
hw revision     0x0
driver version  0.0.0
 
Device topology
- entity 1: rkisp1-isp-subdev (4 pads, 6 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:SBGGR10_1X10/2112x1568 field:none
                 crop.bounds:(0,0)/2112x1568
                 crop:(0,0)/2112x1568]
                <- "rkisp1_dmapath":0 []
                <- "rockchip-mipi-dphy-rx":1 [ENABLED]
        pad1: Sink
                <- "rkisp1-input-params":0 [ENABLED]
        pad2: Source
                [fmt:YUYV8_2X8/2112x1568 field:none
                 crop.bounds:(0,0)/2112x1568
                 crop:(0,0)/2112x1568]
                -> "rkisp1_selfpath":0 [ENABLED]
                -> "rkisp1_mainpath":0 [ENABLED]
        pad3: Source
                -> "rkisp1-statistics":0 [ENABLED]
 
- entity 2: rkisp1_mainpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video0
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]
 
- entity 3: rkisp1_selfpath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video1
        pad0: Sink
                <- "rkisp1-isp-subdev":2 [ENABLED]
 
- entity 4: rkisp1_dmapath (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video2
        pad0: Source
                -> "rkisp1-isp-subdev":0 []
 
- entity 5: rkisp1-statistics (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video3
        pad0: Sink
                <- "rkisp1-isp-subdev":3 [ENABLED]
 
- entity 6: rkisp1-input-params (1 pad, 1 link)
            type Node subtype V4L flags 0
            device node name /dev/video4
        pad0: Source
                -> "rkisp1-isp-subdev":1 [ENABLED]
 
- entity 7: rockchip-mipi-dphy-rx (2 pads, 2 links)
            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev1
        pad0: Sink
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                <- "ov13850 1-0010":0 [ENABLED]
        pad1: Source
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                -> "rkisp1-isp-subdev":0 [ENABLED]
 
- entity 8: ov13850 1-0010 (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
            device node name /dev/v4l-subdev2
        pad0: Source
                [fmt:SBGGR10_1X10/2112x1568@10000/300000 field:none]
                -> "rockchip-mipi-dphy-rx":0 [ENABLED]

카메라(ov13850) 연결 확인

pi@NanoPi-M4v2:~$ dmesg | grep Async
[    1.839621] rkisp1: Async subdev notifier completed

gst-camera 설치

pi@NanoPi-M4v2:~$ cd /tmp/
pi@NanoPi-M4v2:/tmp$ git clone https://github.com/friendlyarm/gst-camera-sh.git
Cloning into 'gst-camera-sh'...
remote: Enumerating objects: 36, done.
remote: Total 36 (delta 0), reused 0 (delta 0), pack-reused 36
Unpacking objects: 100% (36/36), done.
pi@NanoPi-M4v2:/tmp$ sudo cp gst-camera-sh/*.sh /usr/bin/

카메라(ov13850) 캡쳐

pi@NanoPi-M4v2:/tmp$ gst-camera.sh -a photo -o 1.jpg
gst-launch-1.0: no process found
====================================================
=== GStreamer 1.1 command:
=== gst-launch-1.0 rkisp num-buffers=20 device=/dev/video0 io-mode=1 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=10/1 ! jpegenc ! multifilesink location="/tmp/isp-frame%d.jpg"
====================================================
{{{{{{ start take photo
Setting pipeline to PAUSED ...
media get entity by name: lens is null
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR v4l2_device.cpp:254: VIDIOC_QUERYCAP returned: -1 (Inappropriate ioctl for device)
XCAM ERROR rkisp_control_loop_impl.cpp:99: failed to get camera module info
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
XCAM ERROR rkisp_device.cpp:72: atomisp device(/dev/video0) try subdev format failed
New clock: GstSystemClock
Got EOS from element "pipeline0".
Execution ended after 0:00:00.759673858
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
Setting pipeline to NULL ...
Freeing pipeline ...
}}}}}} end take photo

Image sensors OV13850 & OV4689 at the i2c ports 1 & 2

pi@NanoPi-M4v2:~/mjpg-streamer/mjpg-streamer-experimental$ i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- 0c -- -- -- 
10: UU -- -- -- -- -- -- -- -- -- UU -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         
pi@NanoPi-M4v2:~/mjpg-streamer/mjpg-streamer-experimental$ ls -l /sys/class/video4linux/
total 0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev0 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev1 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev1
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev2 -> ../../devices/platform/ff910000.rkisp1/video4linux/v4l-subdev2
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev3 -> ../../devices/platform/ff920000.rkisp1/video4linux/v4l-subdev3
lrwxrwxrwx 1 root root 0 Feb 28 17:30 v4l-subdev4 -> ../../devices/platform/ff920000.rkisp1/video4linux/v4l-subdev4
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video0 -> ../../devices/platform/ff910000.rkisp1/video4linux/video0
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video1 -> ../../devices/platform/ff910000.rkisp1/video4linux/video1
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video2 -> ../../devices/platform/ff910000.rkisp1/video4linux/video2
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video3 -> ../../devices/platform/ff910000.rkisp1/video4linux/video3
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video4 -> ../../devices/platform/ff910000.rkisp1/video4linux/video4
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video5 -> ../../devices/platform/ff920000.rkisp1/video4linux/video5
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video6 -> ../../devices/platform/ff920000.rkisp1/video4linux/video6
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video7 -> ../../devices/platform/ff920000.rkisp1/video4linux/video7
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video8 -> ../../devices/platform/ff920000.rkisp1/video4linux/video8
lrwxrwxrwx 1 root root 0 Feb 28 17:30 video9 -> ../../devices/platform/ff920000.rkisp1/video4linux/video9

화이트 밸런스 조정 (실패)

pi@NanoPi-M4v2:~$ v4l2-ctl -d 1 --set-ctrl=white_balance_temperature_auto=1
unknown control 'white_balance_temperature_auto'
728x90
728x90

출처

BPI-M4의 경우 전용 카메라, 모니터를 사용할 수 있는 확장 슬롯이 없고 기본 eMMC가 용량이 작아서 아쉬웠는데 M.2 E-Key로 SD 메모리를 확장 할 수 있어서 소개합니다.

SD 메모리 장착 전, 후
확장보드 장착 전, 후

리눅스 정보 확인

pi@bpi-iot-ros-ai:~$ uname -a
Linux bpi-iot-ros-ai 4.9.119-BPI-M4-Kernel #1 SMP PREEMPT Mon May 18 10:41:36 HKT 2020 aarch64 aarch64 aarch64 GNU/Linux

리눅스 배포판 버전 확인

pi@bpi-iot-ros-ai:~$ grep . /etc/*-release
/etc/armbian-image-release:# PLEASE DO NOT EDIT THIS FILE
/etc/armbian-image-release:BOARD=bananapim64
/etc/armbian-image-release:BOARD_NAME="Banana Pi M64"
/etc/armbian-image-release:BOARDFAMILY=sun50iw1
/etc/armbian-image-release:VERSION=5.41
/etc/armbian-image-release:LINUXFAMILY=pine64
/etc/armbian-image-release:BRANCH=default
/etc/armbian-image-release:ARCH=arm64
/etc/armbian-image-release:IMAGE_TYPE=user-built
/etc/armbian-image-release:BOARD_TYPE=csc
/etc/armbian-image-release:INITRD_ARCH=arm
/etc/armbian-image-release:KERNEL_IMAGE_TYPE=Image
/etc/lsb-release:DISTRIB_ID=Ubuntu
/etc/lsb-release:DISTRIB_RELEASE=18.04
/etc/lsb-release:DISTRIB_CODENAME=bionic
/etc/lsb-release:DISTRIB_DESCRIPTION="Ubuntu 18.04.4 LTS"
/etc/os-release:NAME="Ubuntu"
/etc/os-release:VERSION="18.04.4 LTS (Bionic Beaver)"
/etc/os-release:ID=ubuntu
/etc/os-release:ID_LIKE=debian
/etc/os-release:PRETTY_NAME="Ubuntu 18.04.4 LTS"
/etc/os-release:VERSION_ID="18.04"
/etc/os-release:HOME_URL="https://www.ubuntu.com/"
/etc/os-release:SUPPORT_URL="https://help.ubuntu.com/"
/etc/os-release:BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
/etc/os-release:PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
/etc/os-release:VERSION_CODENAME=bionic
/etc/os-release:UBUNTU_CODENAME=bionic

dmesg 확인

pi@bpi-iot-ros-ai:~$ dmesg | grep pci
[    2.204941] [RTD139x PCIE] 98060000.pcie: PCIE host driver initial begin.
[    2.204973] [RTD139x PCIE] 98060000.pcie: PCIE Debug Mode off
[    2.441801] [RTD139x PCIE] 98060000.pcie: PCIE device has link down in slot 2
[    2.441833] [RTD139x PCIE] 98060000.pcie: rtk_pcie_139x_hw_initial fail
[    2.441886] [RTD139x PCIE]: probe of 98060000.pcie failed with error -22
[    4.922306] ehci-pci: EHCI PCI platform driver
[    4.922978] ohci-pci: OHCI PCI platform driver

블럭장치 확인

확장 드라이브 설치 전

pi@bpi-iot-ros-ai:~$ lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0      179:0    0  7.3G  0 disk 
├─mmcblk0p1  179:1    0  256M  0 part /media/pi/BPI-BOOT
└─mmcblk0p2  179:2    0  6.8G  0 part /
mmcblk0boot0 179:8    0    4M  1 disk 
mmcblk0boot1 179:16   0    4M  1 disk 
mmcblk0rpmb  179:24   0  512K  0 disk

확장 드라이브 설치 후

pi@bpi-iot-ros-ai:~$ lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda            8:0    1 29.7G  0 disk 
└─sda1         8:1    1 29.7G  0 part /media/pi/3665-3463
mmcblk0      179:0    0  7.3G  0 disk 
├─mmcblk0p1  179:1    0  256M  0 part /media/pi/BPI-BOOT
└─mmcblk0p2  179:2    0  6.8G  0 part /
mmcblk0boot0 179:8    0    4M  1 disk 
mmcblk0boot1 179:16   0    4M  1 disk 
mmcblk0rpmb  179:24   0  512K  0 disk

USB 정보 확인

확장 드라이브 설치 전

pi@bpi-iot-ros-ai:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 0bda:c820 Realtek Semiconductor Corp. 
Bus 001 Device 002: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

확장 드라이브 설치 후

pi@bpi-iot-ros-ai:~$ lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 0bda:c820 Realtek Semiconductor Corp. 
Bus 001 Device 003: ID 05e3:0751 Genesys Logic, Inc. 
Bus 001 Device 002: ID 1a40:0201 Terminus Technology Inc. FE 2.1 7-port Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

fdisk 확인

pi@bpi-iot-ros-ai:~$ sudo fdisk -l
 
... 생략 ...
 
Disk /dev/sda: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
 
Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 62333951 62325760 29.7G  c W95 FAT32 (LBA)

추가된 디스트의 파티션을 만들고 mount 하기

디스크 확인

pi@bpi-iot-ros-ai:~$ sudo fdisk -l | grep '^Disk'
Disk /dev/ram0: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram1: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram2: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram3: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram4: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram5: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram6: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram7: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram8: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram9: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram10: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram11: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram12: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram13: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram14: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/ram15: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/mmcblk0: 7.3 GiB, 7818182656 bytes, 15269888 sectors
Disklabel type: dos
Disk identifier: 0xc69bd2d7
Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 sectors
Disk /dev/sda: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Disklabel type: dos
Disk identifier: 0x00000000

기존 파티션을 삭제하고 새로 파티션 생성

pi@bpi-iot-ros-ai:~$ sudo fdisk /dev/sda
 
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
 
 
Command (m for help): p
Disk /dev/sda: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
 
Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1        8192 62333951 62325760 29.7G  c W95 FAT32 (LBA)
 
Command (m for help): d
Selected partition 1
Partition 1 has been deleted.
 
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-62333951, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-62333951, default 62333951): 
 
Created a new partition 1 of type 'Linux' and of size 29.7 GiB.
 
Command (m for help): w
The partition table has been altered.
Failed to remove partition 1 from system: Device or resource busy
Failed to add partition 1 to system: Device or resource busy
 
The kernel still uses the old partitions. The new table will be used at the next reboot. 
Syncing disks.

재부팅

pi@bpi-iot-ros-ai:/sd_disk$ sudo shutdown -r now

디스크 format

pi@bpi-iot-ros-ai:~$ sudo mkfs.ext4 /dev/sda1
mke2fs 1.44.1 (24-Mar-2018)
Creating filesystem with 7791488 4k blocks and 1949696 inodes
Filesystem UUID: ca144d66-31b2-4bac-ac7d-db0d6ccb0075
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
        4096000
 
Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:        
done

mount 할 디렉토리 생성

pi@bpi-iot-ros-ai:~$ sudo mkdir /sd_disk

mount

pi@bpi-iot-ros-ai:~$ sudo mount /dev/sda1 /sd_disk

확인

pi@bpi-iot-ros-ai:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            320M     0  320M   0% /dev
tmpfs            68M  6.0M   63M   9% /run
/dev/mmcblk0p2  6.7G  5.4G  992M  85% /
tmpfs           340M     0  340M   0% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           340M     0  340M   0% /sys/fs/cgroup
tmpfs           340M  4.0K  340M   1% /tmp
tmpfs            68M   16K   68M   1% /run/user/1000
overlaid         68M   16K   68M   1% /run/user/1000/pi-chromium
/dev/sda1        30G  128K   30G   1% /sd_disk
/dev/mmcblk0p1  256M   38M  218M  15% /media/pi/BPI-BOOT

자동 mount

UUID 확인

pi@bpi-iot-ros-ai:~$ sudo blkid
/dev/mmcblk0: PTUUID="c69bd2d7" PTTYPE="dos"
/dev/mmcblk0p1: SEC_TYPE="msdos" LABEL="BPI-BOOT" UUID="D0B7-DA68" TYPE="vfat" PARTUUID="c69bd2d7-01"
/dev/mmcblk0p2: LABEL="BPI-ROOT" UUID="f28d8061-d9a4-495b-96f0-c3e5233eaa1d" TYPE="ext4" PARTUUID="c69bd2d7-02"
/dev/sda1: UUID="ca144d66-31b2-4bac-ac7d-db0d6ccb0075" TYPE="ext4"

fstab 파일에 파티션 추가

pi@bpi-iot-ros-ai:~$ sudo vi /etc/fstab

 

# 파티션 추가 
UUID=ca144d66-31b2-4bac-ac7d-db0d6ccb0075 /sd_disk ext4 defaults 0 0
728x90

+ Recent posts