geosapien
Posts: 14
Joined: Fri Nov 23, 2018 7:01 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Fri May 17, 2019 2:07 pm

Did a reboot, and started the sequence over, now i get more realistic values. Still wondering why i see this and not the video stream?

pi@raspberrypi:~/yavta $ ./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0
We're encoding to file.h264
Device /dev/video0 opened.
Device `unicam' on `platform:unicam 3f801000.csi' (driver 'unicam') is a video capture (without mplanes) device.
stride is 0
stride is now 1280
Video format set: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
Framerate is 50
Video format: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
vc.ril.isp:in:0(UYVY)(0x1e2efb0)type: video, fourcc: UYVY bitrate: 0, framed: 0 extra data: 0, (nil) width: 1920, height: 1088, (0,0,1920,1080) pixel aspect ratio: 0/0, frame rate: 0/0
buffers num: 3(opt 1, min 1), size: 4177920(opt 4177920, min: 4177920), align: 0
Created pool of length 3, size 0
Enable encoder....
Create pool of 3 buffers of size 0 for render
Create pool of 3 buffers of size 0 for encode ip
Create pool of 3 buffers of size 3133440 for encode/render
Writing data to file.h264
Create pool of 8 buffers of size 262144
Sent buffer 0x1e38d58
Sent buffer 0x1e38f30
Sent buffer 0x1e39108
Sent buffer 0x1e392e0
Sent buffer 0x1e394b8
Sent buffer 0x1e39690
Sent buffer 0x1e39868
Sent buffer 0x1e39a40
3 buffers requested, V4L2 returned 3 bufs.
length: 4177920 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0x70a04000.
Importing DMABUF 8 into VCSM...
...done. vcsm_handle 73728
Exported buffer 0 to dmabuf 8, vcsm handle 73728
Linking V4L2 buffer index 0 ptr 0x1e3a760 to MMAL header 0x1e354c0. mmal->data 0xC0000003
length: 4177920 offset: 4177920 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0x70608000.
Importing DMABUF 9 into VCSM...
...done. vcsm_handle 77824
Exported buffer 1 to dmabuf 9, vcsm handle 77824
Linking V4L2 buffer index 1 ptr 0x1e3a7d0 to MMAL header 0x1e35698. mmal->data 0xC0000004
length: 4177920 offset: 8355840 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0x7020c000.
Importing DMABUF 10 into VCSM...
...done. vcsm_handle 81920
Exported buffer 2 to dmabuf 10, vcsm handle 81920
Linking V4L2 buffer index 2 ptr 0x1e3a840 to MMAL header 0x1e35870. mmal->data 0xC0000005
0 (0) [-] none 0 4177920 B 57720.272188 57720.276687 -14285.714 fps ts mono/EoF
1 (1) [-] none 1 4177920 B 57720.276675 57720.296691 222.866 fps ts mono/EoF
2 (2) [-] none 2 4177920 B 57720.296675 57720.316693 50.000 fps ts mono/EoF
3 (0) [-] none 3 4177920 B 57720.316677 57720.336702 49.995 fps ts mono/EoF
4 (1) [-] none 4 4177920 B 57720.336676 57720.356696 50.003 fps ts mono/EoF
5 (2) [-] none 5 4177920 B 57720.356677 57720.376722 49.998 fps ts mono/EoF
6 (0) [-] none 6 4177920 B 57720.376678 57720.396705 49.998 fps ts mono/EoF
7 (1) [-] none 7 4177920 B 57720.396677 57720.416697 50.003 fps ts mono/EoF
8 (2) [-] none 8 4177920 B 57720.416677 57720.436702 50.000 fps ts mono/EoF
9 (0) [-] none 9 4177920 B 57720.436677 57720.456701 50.000 fps ts mono/EoF
10 (1) [-] none 10 4177920 B 57720.456680 57720.476706 49.993 fps ts mono/EoF
11 (2) [-] none 11 4177920 B 57720.476677 57720.496684 50.008 fps ts mono/EoF
12 (0) [-] none 12 4177920 B 57720.496678 57720.516699 49.998 fps ts mono/EoF
13 (1) [-] none 13 4177920 B 57720.516679 57720.536701 49.998 fps ts mono/EoF
14 (2) [-] none 14 4177920 B 57720.536678 57720.556702 50.003 fps ts mono/EoF
15 (0) [-] none 15 4177920 B 57720.556679 57720.576701 49.998 fps ts mono/EoF
16 (1) [-] none 16 4177920 B 57720.576678 57720.596703 50.003 fps ts mono/EoF
17 (2) [-] none 17 4177920 B 57720.596679 57720.616702 49.998 fps ts mono/EoF
18 (0) [-] none 18 4177920 B 57720.616679 57720.636704 50.000 fps ts mono/EoF
19 (1) [-] none 19 4177920 B 57720.636679 57720.656701 50.000 fps ts mono/EoF
20 (2) [-] none 20 4177920 B 57720.656681 57720.676706 49.995 fps ts mono/EoF
21 (0) [-] none 21 4177920 B 57720.676680 57720.696703 50.003 fps ts mono/EoF
22 (1) [-] none 22 4177920 B 57720.696680 57720.716769 50.000 fps ts mono/EoF
23 (2) [-] none 23 4177920 B 57720.716681 57720.736707 49.998 fps ts mono/EoF
24 (0) [-] none 24 4177920 B 57720.736682 57720.756722 49.998 fps ts mono/EoF
25 (1) [-] none 25 4177920 B 57720.756688 57720.776707 49.985 fps ts mono/EoF
26 (2) [-] none 26 4177920 B 57720.776681 57720.796706 50.018 fps ts mono/EoF
27 (0) [-] none 27 4177920 B 57720.816681 57720.836712 25.000 fps ts mono/EoF
DROPPED FRAME - 504493 and 544493, delta 40000

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Fri May 17, 2019 2:17 pm

