embeded/raspberry pi2015. 10. 1. 09:03





$ dmesg

[    6.294914] media: Linux media interface: v0.10

[    6.324668] Linux video capture interface: v2.00

[    6.381431] bcm2835-v4l2: scene mode selected 0, was 0

[    6.381912] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720

[    6.396970] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded. 


$ v4l2-ctl


General/Common options:

  --all              display all information available

  -C, --get-ctrl=<ctrl>[,<ctrl>...]

                     get the value of the controls [VIDIOC_G_EXT_CTRLS]

  -c, --set-ctrl=<ctrl>=<val>[,<ctrl>=<val>...]

                     set the value of the controls [VIDIOC_S_EXT_CTRLS]

  -D, --info         show driver info [VIDIOC_QUERYCAP]

  -d, --device=<dev> use device <dev> instead of /dev/video0

                     if <dev> starts with a digit, then /dev/video<dev> is used

  -h, --help         display this help message

  --help-all         all options

  --help-io          input/output options

  --help-misc        miscellaneous options

  --help-overlay     overlay format options

  --help-selection   crop/selection options

  --help-stds        standards and other video timings options

  --help-streaming   streaming options

  --help-tuner       tuner/modulator options

  --help-vbi         VBI format options

  --help-vidcap      video capture format options

  --help-vidout      vidout output format options

  -k, --concise      be more concise if possible.

  -l, --list-ctrls   display all controls and their values [VIDIOC_QUERYCTRL]

  -L, --list-ctrls-menus

                     display all controls and their menus [VIDIOC_QUERYMENU]

  -w, --wrapper      use the libv4l2 wrapper library.

  --list-devices     list all v4l devices

  --log-status       log the board status in the kernel log [VIDIOC_LOG_STATUS]

  --get-priority     query the current access priority [VIDIOC_G_PRIORITY]

  --set-priority=<prio>

                     set the new access priority [VIDIOC_S_PRIORITY]

                     <prio> is 1 (background), 2 (interactive) or 3 (record)

  --silent           only set the result code, do not print any messages

  --sleep=<secs>     sleep <secs>, call QUERYCAP and close the file handle

  --verbose          turn on verbose ioctl status reporting 


$ v4l2-ctl --help-all


General/Common options:

  --all              display all information available

  -C, --get-ctrl=<ctrl>[,<ctrl>...]

                     get the value of the controls [VIDIOC_G_EXT_CTRLS]

  -c, --set-ctrl=<ctrl>=<val>[,<ctrl>=<val>...]

                     set the value of the controls [VIDIOC_S_EXT_CTRLS]

  -D, --info         show driver info [VIDIOC_QUERYCAP]

  -d, --device=<dev> use device <dev> instead of /dev/video0

                     if <dev> starts with a digit, then /dev/video<dev> is used

  -h, --help         display this help message

  --help-all         all options

  --help-io          input/output options

  --help-misc        miscellaneous options

  --help-overlay     overlay format options

  --help-selection   crop/selection options

  --help-stds        standards and other video timings options

  --help-streaming   streaming options

  --help-tuner       tuner/modulator options

  --help-vbi         VBI format options

  --help-vidcap      video capture format options

  --help-vidout      vidout output format options

  -k, --concise      be more concise if possible.

  -l, --list-ctrls   display all controls and their values [VIDIOC_QUERYCTRL]

  -L, --list-ctrls-menus

                     display all controls and their menus [VIDIOC_QUERYMENU]

  -w, --wrapper      use the libv4l2 wrapper library.

  --list-devices     list all v4l devices

  --log-status       log the board status in the kernel log [VIDIOC_LOG_STATUS]

  --get-priority     query the current access priority [VIDIOC_G_PRIORITY]

  --set-priority=<prio>

                     set the new access priority [VIDIOC_S_PRIORITY]

                     <prio> is 1 (background), 2 (interactive) or 3 (record)

  --silent           only set the result code, do not print any messages

  --sleep=<secs>     sleep <secs>, call QUERYCAP and close the file handle

  --verbose          turn on verbose ioctl status reporting


Tuner/Modulator options:

  -F, --get-freq     query the frequency [VIDIOC_G_FREQUENCY]

  -f, --set-freq=<freq>

                     set the frequency to <freq> MHz [VIDIOC_S_FREQUENCY]

  -T, --get-tuner    query the tuner settings [VIDIOC_G_TUNER]

  -t, --set-tuner=<mode>

                     set the audio mode of the tuner [VIDIOC_S_TUNER]

                     Possible values: mono, stereo, lang2, lang1, bilingual

  --tuner-index=<idx> Use idx as tuner idx for tuner/modulator commands

  --list-freq-bands  display all frequency bands for the tuner/modulator

                     [VIDIOC_ENUM_FREQ_BANDS]

  --get-modulator    query the modulator settings [VIDIOC_G_MODULATOR]

  --set-modulator=<txsubchans>

                     set the sub-carrier modulation [VIDIOC_S_MODULATOR]

                     <txsubchans> is one of:

                     mono:       Modulate as mono

                     mono-rds:   Modulate as mono with RDS (radio only)

                     stereo:     Modulate as stereo

                     stereo-rds: Modulate as stereo with RDS (radio only)

                     bilingual:  Modulate as bilingual

                     mono-sap:   Modulate as mono with Second Audio Program

                     stereo-sap: Modulate as stereo with Second Audio Program

  --freq-seek=dir=<0/1>,wrap=<0/1>,spacing=<hz>,low=<freq>,high=<freq>

                     perform a hardware frequency seek [VIDIOC_S_HW_FREQ_SEEK]

                     dir is 0 (seek downward) or 1 (seek upward)

                     wrap is 0 (do not wrap around) or 1 (wrap around)

                     spacing sets the seek resolution (use 0 for default)

                     low and high set the low and high seek frequency range in MHz


