NKnuelle
Posts: 22
Joined: Tue Mar 24, 2020 9:30 am

Using Auvidea B101 Rev.4 for 1080p50 input via HDMI

Tue Mar 24, 2020 9:53 am

Hello,

I found some information regarding this topic but the information was mostly outdated, because the kernel now includes the driver for the Auvidea module. I am using Kernel 4.19 and an fresh installed Raspbian on a Raspberry Pi 4 Model B with 4 GB Ram:

Code: Select all

uname -r
4.19.97-v7l+
I am able to record the Video stream from my professional camera (Sony FS5 MK2) which outputs 1080p50 or 720p50 video via HDMI.

There are no errors while using ffmpeg or raspivid except this message:

Code: Select all

The driver for the TC358743 HDMI to CSI2 chip you are using is NOT supported.
They were written for a demo purposes only, and are in the firmware on an as-is
basis and therefore requests for support or changes will not be acted on.
This is the ouput via v4l2:

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
        Type: Video Capture

        [0]: 'YU12' (Planar YUV 4:2:0)
        [1]: 'YUYV' (YUYV 4:2:2)
        [2]: 'RGB3' (24-bit RGB 8-8-8)
        [3]: 'JPEG' (JFIF JPEG, compressed)
        [4]: 'H264' (H.264, compressed)
        [5]: 'MJPG' (Motion-JPEG, compressed)
        [6]: 'YVYU' (YVYU 4:2:2)
        [7]: 'VYUY' (VYUY 4:2:2)
        [8]: 'UYVY' (UYVY 4:2:2)
        [9]: 'NV12' (Y/CbCr 4:2:0)
        [10]: 'BGR3' (24-bit BGR 8-8-8)
        [11]: 'YV12' (Planar YVU 4:2:0)
        [12]: 'NV21' (Y/CrCb 4:2:0)
        [13]: 'BGR4' (32-bit BGRA/X 8-8-8-8)
pi@raspberrypi:~ $ v4l2-ctl --list-devices
bcm2835-codec-decode (platform:bcm2835-codec):
        /dev/video10
        /dev/video11
        /dev/video12

mmal service 16.1 (platform:bcm2835-v4l2):
        /dev/video0
More info via v4l2-ctl:

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl --list-dv-timing
ioctl: VIDIOC_ENUM_DV_TIMINGS
pi@raspberrypi:~ $ v4l2-ctl --log-status

Status Log:

   [ 3719.257472] bcm2835-v4l2: =================  START STATUS  =================
   [ 3719.257486] bcm2835-v4l2: Saturation: 0
   [ 3719.257503] bcm2835-v4l2: Sharpness: 0
   [ 3719.257518] bcm2835-v4l2: Contrast: 0
   [ 3719.257532] bcm2835-v4l2: Brightness: 50
   [ 3719.257546] bcm2835-v4l2: ISO Sensitivity: 0
   [ 3719.257561] bcm2835-v4l2: ISO Sensitivity, Auto: Auto
   [ 3719.257576] bcm2835-v4l2: Image Stabilization: false
   [ 3719.257590] bcm2835-v4l2: Auto Exposure: Auto Mode
   [ 3719.257604] bcm2835-v4l2: Exposure Time, Absolute: 1000
   [ 3719.257618] bcm2835-v4l2: Auto Exposure, Bias: 0
   [ 3719.257632] bcm2835-v4l2: Exposure, Dynamic Framerate: false
   [ 3719.257647] bcm2835-v4l2: Exposure, Metering Mode: Average
   [ 3719.257661] bcm2835-v4l2: White Balance, Auto & Preset: Auto
   [ 3719.257674] bcm2835-v4l2: Red Balance: 1000
   [ 3719.257688] bcm2835-v4l2: Blue Balance: 1000
   [ 3719.257702] bcm2835-v4l2: Color Effects: None
   [ 3719.257717] bcm2835-v4l2: Color Effects, CbCr: 32896
   [ 3719.257731] bcm2835-v4l2: Rotate: 0
   [ 3719.257744] bcm2835-v4l2: Horizontal Flip: false
   [ 3719.257759] bcm2835-v4l2: Vertical Flip: false
   [ 3719.257772] bcm2835-v4l2: Video Bitrate Mode: Variable Bitrate
   [ 3719.257786] bcm2835-v4l2: Video Bitrate: 10000000
   [ 3719.257800] bcm2835-v4l2: Compression Quality: 30
   [ 3719.257814] bcm2835-v4l2: Power Line Frequency: 50 Hz
   [ 3719.257828] bcm2835-v4l2: Repeat Sequence Header: false
   [ 3719.257842] bcm2835-v4l2: H264 Profile: High
   [ 3719.257855] bcm2835-v4l2: H264 Level: 4
   [ 3719.257870] bcm2835-v4l2: Scene Mode: None
   [ 3719.257883] bcm2835-v4l2: H264 I-Frame Period: 60
   [ 3719.257897] bcm2835-v4l2: ==================  END STATUS  ==================
