Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search

Difference between revisions of "Rock5/guide/hdmiin"

< Rock5‎ | guide
(How to check audio function)
(Capture image file with setting resolution and pixel format)
 
Line 64: Line 64:
 
         Flags:
 
         Flags:
 
===== '''Capture image file with setting resolution and pixel format''' =====
 
===== '''Capture image file with setting resolution and pixel format''' =====
 +
Set HDMI2 to 4k display and connect to hdmiin.
 
  $ v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat='NV12' --stream-mmap=4 --stream-skip=3 --stream-count=5 --stream-to=/home/rock/hdmiin4k.yuv --stream-poll
 
  $ v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat='NV12' --stream-mmap=4 --stream-skip=3 --stream-count=5 --stream-to=/home/rock/hdmiin4k.yuv --stream-poll
 +
 
===== '''How to check image file''' =====
 
===== '''How to check image file''' =====
 
Use 7yuv tool on Window.
 
Use 7yuv tool on Window.

Latest revision as of 09:52, 21 July 2022

    ROCK 5 >  Guide >  How to use hdmi in

ROCK 5B has an HDMI-IN connector that supports the standard HDMI 2.0 protocol and can support video input up to 2160p@60Hz.

Requirement

  • ROCK 5B
  • Micro HDMI Cable

How to test HDMI-IN

HDMI-IN devices will be registered as video devices in the kernel, with the generated node /dev/video0, which can be used to get device information and capture frames with the v4l2-ctl command.

Check device info
$ v4l2-ctl -d /dev/video0 -D
Driver Info:
       Driver name      : rk_hdmirx
       Card type        : rk_hdmirx
       Bus info         : fdee0000.hdmirx-controller
       Driver version   : 5.10.66
       Capabilities     : 0x84201000
               Video Capture Multiplanar
               Streaming
               Extended Pix Format
               Device Capabilities
       Device Caps      : 0x04201000
               Video Capture Multiplanar
               Streaming
               Extended Pix Format
Confirm resolution and image format
$ v4l2-ctl -d /dev/video0 --get-fmt-video
Format Video Capture Multiplanar:
       Width/Height      : 3840/2160
       Pixel Format      : 'NV12' (Y/CbCr 4:2:0)
       Field             : None
       Number of planes  : 1
       Flags             : premultiplied-alpha, 0x000000fe
       Colorspace        : SMPTE 170M
       Transfer Function : Default
       YCbCr/HSV Encoding: Unknown (0x000000ff)
       Quantization      : Default
       Plane 0           :
          Bytes per Line : 3840
          Size Image     : 12441600
Get current timings
$ v4l2-ctl -d /dev/video0 --get-dv-timings
DV timings:
       Active width: 3840
       Active height: 2160
       Total width: 4120
       Total height: 2250
       Frame format: progressive
       Polarities: -vsync -hsync
       Pixelclock: 297000000 Hz (32.04 frames per second)
       Horizontal frontporch: 88
       Horizontal sync: 44
       Horizontal backporch: 148
       Vertical frontporch: 8
       Vertical sync: 10
       Vertical backporch: 72
       Standards: 
       Flags:
Capture image file with setting resolution and pixel format

Set HDMI2 to 4k display and connect to hdmiin.

$ v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=3840,height=2160,pixelformat='NV12' --stream-mmap=4 --stream-skip=3 --stream-count=5 --stream-to=/home/rock/hdmiin4k.yuv --stream-poll
How to check image file

Use 7yuv tool on Window.

Use ffplay tool on linux.

$ ffplay -f rawvideo -video_size 3840x2160 -pixel_format nv12 /home/rock/hdmiin4k.yuv
How to check audio function

When your hdmiin has audio input, you can use arecord to get audio from hdmiin port and play it on headphones.

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 2: rockchipes8316 [rockchip-es8316], device 0: fe470000.i2s-ES8316 HiFi es8316.7-0011-0 [fe470000.i2s-ES8316 HiFi es8316.7-0011-0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0
card 3: rockchiphdmiin [rockchip,hdmiin], device 0: fddf8000.i2s-dummy_codec hdmiin-dc-0 [fddf8000.i2s-dummy_codec hdmiin-dc-0]
 Subdevices: 1/1
 Subdevice #0: subdevice #0

As you can see, hdminrx (hdmiin) has a sound card number of 2. You can run the following command to record and play audio when HDMI-IN has audio input.

# get 5 seconds audio file
$ arecord -Dhw:3,0 -d 5 -f cd -r 44100 -c 2 -t wav /tmp/hdmiin_audio.wav
# play on headphone
$ aplay -D plughw:2,0 /tmp/hdmiin_audio.wav