Input/Output options:

  -I, --get-input    query the video input [VIDIOC_G_INPUT]

  -i, --set-input=<num>

                     set the video input to <num> [VIDIOC_S_INPUT]

  -N, --list-outputs display video outputs [VIDIOC_ENUMOUTPUT]

  -n, --list-inputs  display video inputs [VIDIOC_ENUMINPUT]

  -O, --get-output   query the video output [VIDIOC_G_OUTPUT]

  -o, --set-output=<num>

                     set the video output to <num> [VIDIOC_S_OUTPUT]

  --set-audio-output=<num>

                     set the audio output to <num> [VIDIOC_S_AUDOUT]

  --get-audio-input  query the audio input [VIDIOC_G_AUDIO]

  --set-audio-input=<num>

                     set the audio input to <num> [VIDIOC_S_AUDIO]

  --get-audio-output query the audio output [VIDIOC_G_AUDOUT]

  --set-audio-output=<num>

                     set the audio output to <num> [VIDIOC_S_AUDOUT]

  --list-audio-outputs

                     display audio outputs [VIDIOC_ENUMAUDOUT]

  --list-audio-inputs

                     display audio inputs [VIDIOC_ENUMAUDIO]


Standards/Timings options:

  --list-standards   display supported video standards [VIDIOC_ENUMSTD]

  -S, --get-standard

                     query the video standard [VIDIOC_G_STD]

  -s, --set-standard=<num>

                     set the video standard to <num> [VIDIOC_S_STD]

                     <num> a numerical v4l2_std value, or one of:

                     pal or pal-X (X = B/G/H/N/Nc/I/D/K/M/60) (V4L2_STD_PAL)

                     ntsc or ntsc-X (X = M/J/K) (V4L2_STD_NTSC)

                     secam or secam-X (X = B/G/H/D/K/L/Lc) (V4L2_STD_SECAM)

  --get-detected-standard

                     display detected input video standard [VIDIOC_QUERYSTD]

  --list-dv-timings  list supp. standard dv timings [VIDIOC_ENUM_DV_TIMINGS]

  --set-dv-bt-timings

                     query: use the output of VIDIOC_QUERY_DV_TIMINGS

                     index=<index>: use the index as provided by --list-dv-timings

                     or give a fully specified timings:

                     width=<width>,height=<height>,interlaced=<0/1>,

                     polarities=<polarities mask>,pixelclock=<pixelclock Hz>,

                     hfp=<horizontal front porch>,hs=<horizontal sync>,

                     hbp=<horizontal back porch>,vfp=<vertical front porch>,

                     vs=<vertical sync>,vbp=<vertical back porch>,

                     il_vfp=<vertical front porch for bottom field>,

                     il_vs=<vertical sync for bottom field>,

                     il_vbp=<vertical back porch for bottom field>,

                     set the digital video timings according to the BT 656/1120

                     standard [VIDIOC_S_DV_TIMINGS]

  --get-dv-timings   get the digital video timings in use [VIDIOC_G_DV_TIMINGS]

  --query-dv-timings query the detected dv timings [VIDIOC_QUERY_DV_TIMINGS]

  --get-dv-timings-cap

                     get the dv timings capabilities [VIDIOC_DV_TIMINGS_CAP]


Video Capture Formats options:

  --list-formats     display supported video formats [VIDIOC_ENUM_FMT]

  --list-formats-mplane

                     display supported video multi-planar formats

                     [VIDIOC_ENUM_FMT]

  --list-formats-ext display supported video formats including frame sizes

                     and intervals

  --list-formats-ext-mplane

                     display supported video multi-planar formats including

                     frame sizes and intervals

  --list-framesizes=<f>

                     list supported framesizes for pixelformat <f>

                     [VIDIOC_ENUM_FRAMESIZES]

                     pixelformat is the fourcc value as a string

  --list-frameintervals=width=<w>,height=<h>,pixelformat=<f>

                     list supported frame intervals for pixelformat <f> and

                     the given width and height [VIDIOC_ENUM_FRAMEINTERVALS]

                     pixelformat is the fourcc value as a string

  -V, --get-fmt-video

                     query the video capture format [VIDIOC_G_FMT]

  -v, --set-fmt-video=width=<w>,height=<h>,pixelformat=<f>

                     set the video capture format [VIDIOC_S_FMT]

                     pixelformat is either the format index as reported by

                     --list-formats, or the fourcc value as a string

  --try-fmt-video=width=<w>,height=<h>,pixelformat=<f>

                     try the video capture format [VIDIOC_TRY_FMT]

                     pixelformat is either the format index as reported by

                     --list-formats, or the fourcc value as a string

  --get-fmt-video-mplane

                     query the video capture format through the multi-planar API

                     [VIDIOC_G_FMT]

  --set-fmt-video-mplane

  --try-fmt-video-mplane=width=<w>,height=<h>,pixelformat=<f>

                     set/try the video capture format using the multi-planar API

                     [VIDIOC_S/TRY_FMT]

                     pixelformat is either the format index as reported by

                     --list-formats-mplane, or the fourcc value as a string


Video Output Formats options:

  --list-formats-out display supported video output formats [VIDIOC_ENUM_FMT]

  --get-fmt-video-out

                     query the video output format [VIDIOC_G_FMT]

  --set-fmt-video-out

  --try-fmt-video-out=width=<w>,height=<h>,pixelformat=<f>

                     set/try the video output format [VIDIOC_TRY_FMT]

                     pixelformat is either the format index as reported by

                     --list-formats-out, or the fourcc value as a string

  --list-formats-out-mplane

                     display supported video output multi-planar formats

                     [VIDIOC_ENUM_FMT]

  --get-fmt-video-out-mplane

                     query the video output format using the multi-planar API

                     [VIDIOC_G_FMT]

  --set-fmt-video-out-mplane

  --try-fmt-video-out-mplane=width=<w>,height=<h>,pixelformat=<f>

                     set/try the video output format with the multi-planar API

                     [VIDIOC_S/TRY_FMT]

                     pixelformat is either the format index as reported by

                     --list-formats-out-mplane, or the fourcc value as a string