For me this somehow looks correct.

I recorded my video like this in ffmpeg:

Code: Select all

ffmpeg -f v4l2 -input_format h264 -video_size 1920x1080 -framerate 50 -pix_fmt yuv422p -i /dev/video0 ouput422.h264
And with this command using raspivid:

Code: Select all

raspivid -t 10000 -o raspivid.h264
I rewrapped the h264 files via MP4Box to mp4 files like this to view them in VLC:

Code: Select all

MP4Box -add video.h264 video.mp4
The problem is that the recorded video is extremely distorted and looks like having timing/sync problems. Here are some demo video files:
ouput.h264
ouput422.h264
output.mp4
output422.mp4
raspivid.h264
video2.mp4
video1080.h264
video1080.mp4
video1080p.mp4
videotest.mp4

I am able to verify that the video contains the actual image of the camera, because some artifacts show the door I was filming for testing purposes.

Does anybody have a clue what the problem could be?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8931
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Using Auvidea B101 Rev.4 for 1080p50 input via HDMI

Tue Mar 24, 2020 11:30 am

You're using bcm2835-v4l2 which is still using the unsupported firmware based drivers again.

Threads on using the kernel drivers:
The mega one with all the development viewtopic.php?f=38&t=120702
A more recent one with simple instructions viewtopic.php?f=38&t=264913
or just search the forum for TC358743 or B101 for more hits. It gets boring typing the same thing over and over.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

NKnuelle
Posts: 22
Joined: Tue Mar 24, 2020 9:30 am

Re: Using Auvidea B101 Rev.4 for 1080p50 input via HDMI

Tue Mar 24, 2020 11:41 am

Thank you for your reply.

I understand that it is getting boring to point users where they should look for.

For me it was very difficult to find the right information for my project. I am able to setup my camera's output to the signal I need (720p/50p or 1080/50p) which should be possilbe to record/stream according to most of the posts. I don't understand why to use EDID if I can configure my source by myself?

I already searched for B101 but didn't find an easy step-by-step process to enable the right kernel driver (TC358743). I will try again searching with the driver name instead.

Thank you for helping me out.

NKnuelle
Posts: 22
Joined: Tue Mar 24, 2020 9:30 am

Re: Using Auvidea B101 Rev.4 for 1080p50 input via HDMI

Tue Mar 24, 2020 2:05 pm

Hi again,

I managed to enable the driver, I set the EDID (1080P50EDID.txt) and checked the status:

Code: Select all

pi@raspberrypi:/usr/lib $ v4l2-ctl --log-status