geosapien wrote:
Fri May 17, 2019 2:07 pm
Still wondering why i see this and not the video stream?
See what? The text output?
Is it actually encoding to file.h264? If so something in the render side isn't working. My only guess is that you have enabled the vc4-kms-v3d driver, therefore MMAL can't render to the screen.
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.

DanR
Posts: 33
Joined: Fri Jan 18, 2013 1:20 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Tue May 21, 2019 10:20 am

Hi 6by9,

I have got my newer Toshiba dev board up and running and after setting the EDID file and setting the timings I can see that it sees the video stream, however when I test it with yavta and v4l2_mmal I get the following memory allocation errors (I've tried the GPU ram set to 64Mb and 128Mb with no success), do you have any ideas as I'm a bit at a loss really (possibly due to sleep deprivation?!):

pi@imageport_122c8c:~/yavta $ v4l2-ctl --set-dv-bt-timings query
BT timings set
pi@devicename:~/yavta $ ./yavta --capture=60 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0
We're encoding to file.h264
Device /dev/video0 opened.
Device `unicam' on `platform:unicam 3f801000.csi1' (driver 'unicam') is a video capture (without mplanes) device.
stride is 0
stride is now 1280
Video format set: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
Framerate is 50
Video format: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
vc.ril.isp:in:0(UYVY)(0x1cf4fb0)type: video, fourcc: UYVY bitrate: 0, framed: 0 extra data: 0, (nil) width: 1920, height: 1088, (0,0,1920,1080) pixel aspect ratio: 0/0, frame rate: 0/0
buffers num: 3(opt 1, min 1), size: 4177920(opt 4177920, min: 4177920), align: 0
Created pool of length 3, size 0
Enable encoder....
Create pool of 3 buffers of size 0 for render
Create pool of 3 buffers of size 0 for encode ip
usrvcsm: [vcsm_malloc_cache]: [1265] [mmal_vc_port buffer]: ioctl mem-alloc FAILED [-1] (hdl: 0)
usrvcsm: [vcsm_vc_hdl_from_hdl]: [1265]: invalid device or handle!
usrvcsm: [vcsm_lock]: [1265]: invalid device or invalid handle!
mmal: mmal_vc_shm_alloc: could not allocate 3133440 bytes of shared memory (handle 0)
mmal: mmal_vc_port_payload_alloc: vc.ril.video_encode:in:0(I420): failed to allocate 3133440 bytes of shared memory
mmal: mmal_pool_initialise_buffer_headers: failed to allocate payload 0/3
Failed to create encode ip pool
Unable to request buffers: Cannot allocate memory (12).
pi@devicename:~/yavta $

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Tue May 21, 2019 10:33 am

DanR wrote:
Tue May 21, 2019 10:20 am
I have got my newer Toshiba dev board up and running and after setting the EDID file and setting the timings I can see that it sees the video stream, however when I test it with yavta and v4l2_mmal I get the following memory allocation errors (I've tried the GPU ram set to 64Mb and 128Mb with no success), do you have any ideas as I'm a bit at a loss really (possibly due to sleep deprivation?!):
This is a standard Raspbian image?

Getting the usrvcsm error messages mean that either vcsm_init hasn't been called, or it failed to open the device. Please check /dev/vcsm exists with permissions "crw-rw----, root video"

"Unable to request buffers: Cannot allocate memory (12)." implies you haven't increased the cma heap size on the Linux kernel command line. "cma=96M" or similar should be more than ample for running yavta.
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.

DanR
Posts: 33
Joined: Fri Jan 18, 2013 1:20 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Tue May 21, 2019 11:24 am

Hiya 6by9,

Thank you ever so much, I added back in the cma=96M, put the gpu_mem=64 back to 128, rebooted and it's working, hurrah!! You're a very helpful person and have made my day, week, month. If I could send you a beer I would send 10 and my debt would still never be paid enough!!!

Kind Regards,

Dan

geosapien
Posts: 14
Joined: Fri Nov 23, 2018 7:01 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Tue May 21, 2019 8:09 pm

My only guess is that you have enabled the vc4-kms-v3d driver, therefore MMAL can't render to the screen.

how would i check to see if i did that? I followed all of the instructions from the previous post. i have rebuilt the pi 4 times and get the same result

DanR
Posts: 33
Joined: Fri Jan 18, 2013 1:20 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Tue May 21, 2019 8:34 pm

geosapien,

are you using a directly connected screen / monitor on the pi or using vnc? If you're using vnc then you won't see the video stream due to the way the gpu renders the video.

HTH, Dan

geosapien
Posts: 14
Joined: Fri Nov 23, 2018 7:01 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Tue May 21, 2019 9:18 pm

Dan,

I have the pi on a monitor w/keyboard and mouse, but am doing most of my config with putty on my windows machine. I am trying to bring up the video with VLC

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Wed May 22, 2019 7:13 am

geosapien wrote:
Tue May 21, 2019 8:09 pm
My only guess is that you have enabled the vc4-kms-v3d driver, therefore MMAL can't render to the screen.
how would i check to see if i did that? I followed all of the instructions from the previous post. i have rebuilt the pi 4 times and get the same result

Code: Select all

lsmod | grep vc4

It shouldn't return anything.
Or check config.txt for a line "dtoverlay=vc4-kms-v3d"
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.

geosapien
Posts: 14
Joined: Fri Nov 23, 2018 7:01 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu May 23, 2019 6:42 pm

pi@raspberrypi:~/yavta $ lsmod | grep vc4
pi@raspberrypi:~/yavta $


returns nothing

when running ./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0 from the pi itself, the monitor it is hooked up to goes black on most of the screen and along the bottom you can see the dropped frames messages

pi@raspberrypi:~ $ v4l2-ctl --set-edid=file=1080P50EDID.txt --fix-edid-checksums

CEA-861 Header
IT Formats Underscanned: yes
Audio: yes
YCbCr 4:4:4: no
YCbCr 4:2:2: no

HDMI Vendor-Specific Data Block
Physical Address: 3.0.0.0
YCbCr 4:4:4 Deep Color: no
30-bit: no
36-bit: no
48-bit: no

CEA-861 Video Capability Descriptor
RGB Quantization Range: yes
YCC Quantization Range: no
PT: Supports both over- and underscan
IT: Supports both over- and underscan
CE: Supports both over- and underscan
pi@raspberrypi:~ $ v4l2-ctl --query-dv-timings
Active width: 1920
Active height: 1080
Total width: 2640
Total height: 1125
Frame format: progressive
Polarities: -vsync -hsync
Pixelclock: 148500000 Hz (50.00 frames per second)
Horizontal frontporch: 0
Horizontal sync: 720
Horizontal backporch: 0
Vertical frontporch: 0
Vertical sync: 45
Vertical backporch: 0
Standards:
Flags:


this looks normal?

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu May 23, 2019 7:26 pm

geosapien wrote:
Thu May 23, 2019 6:42 pm
when running ./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0 from the pi itself, the monitor it is hooked up to goes black on most of the screen and along the bottom you can see the dropped frames messages
Yes, normal.

All looks normal for 1080p50.
Please try "v4l2-ctl --log-status" to dump out what the chip is detecting. I'm wondering if your source (you haven't apparently said what it is) is applying HDCP to the stream. HDCP is not supported as it is a licensing and security nightmare.
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.

geosapien
Posts: 14
Joined: Fri Nov 23, 2018 7:01 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu May 23, 2019 7:50 pm

pi@raspberrypi:~ $ v4l2-ctl --log-status

Status Log:

[ 4219.033962] unicam 3f801000.csi: ================= START STATUS =================
[ 4219.036583] tc358743 0-000f: -----Chip status-----
[ 4219.037557] tc358743 0-000f: Chip ID: 0x00
[ 4219.038526] tc358743 0-000f: Chip revision: 0x00
[ 4219.038535] tc358743 0-000f: Reset: IR: 1, CEC: 1, CSI TX: 0, HDMI: 0
[ 4219.038542] tc358743 0-000f: Sleep mode: off
[ 4219.038548] tc358743 0-000f: Cable detected (+5V power): yes
[ 4219.039372] tc358743 0-000f: DDC lines enabled: yes
[ 4219.040199] tc358743 0-000f: Hotplug enabled: yes
[ 4219.041166] tc358743 0-000f: CEC enabled: no
[ 4219.041172] tc358743 0-000f: -----Signal status-----
[ 4219.041177] tc358743 0-000f: TMDS signal detected: yes
[ 4219.041183] tc358743 0-000f: Stable sync signal: yes
[ 4219.041189] tc358743 0-000f: PHY PLL locked: yes
[ 4219.041194] tc358743 0-000f: PHY DE detected: yes
[ 4219.052082] tc358743 0-000f: Detected format: 1920x1080p50.0 (2640x1125)
[ 4219.052094] tc358743 0-000f: horizontal: fp = 0, -sync = 720, bp = 0
[ 4219.052102] tc358743 0-000f: vertical: fp = 0, -sync = 45, bp = 0
[ 4219.052110] tc358743 0-000f: pixelclock: 148500000
[ 4219.052118] tc358743 0-000f: flags (0x0):
[ 4219.052126] tc358743 0-000f: standards (0x0):
[ 4219.052136] tc358743 0-000f: Configured format: 1920x1080p50.0 (2640x1125)
[ 4219.052143] tc358743 0-000f: horizontal: fp = 0, -sync = 720, bp = 0
[ 4219.052151] tc358743 0-000f: vertical: fp = 0, -sync = 45, bp = 0
[ 4219.052157] tc358743 0-000f: pixelclock: 148500000
[ 4219.052165] tc358743 0-000f: flags (0x0):
[ 4219.052173] tc358743 0-000f: standards (0x0):
[ 4219.052178] tc358743 0-000f: -----CSI-TX status-----
[ 4219.052185] tc358743 0-000f: Lanes needed: 2
[ 4219.052191] tc358743 0-000f: Lanes in use: 2
[ 4219.053162] tc358743 0-000f: Waiting for particular sync signal: no
[ 4219.054131] tc358743 0-000f: Transmit mode: no
[ 4219.055100] tc358743 0-000f: Receive mode: no
[ 4219.056067] tc358743 0-000f: Stopped: no
[ 4219.056073] tc358743 0-000f: Color space: YCbCr 422 16-bit
[ 4219.056899] tc358743 0-000f: -----HDMI status-----
[ 4219.056905] tc358743 0-000f: HDCP encrypted content: no
[ 4219.056912] tc358743 0-000f: Input color space: RGB limited range
[ 4219.057737] tc358743 0-000f: AV Mute: off
[ 4219.058564] tc358743 0-000f: Deep color mode: 8-bits per channel
[ 4219.062548] tc358743 0-000f: HDMI infoframe: Auxiliary Video Information (AVI), version 2, length 13
[ 4219.062561] tc358743 0-000f: colorspace: RGB
[ 4219.062570] tc358743 0-000f: scan mode: No Data
[ 4219.062579] tc358743 0-000f: colorimetry: ITU709
[ 4219.062588] tc358743 0-000f: picture aspect: 16:9
[ 4219.062597] tc358743 0-000f: active aspect: Same as Picture
[ 4219.062605] tc358743 0-000f: itc: No Data
[ 4219.062614] tc358743 0-000f: extended colorimetry: xvYCC 601
[ 4219.062623] tc358743 0-000f: quantization range: Default
[ 4219.062631] tc358743 0-000f: nups: Unknown Non-uniform Scaling
[ 4219.062640] tc358743 0-000f: video code: 31
[ 4219.062648] tc358743 0-000f: ycc quantization range: Limited
[ 4219.062657] tc358743 0-000f: hdmi content type: Graphics
[ 4219.062665] tc358743 0-000f: pixel repeat: 0
[ 4219.062677] tc358743 0-000f: bar top 0, bottom 0, left 0, right 0
[ 4219.062684] unicam 3f801000.csi: -----Receiver status-----
[ 4219.062692] unicam 3f801000.csi: V4L2 width/height: 1920x1080
[ 4219.062698] unicam 3f801000.csi: Mediabus format: 0000200f
[ 4219.062705] unicam 3f801000.csi: V4L2 format: UYVY
[ 4219.062712] unicam 3f801000.csi: Unpacking/packing: 0 / 0
[ 4219.062717] unicam 3f801000.csi: ----Live data----
[ 4219.062724] unicam 3f801000.csi: Programmed stride: 3840
[ 4219.062730] unicam 3f801000.csi: Detected resolution: 0x0
[ 4219.062737] unicam 3f801000.csi: Write pointer: f6300000
[ 4219.062744] unicam 3f801000.csi: ================== END STATUS ==================


i am using an amazon fire tv as my test device.

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu May 23, 2019 8:49 pm

I'd suggest you try a laptop or similar as a source.
Nothing appears wrong, but I don't know how a Fire TV Stick deals with a lack of hdcp. It may well output a valid but blank screen.
IIRC there is an option in yavta to record the output to h264. If you do that do you get a video clip with black images? If so then I think it was what the Fire TV Stick is putting out.

If you get a cheap hdmi splitter then you can see the output that you are trying to capture, and as a bonus many of them strip out hdcp! The ones that look like https://www.ebay.co.uk/itm/HDMI-Switch- ... 3431822740 tend to work fairly well.
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.

geosapien
Posts: 14
Joined: Fri Nov 23, 2018 7:01 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu May 23, 2019 9:20 pm

I have a pi hole sitting on my desk, so i plugged it into the b101 board. I had to reboot the pi, but after the EDID and timing query came back i was able to run the ./yavta commands and i got video on the monitor attached to the pi.

So this whole time it was the amazon box........

Thank you for all the help with this. Would have been spinning my wheels for months. Now i get to learn how to push the stream via UDP so i can use it as an encoder. Can you point me in the right direction? The Auvidea instructions dont work

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Fri May 24, 2019 9:16 am

geosapien wrote:
Thu May 23, 2019 9:20 pm
I have a pi hole sitting on my desk, so i plugged it into the b101 board. I had to reboot the pi, but after the EDID and timing query came back i was able to run the ./yavta commands and i got video on the monitor attached to the pi.

So this whole time it was the amazon box........
What to do should you require HDCP and not be able to negotiate it is badly defined. When using VideoCore with HDCP I recall they went to various efforts to put up a padlock symbol or similar should "protected content" be displayed with no HDCP negotiated.
Pure curiousity, which version of Fire TV stick do you have? The first gen ones were based on VideoCore :D Not quite the same chip as inside the Pi though
geosapien wrote:Thank you for all the help with this. Would have been spinning my wheels for months. Now i get to learn how to push the stream via UDP so i can use it as an encoder. Can you point me in the right direction? The Auvidea instructions dont work
Encoding from the B101 is something I had been playing with, although mainly to a file rather than streaming.
The best performance I had achieved was with a recent build of GStreamer (Debian/Raspbian Stretch is on 1.10 and I want at least 1.14). Rebuild instructions are at https://gist.githubusercontent.com/spha ... r-build.sh although you'll need a little understanding should things misbehave (note viewtopic.php?f=38&t=120702&start=500#p1447640 otherwise you'll lose your plugins on reboot).

You'll also want the 4.19 kernel and https://github.com/raspberrypi/linux/pull/2961

Similar thread at viewtopic.php?f=38&t=236938&p=1448573. PR 2961 is a fix for setting encode bitrate which may be their issue. You'll need to set the EDID and "v4l2-ctl --set-dv-bt-timings query" before running gstreamer.
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.

DanR
Posts: 33
Joined: Fri Jan 18, 2013 1:20 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Fri May 24, 2019 9:21 pm

Wasn't the original white Now TV box based on a raspberry pi using the same SoC? It does seem as though sky went to some trouble to prevent it being used as anything else though which is a shame as they're now obsolete :(

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Sat May 25, 2019 8:35 am

DanR wrote:
Fri May 24, 2019 9:21 pm
Wasn't the original white Now TV box based on a raspberry pi using the same SoC? It does seem as though sky went to some trouble to prevent it being used as anything else though which is a shame as they're now obsolete :(
I believe one of them used 2836, same as the Pi2 used to.
Roku (who make the NowTV boxes) set up an office in Cambridge when Broadcom laid us off, and employed a fair number of us. Broadcom were prepared to sell them 2836 but with very minimal support as they no longer had the staff.
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.

SergCoder
Posts: 8
Joined: Mon Mar 31, 2014 12:46 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu May 30, 2019 1:41 pm

SergCoder wrote:
Tue May 14, 2019 9:52 am
One more complicated question from me - is it possible to get 720p60 HDMI signal and encode only 50% of frames to get 720p30 output?
Sorry, is it possible to implement this in any way?

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu May 30, 2019 1:53 pm

SergCoder wrote:
Thu May 30, 2019 1:41 pm
SergCoder wrote:
Tue May 14, 2019 9:52 am
One more complicated question from me - is it possible to get 720p60 HDMI signal and encode only 50% of frames to get 720p30 output?
Sorry, is it possible to implement this in any way?
Not trivially with raspi_tc358743 (please note that it has moved to https://github.com/6by9/raspi_tc358743).
(You'd need to break the mmal_connection between the splitter and video_encode, bring the buffers back to the ARM, and then only forward on 50% of them to the encoder, returning the rest to the splitter).

With the V4L2 drivers and a recent GStreamer you should be able to use the videorate component to adjust the stream rate. Combine it with v4l2h264enc and you should be able to get a fairly performant pipe.
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.

DanR
Posts: 33
Joined: Fri Jan 18, 2013 1:20 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu Jun 20, 2019 3:05 pm

Hiya 6by9,

I have a problem with capturing more than 1 set of images. The first time it runs absolutely perfectly, the same v4l2_mmal demo you have on github works flawlessly with the ADV7280A-M and using it with the TC358743 works once and once only. I get the following:

Code: Select all

We're encoding to /media/usb/95efa2ce-8134-4800-a3f1-3997ec6dc780--1.jpg
Device /dev/video0 opened.
Device `unicam' on `platform:unicam 3f801000.csi1' (driver 'unicam') is a video capture (without mplanes) device.
stride is 0
stride is now 1280
Video format set: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
Video format: UYVY (59565955) 1920x1080 (stride 3840) field none buffer size 4177920
Unable to get frame rate: Inappropriate ioctl for device (25).
vc.ril.isp:in:0(UYVY)(0x1222fb0)type: video, fourcc: UYVY bitrate: 0, framed: 0 extra data: 0, (nil) width: 1920, height: 1088, (0,0,1920,1080) pixel aspect ratio: 0/0, frame rate: 0/0 buffers num: 3(opt 1, min 1), size: 4177920(opt 4177920, min: 4177920), align: 0Created pool of length 3, size 0
format->video.size now 1920x1088
Setup output port
/media/usb/95efa2ce-8134-4800-a3f1-3997ec6dc780--1.jpg
/media/usb/95efa2ce-8134-4800-a3f1-3997ec6dc780--1.jpg_0
Writing data to /media/usb/95efa2ce-8134-4800-a3f1-3997ec6dc780--1.jpg_0
Create pool of 3 buffers for vc.ril.video_encode
Create pool of 8 buffers for vc.ril.video_encode
Sent buffer 0x122c8e8Sent buffer 0x122cac0Sent buffer 0x122cc98Sent buffer 0x122ce70Sent buffer 0x122d048Sent buffer 0x122d220Sent buffer 0x122d3f8Sent buffer 0x122d5d0Enable vc.ril.video_encode....
Buffer 0x122c8e8 saving, filled 29, timestamp 0, flags 1024
Setup output port
Writing data to /media/usb/95efa2ce-8134-4800-a3f1-3997ec6dc780--1.jpg
Create pool of 3 buffers for vc.ril.image_encode
Create pool of 8 buffers for vc.ril.image_encode
Sent buffer 0x1235568Sent buffer 0x1235740Sent buffer 0x1235918Sent buffer 0x1235af0Sent buffer 0x1235cc8Sent buffer 0x1235ea0Sent buffer 0x1236078Sent buffer 0x1236250Enable vc.ril.image_encode....
Create pool of 3 buffers for vc.ril.video_render
Enable vc.ril.video_render....
Create pool of 3 buffers of size 3133440 for encode/render
3 buffers requested.
length: 4177920 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0x6fc14000.
Exported buffer 0 to dmabuf 10, vcsm handle 442368
Linking V4L2 buffer index 0 ptr 0x123a3e8 to MMAL header 0x1224fe0. mmal->data 0xC0000004
length: 4177920 offset: 4177920 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0x6f818000.
Exported buffer 1 to dmabuf 11, vcsm handle 446464
Linking V4L2 buffer index 1 ptr 0x123a458 to MMAL header 0x12251b8. mmal->data 0xC0000003
length: 4177920 offset: 8355840 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0x6f41c000.
Exported buffer 2 to dmabuf 12, vcsm handle 450560
Linking V4L2 buffer index 2 ptr 0x123a4c8 to MMAL header 0x1225390. mmal->data 0xC0000005
Exception
Source changed
QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
Framerate is 50
Unmapped all buffers
Source changed
QUERY_DV_TIMINGS returned 1920x1080 pixclk 148500000
Framerate is 50
Unmapped all buffers
The last line is where the v4l2_mmal application just hangs. I can see the line 9 from the bottom which says Exception straight after linking the mmal buffers so my thoughts are memory allocation or mapping. Possibly even the first run doesn't release the gpu ram maybe after being run?!?

Totally in your debt now. Any ideas??

Kind Regards, Dan

DanR
Posts: 33
Joined: Fri Jan 18, 2013 1:20 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu Jun 20, 2019 3:21 pm

Ok, ignore that last request.

FYI, if you run the v4l2-ctl command to set the EDID, then set the timings and then start capturing immediately you get this issue. If you pause for 500ms and then capture it works a treat. I guess the I2C bus hasn't completed or the TC358743 hasn't sync'd its PLL or some other odd thing.

Anyway, thought I'd post it incase someone else gets this error too.

Cheers! Dan...

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

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu Jun 20, 2019 3:40 pm

Setting the EDID goes and pulses the hotplug line, therefore your source is likely to renegotiate the desired format. You'll then get a resolution changed update (which is signalled as an exception on the poll/select call, as opposed to read or write).
You don't expect your TV to suddenly change EDID on you, therefore the same approach should be taken with the TC358743. The EDID would normally be set as part of the boot process and then never changed.

https://elixir.bootlin.com/linux/v4.19. ... 743.c#L417
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.

DanR
Posts: 33
Joined: Fri Jan 18, 2013 1:20 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu Jun 20, 2019 4:38 pm

More testing with disconnects and reconnects on my part needs to be done, but yes I agree the edid should be fine after being set from boot. Maybe I just need to be less cautious for a change :)

Thanks for the info, as always great advice.

Cheers, Dan

custardpi
Posts: 2
Joined: Thu Jun 20, 2019 11:18 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Thu Jun 20, 2019 11:28 pm

I'm sorry for piggybacking on this thread but I felt like since this is still such an active discussion it would be better posting here than creating a new thread.

When looking for ways to cheaply stream HDMI to twitch I came across the Twitch O Matic on hackster.io which gives instructions and code for implementing it. However, those use a Raspi 0 W with a B102 and while the instructions mention that the Raspi 3 can be used with a B101 the instructions and walkthrough also require the use of raspivid, which I read earlier in this thread does not work with with the B101, at least as of April 2018.

Has that changed at all? Is there a viable solution for me to use a Raspi 3 with a B101 and stream to twitch? I am wondering because I already have a Raspi 3 and am about to buy a B101 but if that doesn't work for this I'll need to buy the B102 and a Raspi 0 W. Thanks in advance for any help!

chchart
Posts: 4
Joined: Fri Jun 07, 2019 6:34 pm

Re: HDMI to CSI-2 via TC358743 on kernel 4.1

Fri Jun 21, 2019 5:17 am

Hello!
I am using B101 with RPi 3B+ utilizing yavta. First of all, thank you everyone for active discussion and 6by9 for providing the support for yavta. B101 is connected to a Mac Mini, and it works great!

But, it does not work in Mac's recovery mode. When yavta capture command is run, it would "fail to create pool" and "select timeout." Does anyone have a guess to why it does not work?
I heard that screenshot does not work in the recovery mode because it's outside of the "userspace." Does yavta use mechanism similar to screen capture? I cannot seem to understand, as Pi should still be receiving a video input..

Also, I've tested with the same setup with Raspberry Pi Zero W with B102 bridge using "raspistill" and "raspivid" in Mac's recovery mode, and it works fine. That's why I am curious as to why B101 with yavta does not work.

If someone could explain what yavta does differently from raspivid that might have cause the failure, I would greatly appreciate it!
Thank you in advance.

Return to “Graphics, sound and multimedia”