Video Overlay options:

  --list-formats-overlay

                     display supported overlay formats [VIDIOC_ENUM_FMT]

  --overlay=<on>     turn overlay on (1) or off (0) (VIDIOC_OVERLAY)

  --get-fmt-overlay  query the video overlay format [VIDIOC_G_FMT]

  --get-fmt-output-overlay

                     query the video output overlay format [VIDIOC_G_FMT]

  --set-fmt-overlay

  --try-fmt-overlay

  --set-fmt-output-overlay

  --try-fmt-output-overlay=chromakey=<key>,global_alpha=<alpha>,

                           top=<t>,left=<l>,width=<w>,height=<h>,field=<f>

                     set/try the video or video output overlay format

                     [VIDIOC_S/TRY_FMT], <f> can be one of:

                     any, none, top, bottom, interlaced, seq_tb, seq_bt,

                     alternate, interlaced_tb, interlaced_bt

  --get-fbuf         query the overlay framebuffer data [VIDIOC_G_FBUF]

  --set-fbuf=chromakey=<b>,global_alpha=<b>,local_alpha=<b>,local_inv_alpha=<b>

                     set the overlay framebuffer [VIDIOC_S_FBUF]

                     b = 0 or 1


VBI Formats options:

  --get-sliced-vbi-cap

                     query the sliced VBI capture capabilities

                     [VIDIOC_G_SLICED_VBI_CAP]

  --get-sliced-vbi-out-cap

                     query the sliced VBI output capabilities

                     [VIDIOC_G_SLICED_VBI_CAP]

  -B, --get-fmt-sliced-vbi

                     query the sliced VBI capture format [VIDIOC_G_FMT]

  --get-fmt-sliced-vbi-out

                     query the sliced VBI output format [VIDIOC_G_FMT]

  -b, --set-fmt-sliced-vbi

  --try-fmt-sliced-vbi

  --set-fmt-sliced-vbi-out

  --try-fmt-sliced-vbi-out=<mode>

                     set/try the sliced VBI capture/output format to <mode>

                     [VIDIOC_S/TRY_FMT], <mode> is a comma separated list of:

                     off:      turn off sliced VBI (cannot be combined with

                               other modes)

                     teletext: teletext (PAL/SECAM)

                     cc:       closed caption (NTSC)

                     wss:      widescreen signal (PAL/SECAM)

                     vps:      VPS (PAL/SECAM)

  --get-fmt-vbi      query the VBI capture format [VIDIOC_G_FMT]

  --get-fmt-vbi-out  query the VBI output format [VIDIOC_G_FMT]


Selection/Cropping options:

  --get-cropcap      query the crop capabilities [VIDIOC_CROPCAP]

  --get-crop         query the video capture crop window [VIDIOC_G_CROP]

  --set-crop=top=<x>,left=<y>,width=<w>,height=<h>

                     set the video capture crop window [VIDIOC_S_CROP]

  --get-cropcap-output

                     query crop capabilities for video output [VIDIOC_CROPCAP]

  --get-crop-output  query the video output crop window [VIDIOC_G_CROP]

  --set-crop-output=top=<x>,left=<y>,width=<w>,height=<h>

                     set the video output crop window [VIDIOC_S_CROP]

  --get-cropcap-overlay

                     query crop capabilities for video overlay [VIDIOC_CROPCAP]

  --get-crop-overlay query the video overlay crop window [VIDIOC_G_CROP]

  --set-crop-overlay=top=<x>,left=<y>,width=<w>,height=<h>

                     set the video overlay crop window [VIDIOC_S_CROP]

  --get-cropcap-output-overlay

                     query the crop capabilities for video output overlays

                     [VIDIOC_CROPCAP]

  --get-crop-output-overlay

                     query the video output overlay crop window [VIDIOC_G_CROP]

  --set-crop-output-overlay=top=<x>,left=<y>,width=<w>,height=<h>

                     set the video output overlay crop window [VIDIOC_S_CROP]

  --get-selection=target=<target>

                     query the video capture selection rectangle [VIDIOC_G_SELECTION]

                     See --set-selection command for the valid <target> values.

  --set-selection=target=<target>,flags=<flags>,top=<x>,left=<y>,width=<w>,height=<h>

                     set the video capture selection rectangle [VIDIOC_S_SELECTION]

                     target=crop|crop_bounds|crop_default|compose|compose_bounds|

                            compose_default|compose_padded

                     flags=le|ge

  --get-selection-output=target=<target>

                     query the video output selection rectangle [VIDIOC_G_SELECTION]

                     See --set-selection command for the valid <target> values.

  --set-selection-output=target=<target>,flags=<flags>,top=<x>,left=<y>,width=<w>,height=<h>

                     set the video output selection rectangle [VIDIOC_S_SELECTION]

                     See --set-selection command for the arguments.