Status Log:

   [ 1680.454021] unicam fe801000.csi: =================  START STATUS  =================
   [ 1680.455712] tc358743 0-000f: -----Chip status-----
   [ 1680.456335] tc358743 0-000f: Chip ID: 0x00
   [ 1680.456955] tc358743 0-000f: Chip revision: 0x00
   [ 1680.456968] tc358743 0-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
   [ 1680.456977] tc358743 0-000f: Sleep mode: off
   [ 1680.456987] tc358743 0-000f: Cable detected (+5V power): yes
   [ 1680.457517] tc358743 0-000f: DDC lines enabled: yes
   [ 1680.458047] tc358743 0-000f: Hotplug enabled: yes
   [ 1680.458669] tc358743 0-000f: CEC enabled: no
   [ 1680.458678] tc358743 0-000f: -----Signal status-----
   [ 1680.458687] tc358743 0-000f: TMDS signal detected: yes
   [ 1680.458696] tc358743 0-000f: Stable sync signal: yes
   [ 1680.458705] tc358743 0-000f: PHY PLL locked: yes
   [ 1680.458715] tc358743 0-000f: PHY DE detected: yes
   [ 1680.465500] tc358743 0-000f: Detected format: 1920x1080p50.0 (2640x1125)
   [ 1680.465513] tc358743 0-000f: horizontal: fp = 0, -sync = 720, bp = 0
   [ 1680.465524] tc358743 0-000f: vertical: fp = 0, -sync = 45, bp = 0
   [ 1680.465534] tc358743 0-000f: pixelclock: 148500000
   [ 1680.465546] tc358743 0-000f: flags (0x0):
   [ 1680.465556] tc358743 0-000f: standards (0x0):
   [ 1680.465569] tc358743 0-000f: Configured format: 1920x1080p50.0 (2640x1125)
   [ 1680.465580] tc358743 0-000f: horizontal: fp = 0, -sync = 720, bp = 0
   [ 1680.465591] tc358743 0-000f: vertical: fp = 0, -sync = 45, bp = 0
   [ 1680.465601] tc358743 0-000f: pixelclock: 148500000
   [ 1680.465612] tc358743 0-000f: flags (0x0):
   [ 1680.465622] tc358743 0-000f: standards (0x0):
   [ 1680.465631] tc358743 0-000f: -----CSI-TX status-----
   [ 1680.465641] tc358743 0-000f: Lanes needed: 2
   [ 1680.465650] tc358743 0-000f: Lanes in use: 2
   [ 1680.466272] tc358743 0-000f: Waiting for particular sync signal: no
   [ 1680.466892] tc358743 0-000f: Transmit mode: no
   [ 1680.467511] tc358743 0-000f: Receive mode: no
   [ 1680.468131] tc358743 0-000f: Stopped: no
   [ 1680.468142] tc358743 0-000f: Color space: YCbCr 422 16-bit
   [ 1680.468671] tc358743 0-000f: -----HDMI status-----
   [ 1680.468681] tc358743 0-000f: HDCP encrypted content: no
   [ 1680.468691] tc358743 0-000f: Input color space: RGB limited range
   [ 1680.469226] tc358743 0-000f: AV Mute: off
   [ 1680.469761] tc358743 0-000f: Deep color mode: 8-bits per channel
   [ 1680.472269] tc358743 0-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13
   [ 1680.472281] tc358743 0-000f:     colorspace: RGB
   [ 1680.472293] tc358743 0-000f:     scan mode: Overscan
   [ 1680.472304] tc358743 0-000f:     colorimetry: ITU709
   [ 1680.472316] tc358743 0-000f:     picture aspect: 16:9
   [ 1680.472327] tc358743 0-000f:     active aspect: Same as Picture
   [ 1680.472339] tc358743 0-000f:     itc: No Data
   [ 1680.472350] tc358743 0-000f:     extended colorimetry: xvYCC 601
   [ 1680.472361] tc358743 0-000f:     quantization range: Default
   [ 1680.472372] tc358743 0-000f:     nups: Unknown Non-uniform Scaling
   [ 1680.472383] tc358743 0-000f:     video code: 31
   [ 1680.472394] tc358743 0-000f:     ycc quantization range: Limited
   [ 1680.472406] tc358743 0-000f:     hdmi content type: Graphics
   [ 1680.472418] tc358743 0-000f:     pixel repeat: 0
   [ 1680.472430] tc358743 0-000f:     bar top 0, bottom 0, left 0, right 0
   [ 1680.472440] unicam fe801000.csi: -----Receiver status-----
   [ 1680.472451] unicam fe801000.csi: V4L2 width/height:   1920x1080
   [ 1680.472462] unicam fe801000.csi: Mediabus format:     0000200f
   [ 1680.472472] unicam fe801000.csi: V4L2 format:         UYVY
   [ 1680.472482] unicam fe801000.csi: Unpacking/packing:   0 / 0
   [ 1680.472492] unicam fe801000.csi: ----Live data----
   [ 1680.472501] unicam fe801000.csi: Programmed stride:   3840
   [ 1680.472511] unicam fe801000.csi: Detected resolution: 0x0
   [ 1680.472522] unicam fe801000.csi: Write pointer:       dc300000
   [ 1680.472531] unicam fe801000.csi: ==================  END STATUS  ==================
Which looks very promising to me.

Now I tried to stream the video locally using GStream with the command u mentioned in another Thread:

Code: Select all