Miscellaneous options:

  --wait-for-event=<event>

                     wait for an event [VIDIOC_DQEVENT]

                     <event> is the event number or one of:

                     eos, vsync, ctrl=<id>, frame_sync

                     where <id> is the name of the control

  --poll-for-event=<event>

                     poll for an event [VIDIOC_DQEVENT]

                     see --wait-for-event for possible events

  -P, --get-parm     display video parameters [VIDIOC_G_PARM]

  -p, --set-parm=<fps>

                     set video framerate in <fps> [VIDIOC_S_PARM]

  --get-output-parm  display output video parameters [VIDIOC_G_PARM]

  --set-output-parm=<fps>

                     set output video framerate in <fps> [VIDIOC_S_PARM]

  --get-jpeg-comp    query the JPEG compression [VIDIOC_G_JPEGCOMP]

  --set-jpeg-comp=quality=<q>,markers=<markers>,comment=<c>,app<n>=<a>

                     set the JPEG compression [VIDIOC_S_JPEGCOMP]

                     <n> is the app segment: 0-9/a-f, <a> is the actual string.

                     <markers> is a colon separated list of:

                     dht:      Define Huffman Tables

                     dqt:      Define Quantization Tables

                     dri:      Define Restart Interval

  --encoder-cmd=cmd=<cmd>,flags=<flags>

                     Send a command to the encoder [VIDIOC_ENCODER_CMD]

                     cmd=start|stop|pause|resume

                     flags=stop_at_gop_end

  --try-encoder-cmd=cmd=<cmd>,flags=<flags>

                     Try an encoder command [VIDIOC_TRY_ENCODER_CMD]

                     See --encoder-cmd for the arguments.

  --decoder-cmd=cmd=<cmd>,flags=<flags>,stop_pts=<pts>,start_speed=<speed>,

                     start_format=<none|gop>

                     Send a command to the decoder [VIDIOC_DECODER_CMD]

                     cmd=start|stop|pause|resume

                     flags=start_mute_audio|pause_to_black|stop_to_black|

                           stop_immediately

  --try-decoder-cmd=cmd=<cmd>,flags=<flags>

                     Try a decoder command [VIDIOC_TRY_DECODER_CMD]

                     See --decoder-cmd for the arguments.


Video Streaming options:

  --stream-count=<count>

                     stream <count> buffers. The default is to keep streaming

                     forever. This count does not include the number of initial

                     skipped buffers as is passed by --stream-skip.

  --stream-skip=<count>

                     skip the first <count> buffers. The default is 0.

  --stream-to=<file> stream to this file. The default is to discard the

                     data. If <file> is '-', then the data is written to stdout

                     and the --silent option is turned on automatically.

  --stream-poll      use non-blocking mode and select() to stream.

  --stream-mmap=<count>

                     capture video using mmap() [VIDIOC_(D)QBUF]

                     count: the number of buffers to allocate. The default is 3.

  --stream-user=<count>

                     capture video using user pointers [VIDIOC_(D)QBUF]

                     count: the number of buffers to allocate. The default is 3.

  --stream-from=<file> stream from this file. The default is to generate a pattern.

                     If <file> is '-', then the data is read from stdin.

  --stream-loop      loop when the end of the file we are streaming from is reached.

                     The default is to stop.

  --stream-pattern=<count>

                     choose output pattern. The default is 0.

  --stream-out-mmap=<count>

                     output video using mmap() [VIDIOC_(D)QBUF]

                     count: the number of buffers to allocate. The default is 3.

  --stream-out-user=<count>

                     output video using user pointers [VIDIOC_(D)QBUF]

                     count: the number of buffers to allocate. The default is 3.

  --list-buffers     list all video buffers [VIDIOC_QUERYBUF]

  --list-buffers-out list all video output buffers [VIDIOC_QUERYBUF]

  --list-buffers-vbi list all VBI buffers [VIDIOC_QUERYBUF]

  --list-buffers-vbi-out

                     list all VBI output buffers [VIDIOC_QUERYBUF]

  --list-buffers-sliced-vbi

                     list all sliced VBI buffers [VIDIOC_QUERYBUF]

  --list-buffers-sliced-vbi-out

                     list all sliced VBI output buffers [VIDIOC_QUERYBUF]


$ v4l2-ctl --list-devices

mmal service 16.1 (platform:bcm2835-v4l2):

        /dev/video0


$ v4l2-ctl -D

Driver Info (not using libv4l2):

        Driver name   : bm2835 mmal

        Card type     : mmal service 16.1

        Bus info      : platform:bcm2835-v4l2

        Driver version: 4.1.6

        Capabilities  : 0x85200005

                Video Capture

                Video Overlay

                Read/Write

                Streaming

                Device Capabilities

        Device Caps   : 0x05200005

                Video Capture

                Video Overlay

                Read/Write

                Streaming


$ v4l2-ctl --get-fmt-video

Format Video Capture:

        Width/Height  : 1920/1088

        Pixel Format  : 'H264'

        Field         : None

        Bytes per Line: 0

        Size Image    : 2088960

        Colorspace    : Broadcast NTSC/PAL (SMPTE170M/ITU601)

        Custom Info   : feedcafe


$ v4l2-ctl --list-formats

ioctl: VIDIOC_ENUM_FMT

        Index       : 0

        Type        : Video Capture

        Pixel Format: 'YU12'

        Name        : 4:2:0, planar, YUV


        Index       : 1

        Type        : Video Capture

        Pixel Format: 'YUYV'

        Name        : 4:2:2, packed, YUYV


        Index       : 2

        Type        : Video Capture

        Pixel Format: 'RGB3'

        Name        : RGB24 (LE)


        Index       : 3

        Type        : Video Capture

        Pixel Format: 'JPEG' (compressed)

        Name        : JPEG


        Index       : 4

        Type        : Video Capture

        Pixel Format: 'H264' (compressed)

        Name        : H264


        Index       : 5

        Type        : Video Capture

        Pixel Format: 'MJPG' (compressed)

        Name        : MJPEG


        Index       : 6

        Type        : Video Capture

        Pixel Format: 'YVYU'

        Name        : 4:2:2, packed, YVYU


        Index       : 7

        Type        : Video Capture

        Pixel Format: 'VYUY'

        Name        : 4:2:2, packed, VYUY


        Index       : 8

        Type        : Video Capture

        Pixel Format: 'UYVY'

        Name        : 4:2:2, packed, UYVY


        Index       : 9

        Type        : Video Capture

        Pixel Format: 'NV12'

        Name        : 4:2:0, planar, NV12


        Index       : 10

        Type        : Video Capture

        Pixel Format: 'BGR3'

        Name        : RGB24 (BE)


        Index       : 11

        Type        : Video Capture

        Pixel Format: 'YV12'

        Name        : 4:2:0, planar, YVU


        Index       : 12

        Type        : Video Capture

        Pixel Format: 'NV21'

        Name        : 4:2:0, planar, NV21


        Index       : 13

        Type        : Video Capture

        Pixel Format: 'BGR4'

        Name        : RGB32 (BE)


$ v4l2-ctl -L


User Controls


                     brightness (int)    : min=0 max=100 step=1 default=50 value=50 flags=slider

                       contrast (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider

                     saturation (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider

                    red_balance (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider

                   blue_balance (int)    : min=1 max=7999 step=1 default=1000 value=1000 flags=slider

                horizontal_flip (bool)   : default=0 value=0

                  vertical_flip (bool)   : default=0 value=0

           power_line_frequency (menu)   : min=0 max=3 default=1 value=1

                                0: Disabled

                                1: 50 Hz

                                2: 60 Hz

                                3: Auto

                      sharpness (int)    : min=-100 max=100 step=1 default=0 value=0 flags=slider

                  color_effects (menu)   : min=0 max=15 default=0 value=0

                                0: None

                                1: Black & White

                                2: Sepia

                                3: Negative

                                4: Emboss

                                5: Sketch

                                6: Sky Blue

                                7: Grass Green

                                8: Skin Whiten

                                9: Vivid

                                10: Aqua

                                11: Art Freeze

                                12: Silhouette

                                13: Solarization

                                14: Antique

                                15: Set Cb/Cr

                         rotate (int)    : min=0 max=360 step=90 default=0 value=0

             color_effects_cbcr (int)    : min=0 max=65535 step=1 default=32896 value=32896


Codec Controls


             video_bitrate_mode (menu)   : min=0 max=1 default=0 value=0 flags=update

                                0: Variable Bitrate

                                1: Constant Bitrate

                  video_bitrate (int)    : min=25000 max=25000000 step=25000 default=10000000 value=10000000

         repeat_sequence_header (bool)   : default=0 value=0

            h264_i_frame_period (int)    : min=0 max=2147483647 step=1 default=60 value=60

                     h264_level (menu)   : min=0 max=11 default=11 value=11

                                0: 1

                                1: 1b

                                2: 1.1

                                3: 1.2

                                4: 1.3

                                5: 2

                                6: 2.1

                                7: 2.2

                                8: 3

                                9: 3.1

                                10: 3.2

                                11: 4

                   h264_profile (menu)   : min=0 max=4 default=4 value=4

                                0: Baseline

                                1: Constrained Baseline

                                2: Main

                                4: High


Camera Controls


                  auto_exposure (menu)   : min=0 max=3 default=0 value=0

                                0: Auto Mode

                                1: Manual Mode

         exposure_time_absolute (int)    : min=1 max=10000 step=1 default=1000 value=1000

     exposure_dynamic_framerate (bool)   : default=0 value=0

             auto_exposure_bias (intmenu): min=0 max=24 default=12 value=12

                                0: -4000 (0xfffffffffffff060)

                                1: -3667 (0xfffffffffffff1ad)

                                2: -3333 (0xfffffffffffff2fb)

                                3: -3000 (0xfffffffffffff448)

                                4: -2667 (0xfffffffffffff595)

                                5: -2333 (0xfffffffffffff6e3)

                                6: -2000 (0xfffffffffffff830)

                                7: -1667 (0xfffffffffffff97d)

                                8: -1333 (0xfffffffffffffacb)

                                9: -1000 (0xfffffffffffffc18)

                                10: -667 (0xfffffffffffffd65)

                                11: -333 (0xfffffffffffffeb3)

                                12: 0 (0x0)

                                13: 333 (0x14d)

                                14: 667 (0x29b)

                                15: 1000 (0x3e8)

                                16: 1333 (0x535)

                                17: 1667 (0x683)

                                18: 2000 (0x7d0)

                                19: 2333 (0x91d)

                                20: 2667 (0xa6b)

                                21: 3000 (0xbb8)

                                22: 3333 (0xd05)

                                23: 3667 (0xe53)

                                24: 4000 (0xfa0)

      white_balance_auto_preset (menu)   : min=0 max=9 default=1 value=1

                                0: Manual

                                1: Auto

                                2: Incandescent

                                3: Fluorescent

                                4: Fluorescent H

                                5: Horizon

                                6: Daylight

                                7: Flash

                                8: Cloudy

                                9: Shade

            image_stabilization (bool)   : default=0 value=0

                iso_sensitivity (intmenu): min=0 max=4 default=0 value=0

                                0: 0 (0x0)

                                1: 100 (0x64)

                                2: 200 (0xc8)

                                3: 400 (0x190)

                                4: 800 (0x320)

         exposure_metering_mode (menu)   : min=0 max=2 default=0 value=0

                                0: Average

                                1: Center Weighted

                                2: Spot

                     scene_mode (menu)   : min=0 max=13 default=0 value=0

                                0: None

                                8: Night

                                11: Sports


JPEG Compression Controls


            compression_quality (int)    : min=1 max=100 step=1 default=30 value=30


$ v4l2-ctl --get-priority

Priority: 2


$ v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=4


2015/08/09 - [개소리 왈왈/라즈베리 파이(rpi)] - 라즈베리 파이 csi v4l


'embeded > raspberry pi' 카테고리의 다른 글

opencv 템플릿 매칭 / wiring pi PWM ing..  (0) 2015.10.05
webiopi - rpi IoT  (2) 2015.10.01
라즈베리 파이 2 + usb webcam + servo 2ch  (2) 2015.09.28
라즈베리 파이 PWM 데이터 시트  (0) 2015.09.28
wiring pi PWM / c 코드  (0) 2015.09.28
Posted by 구차니
embeded/raspberry pi2015. 9. 28. 12:57

라즈베리 파이 2에는 PWM 2채널이 사용이 가능해서

2채널 Servo와

2채널 USB webcam(v4l)을 통해서 비디오를 받아 서보로 제어하도록 해봄



$ g++ cv.cpp -lopencv_core -lopencv_video -lopencv_highgui -lwiringPi 


$ cat cv.cpp

#include <opencv2/core/core.hpp>

#include <opencv2/highgui/highgui.hpp>

#include <iostream>


#include <wiringPi.h>


#define MIN_POS 30

#define MAX_POS 110


using namespace cv;

using namespace std;


void init_wiringpi()

{

        if(wiringPiSetup() == -1) exit(0);


        pinMode(1, PWM_OUTPUT);

        pwmSetMode(PWM_MODE_MS);

//      pwmSetRange(1024);

//      pwmSetClock(400);


        pinMode(23, PWM_OUTPUT);

        pwmSetMode(PWM_MODE_MS);

        pwmSetRange(1024);

        pwmSetClock(400);


        pwmWrite(1,     MIN_POS + (MAX_POS - MIN_POS) / 2);

        pwmWrite(23,    MIN_POS + (MAX_POS - MIN_POS) / 2);

}


void setPWM_1(int val)

{

        pwmWrite(23, val);

}


void setPWM_2(int val)

{

        pwmWrite(1, val);

}



void on_trackbar_1(int pos, void *ptr)

{

        int val = MIN_POS + pos * (MAX_POS - MIN_POS) / 100;

        setPWM_1(val);


        cout << "pos 1 [" << pos << ":" << val << "]" << endl;

}


void on_trackbar_2(int pos, void *ptr)

{

        int val = MIN_POS + pos * (MAX_POS - MIN_POS) / 100;

        setPWM_2(val);


        cout << "pos 2 [" << pos << ":" << val << "]" << endl;

}


void on_trackbar_3(int pos, void *ptr)

{

        int val = MIN_POS + pos * (MAX_POS - MIN_POS) / 100;

//      setPWM_1(val);

//      setPWM_2(val);


        setTrackbarPos("track 1", "cam 1", pos);

        setTrackbarPos("track 2", "cam 2", pos);


        cout << "pos 3 [" << pos << ":" << val << "]" << endl;

}


int main(int argc, char** argv)

{

        // opencv 2 style

        VideoCapture cap(0);

        int pos[2];


        init_wiringpi();


        if(!cap.isOpened())

        {

                cout << "No camera detected" << endl;

                return -1;

        }

        else

        {

                cout << "In capture ..." << endl;

                cap.set(CV_CAP_PROP_FRAME_WIDTH, 320);

                cap.set(CV_CAP_PROP_FRAME_HEIGHT, 240);

        }


        VideoCapture cap2(1);

        if(!cap2.isOpened())

        {

                cout << "No camera detected" << endl;

                return -1;

        }

        else

        {

                cout << "In capture ..." << endl;

                cap2.set(CV_CAP_PROP_FRAME_WIDTH, 320);

                cap2.set(CV_CAP_PROP_FRAME_HEIGHT, 240);

        }


        namedWindow("cam 1", WINDOW_AUTOSIZE );

        namedWindow("cam 2", WINDOW_AUTOSIZE );

        namedWindow("control", WINDOW_AUTOSIZE );


        createTrackbar("track 1", "cam 1", &pos[0], 100, on_trackbar_1 );

        createTrackbar("track 2", "cam 2", &pos[1], 100, on_trackbar_2 );

        createTrackbar("track 3", "control", &pos[0], 100, on_trackbar_3 );


        setTrackbarPos("track 1", "cam 1", 50);

        setTrackbarPos("track 2", "cam 2", 50);

        setTrackbarPos("track 3", "control", 50);


        for(;;)

        {

                Mat frame;

                if(!cap.read(frame)) break;

                imshow("cam 1", frame);


                if(!cap2.read(frame)) break;

                imshow("cam 2", frame);


                if(waitKey(30) >= 0) break;

        }


        return 0;

} 


이제...

다음 목표는 오른쪽 카메라 중앙을 ROI 로 설정하여

왼쪽의 카메라와 같은 곳을 바라보도록 서보를 제어하는 것!

'embeded > raspberry pi' 카테고리의 다른 글

webiopi - rpi IoT  (2) 2015.10.01
라즈베리 파이 v4l2-ctl 관련  (0) 2015.10.01
라즈베리 파이 PWM 데이터 시트  (0) 2015.09.28
wiring pi PWM / c 코드  (0) 2015.09.28
뻘짓은 하긴 했는데... (카메라 + 서보)*2  (0) 2015.09.24
Posted by 구차니
embeded/raspberry pi2015. 9. 28. 12:56

pwm 클럭은 채널 1/2에 동일하게 들어가는 듯?


데이터 시트 141p

PWM clock source and frequency is controlled in CPRMAN. 


데이터 시트 138p

채널은 2개 이지만 연결 가능한 GPIO는 여러개로 보인다.

 GPIO가 여러개 라고 해도 동시에 활성화 가능한건 2채널이려나?


+

40번 이후 부터는 compute module에서나 쓸수 있을테고

라즈베리 파이 2에서는

좌/우 로 2개씩 총 4개의 핀이지만 2개의 채널이니까 12,13번 핀을 나란히 써주는 것도 무난 할 듯?

 +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+

 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |

 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

 |     |     |    3.3v |      |   |  1 || 2  |   |      | 5v      |     |     |

 |   2 |   8 |   SDA.1 |   IN | 1 |  3 || 4  |   |      | 5V      |     |     |

 |   3 |   9 |   SCL.1 |   IN | 1 |  5 || 6  |   |      | 0v      |     |     |

 |   4 |   7 | GPIO. 7 |   IN | 1 |  7 || 8  | 1 | ALT0 | TxD     | 15  | 14  |

 |     |     |      0v |      |   |  9 || 10 | 1 | ALT0 | RxD     | 16  | 15  |

 |  17 |   0 | GPIO. 0 |   IN | 0 | 11 || 12 | 0 | IN   | GPIO. 1 | 1   | 18  |

 |  27 |   2 | GPIO. 2 |   IN | 0 | 13 || 14 |   |      | 0v      |     |     |

 |  22 |   3 | GPIO. 3 |   IN | 0 | 15 || 16 | 0 | IN   | GPIO. 4 | 4   | 23  |

 |     |     |    3.3v |      |   | 17 || 18 | 0 | IN   | GPIO. 5 | 5   | 24  |

 |  10 |  12 |    MOSI |   IN | 0 | 19 || 20 |   |      | 0v      |     |     |

 |   9 |  13 |    MISO |   IN | 0 | 21 || 22 | 0 | IN   | GPIO. 6 | 6   | 25  |

 |  11 |  14 |    SCLK |   IN | 0 | 23 || 24 | 1 | IN   | CE0     | 10  | 8   |

 |     |     |      0v |      |   | 25 || 26 | 1 | IN   | CE1     | 11  | 7   |

 |   0 |  30 |   SDA.0 |   IN | 1 | 27 || 28 | 1 | IN   | SCL.0   | 31  | 1   |

 |   5 |  21 | GPIO.21 |   IN | 1 | 29 || 30 |   |      | 0v      |     |     |

 |   6 |  22 | GPIO.22 |   IN | 1 | 31 || 32 | 0 | IN   | GPIO.26 | 26  | 12  |

 |  13 |  23 | GPIO.23 |   IN | 0 | 33 || 34 |   |      | 0v      |     |     |

 |  19 |  24 | GPIO.24 |   IN | 0 | 35 || 36 | 0 | IN   | GPIO.27 | 27  | 16  |

 |  26 |  25 | GPIO.25 |   IN | 0 | 37 || 38 | 0 | IN   | GPIO.28 | 28  | 20  |

 |     |     |      0v |      |   | 39 || 40 | 0 | IN   | GPIO.29 | 29  | 21  |

 +-----+-----+---------+------+---+----++----+---+------+---------+-----+-----+

 | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |

 +-----+-----+---------+------+---+---Pi 2---+---+------+---------+-----+-----+



+


클럭관련해서는 PWM 쪽이 아닌 상위에서 넣어준다.

[링크 : http://www.farnell.com/datasheets/1521578.pdf]



---


wiring pi 상으로는 ABC 정렬도 아닌거 같고..

그냥 초기화 해야 하는 순서대로

Mode / Range / Clock 순인것 같다.

PWM Control


PWM can not be controlled when running in Sys mode.

  • pwmSetMode (int mode) ;

The PWM generator can run in 2 modes – “balanced” and “mark:space”. The mark:space mode is traditional, however the default mode in the Pi is “balanced”. You can switch modes by supplying the parameter: PWM_MODE_BAL or PWM_MODE_MS.

  • pwmSetRange (unsigned int range) ;

This sets the range register in the PWM generator. The default is 1024.

  • pwmSetClock (int divisor) ;

This sets the divisor for the PWM clock.

To understand more about the PWM system, you’ll need to read the Broadcom ARM peripherals manual.

[링크 : https://projects.drogon.net/raspberry-pi/wiringpi/functions/] 


Posted by 구차니
embeded/raspberry pi2015. 9. 28. 08:29


void pinMode (int pin, int mode) ;

This sets the mode of a pin to either INPUT, OUTPUT, or PWM_OUTPUT. Note that only wiringPi pin 1 (BCM_GPIO 18) supports PWM output.


void pwmWrite (int pin, int value) ;

Writes the value to the PWM register for the given pin. The value must be between 0 and 1024. (Again, note that only pin 1 (BCM_GPIO 18) supports PWM)


pwmSetMode (int mode) ;

The PWM generator can run in 2 modes – “balanced” and “mark:space”. The mark:space mode is traditional, however the default mode in the Pi is “balanced”. You can switch modes by supplying the parameter: PWM_MODE_BAL or PWM_MODE_MS.


pwmSetRange (unsigned int range) ;

This sets the range register in the PWM generator. The default is 1024.


pwmSetClock (int divisor) ;

This sets the divisor for the PWM clock.


[링크 : https://projects.drogon.net/raspberry-pi/wiringpi/functions/]


LED PWM 예제 - c언어 / wiring pi

[링크 : https://learn.sparkfun.com/tutorials/raspberry-gpio/c-wiringpi-example]


python / pwm 2 ch 예제

[링크 : http://electronut.in/controlling-two-servos-with-hardware-pwm-on-the-raspberry-pi-model-a/]

Posted by 구차니
embeded/Cortex-M3 Ti2015. 9. 25. 11:30

driverlib 용량이 적진 않아 많이 줄을줄 알았더니..

gcc - 129KB

rvmdk - -1714 KB

ewarm - 945 KB


개노가다 한거 치고는.. 의외로 감소량이 적네... 2KB..

노력대비로는 크다면 클 수 있는 용량이지만 내가 필요로 하는 용량을 충족하진 못하니.. ㅠㅠ

Program Size: Code=64900 RO-data=35872 RW-data=1372 ZI-data=16028  적용전

Program Size: Code=62764 RO-data=35684 RW-data=1372 ZI-data=16028  적용후


감소량

Code      2136 byte

RO-data   188 byte


일단.. 함수들을 ROM_ 접두를 붙이고

#include "driverlib/rom.h"

#define TARGET_IS_DUSTDEVIL_RA0


타겟을 define 해주면 되고

driverlib 에서 누락된 소스들 끌어와주고 그러면 된다(어?)

TARGET_IS_DUSTDEVIL_RA0 The application is being built to run on a DustDevil-class device, silicon revision A0.

TARGET_IS_TEMPEST_RB1 The application is being built to run on a Tempest-class device, silicon revision B1.

TARGET_IS_TEMPEST_RC1 The application is being built to run on a Tempest-class device, silicon revision C1.

TARGET_IS_TEMPEST_RC3 The application is being built to run on a Tempest-class device, silicon revision C3.

TARGET_IS_TEMPEST_RC5 The application is being built to run on a Tempest-class device, silicon revision C5.

TARGET_IS_FIRESTORM_RA2 The application is being built to run on a Firestorm-class device, silicon revision A2.

TARGET_IS_BLIZZARD_RA1 The application is being built to run on a Blizzard-class device, silicon revision A1.


[링크 : http://www.ti.com/lit/ug/spmu019p/spmu019p.pdf] 



그리고는 ROM_ 접두를 붙여주면 끝

단, target class나 함수에 따라 지원하지 않는 녀석들도 있으니 주의


'embeded > Cortex-M3 Ti' 카테고리의 다른 글

lm3s spi / ssi  (0) 2015.10.06
lm3s stellarisware SPI  (0) 2015.10.05
LM3S Stellarisware - GPIOIntTypeSet  (0) 2015.08.03
bitband / cortex-m3  (0) 2013.08.16
LM3S1968과 H-JTAG(wiggler)  (0) 2013.06.28
Posted by 구차니
embeded/raspberry pi2015. 9. 24. 10:35

그래도 너무 이것저것 하는 기분이라..

잠시 접어두고 블로그나 해야하려나..

끄응...




Posted by 구차니
embeded/AVR (ATmega,ATtiny)2015. 9. 23. 11:36


AT90USB


[링크 : http://www.atmel.com/Images/doc7604.pdf]

[링크 : http://nexp.tistory.com/1119]



Virtual USB 라이브러리?


V-USB is a software-only implementation of a low-speed USB device for Atmel’s AVR® microcontrollers, making it possible to build USB hardware with almost any AVR® microcontroller, not requiring any additional chip.



[링크 : https://www.obdev.at/products/vusb/index.html]

    [링크 : http://magicom9.tistory.com/52]

'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

wiring  (0) 2016.02.29
Arduino Uno freeRTOS 강좌  (0) 2015.11.11
키보드 DIY 자료  (0) 2015.09.23
avr-gcc -mmcu 관련 작동 내용  (0) 2015.08.02
ubuntu 에서 AVR 컴파일하기  (0) 2015.07.30
Posted by 구차니
embeded/AVR (ATmega,ATtiny)2015. 9. 23. 11:33

ATmega 칩을 이용해서 USB라던가 여러가지 인터페이스로 키보드를 DIY하는 프로젝트

ATmega 공부겸.. USB 공부겸 나중에 소스나 봐야겠다..


[링크 : https://github.com/tmk/tmk_keyboard]

[링크 : http://cubiq.org/build-your-very-own-pc-keyboard]

'embeded > AVR (ATmega,ATtiny)' 카테고리의 다른 글

Arduino Uno freeRTOS 강좌  (0) 2015.11.11
마우스 DIY 자료  (0) 2015.09.23
avr-gcc -mmcu 관련 작동 내용  (0) 2015.08.02
ubuntu 에서 AVR 컴파일하기  (0) 2015.07.30
USART UBRR error rate  (0) 2015.07.29
Posted by 구차니
embeded/raspberry pi2015. 9. 22. 10:27

jack 해보겠다고 하는데 안되서 보니

어!??!?!?!?!?



/proc/asound/card0 $ ls -al

합계 0

dr-xr-xr-x  4 root root 0  9월 22 10:03 .

dr-xr-xr-x  5 root root 0  9월 22 10:01 ..

-r--r--r--  1 root root 0  9월 22 10:25 id

dr-xr-xr-x 10 root root 0  9월 22 10:25 pcm0p

dr-xr-xr-x  3 root root 0  9월 22 10:25 pcm1p 



생각해보니.. 3.5 파이 잭에도

오디오(L/R) / composite 비디오 인거지..

L/R/Mic 가 아니었네 -ㅁ-?!?!?

Posted by 구차니
embeded/raspberry pi2015. 9. 22. 07:33



[링크 : http://qjackctl.sourceforge.net/]


$ sudo apt-get isntall qjackctl



setup에서 Setting을 보면

Frame/Period, Sample Rate, Period/Buffer를 설정함에 따라 Latency가 자동으로 계산되어 나온다





근데.. 라즈베리는 마이크가 없잖아? 안될거야 ㅠㅠ


네트워크로 할 경우에는 netone이나 netJack을 쓰면 된다고 한다.

[링크 : https://ccrma.stanford.edu/book/export/html/2835]

[링크 : http://jackaudio.org/faq/netjack.html]

[링크 : https://github.com/jackaudio/jackaudio.github.com/wiki]

    [링크 : https://github.com/jackaudio/jackaudio.github.com/wiki/WalkThrough_User_NetJack2]

----

[링크 : https://help.ubuntu.com/community/HowToJACKConfiguration]

[링크 : https://help.ubuntu.com/community/What%20is%20JACK]


[링크 : http://jackaudio.org/faq/pulseaudio_and_jack.html]

[링크 : http://jackaudio.org/faq/jack_on_windows.html]

[링크 : http://jackaudio.org/files/docs/html/index.html]


[링크 : http://www.youtube.com/watch?v=fMz6fDGBnA4]

[링크 : https://en.wikipedia.org/wiki/ReWire]

Posted by 구차니