gst-launch-1.0 -vvv -e v4l2src device=/dev/video0 ! video/x-raw,format=UYVY,framerate=50/1 ! v4l2h264enc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay! tcpserversink host=192.168.0.32 port=5000
But this leads to:

Code: Select all

Leitung wird auf PAUSIERT gesetzt ...
Leitung ist aktiv und erfordert keinen VORLAUF …
/GstPipeline:pipeline0/GstTCPServerSink:tcpserversink0: current-port = 5000
Leitung wird auf ABSPIELEN gesetzt ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)UYVY, framerate=(fraction)50/1, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, colorimetry=(string)bt601
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = video/x-raw, format=(string)UYVY, framerate=(fraction)50/1, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, colorimetry=(string)bt601
/GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)high, level=(string)4, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)50/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, profile=(string)high, level=(string)4, width=(int)1920, height=(int)1080, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)50/1, interlace-mode=(string)progressive, colorimetry=(string)bt601
Verzögerung neu verteilen …
/GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0.GstPad:sink: caps = video/x-raw, format=(string)UYVY, framerate=(fraction)50/1, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, colorimetry=(string)bt601
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:sink: caps = video/x-raw, format=(string)UYVY, framerate=(fraction)50/1, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, colorimetry=(string)bt601
FEHLER: Von Element /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0: Verarbeiten des Einzelbilds schlug fehl.
Zusätzliche Fehlerdiagnoseinformation:
gstv4l2videoenc.c(803): gst_v4l2_video_enc_handle_frame (): /GstPipeline:pipeline0/v4l2h264enc:v4l2h264enc0:
Maybe be due to not enough memory or failing driver
EOS bei Beenden ist eingeschaltet -- warten auf EOS nach dem Fehler
Auf EOS wird gewartet …
FEHLER: Von Element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Internal data stream error.
Zusätzliche Fehlerdiagnoseinformation:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason error (-5)
There is some german text in there. If you need some translation, please tell me.

I am not sure if this really is a Memory issue.

What is your advice here? Trying it again with 720P50? Or is the problem somewhere else? As far as I understood using 2 lanes should be OK for 1080P50.

UPDATE:
I was able to record the HDMI Input in 1080P50 using the yavta tool:

Code: Select all

./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0
Just 1 error at the end mentioning:

Code: Select all

Total number of frames dropped 205
Releasing vcsm handle 73728
Closing dma_buf 8
Releasing vcsm handle 77824
Closing dma_buf 9
Releasing vcsm handle 81920
Closing dma_buf 10
3 buffers released.
Failed to find matching V4L2 buffer for mmal buffer 0x1823900
205 frames were dropped additionally.

UPDATE2:
I captured 720p/50 from my camera which works until I move the camera. Yavta then produces this output:

Code: Select all

258 (0) [-] none 258 1843200 B 224.398989 224.418978 49.995 fps ts mono/EoF
259 (1) [-] none 259 1843200 B 224.418987 224.439000 50.005 fps ts mono/EoF
260 (2) [-] none 260 1843200 B 224.438987 224.458981 50.000 fps ts mono/EoF
Exception
Source changed
Unmapped all buffers
Source changed
Unmapped all buffers
I don't know what this means, because my source (the camera?) didn't change in any way..

The strange thing is that
v4l2-ctl --log-status

now says that no video is detected.. But I didn't change a thing... If I turn my camera off and on the video signal gets detected again..

Thank you in advance

NKnuelle
Posts: 22
Joined: Tue Mar 24, 2020 9:30 am

Re: Using Auvidea B101 Rev.4 for 1080p50 input via HDMI

Tue Mar 24, 2020 5:07 pm

For everyone searching for some solutions:

For me I was able to stream with gstreamer in 720p/50 with a raspberry pi 4. I generate a RTMP stream with this:

Code: Select all

gst-launch-1.0 flvmux streamable=true name=mux ! rtmpsink location="rtmp://0.0.0.0:1935/live" v4l2src io-mode=4 ! "video/x-raw,framerate=50/1,format=UYVY" ! v4l2h264enc output-io-mode=5 extra-controls="controls,video_bitrate=10M;" ! video/x-h264,profile=high ! h264parse ! queue ! mux.
The rtmp location is my local nginx server with rtmp module installed.

Setting the video_bitrate enables you to change the quality of your video. Currently I use 10M (Megabit/s).

Now I am working on enabling audio.

Return to “Interfacing (DSI, CSI, I2C, etc.)”