cyphercolt
Posts: 14
Joined: Thu Mar 21, 2019 4:34 pm

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

Wed Mar 27, 2019 10:53 am

6by9 wrote:
Wed Mar 27, 2019 6:47 am
cyphercolt wrote:
Wed Mar 27, 2019 3:01 am

I gave it a reboot and lost all my plugins... Whyyyyyyyyyyyy do you do this to me pi... (I obviously missed an important step) - Any ideas there?
export LD_LIBRARY_PATH=/usr/local/lib/
For some reason the script is set to put the libraries in a place that isn't on the normal search path - one of the main reasons not to blindly follow scripts.
Thank you for all the help on this one! I've learned quite a lot about the b101, pi and Linux throughout this project.

tvjon
Posts: 706
Joined: Mon Jan 07, 2013 9:11 am

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

Wed Mar 27, 2019 11:09 am

"one of the main reasons not to blindly follow scripts."

Indeed.

https://gist.githubusercontent.com/spha ... r-build.sh

I didn't think there's a working firewire interface on RPi...

The directory size after that lot is downloaded > 1 Gig.

cyphercolt
Posts: 14
Joined: Thu Mar 21, 2019 4:34 pm

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

Thu Mar 28, 2019 4:35 pm

cyphercolt wrote:
Wed Mar 27, 2019 10:53 am
6by9 wrote:
Wed Mar 27, 2019 6:47 am
cyphercolt wrote:
Wed Mar 27, 2019 3:01 am

I gave it a reboot and lost all my plugins... Whyyyyyyyyyyyy do you do this to me pi... (I obviously missed an important step) - Any ideas there?
export LD_LIBRARY_PATH=/usr/local/lib/
For some reason the script is set to put the libraries in a place that isn't on the normal search path - one of the main reasons not to blindly follow scripts.
Thank you for all the help on this one! I've learned quite a lot about the b101, pi and Linux throughout this project.

Hi there,

So now that I know the pi is capable of streaming the B101 to twitch at at least 720p60, I now have to get my pipeline right.

Starting with the small annoying thing (not too big of a deal just bugs me each time)
"export LD_LIBRARY_PATH=/usr/local/lib/"
Any way to make this permanent so I don't have to type it in every time I open a new SSH session though I practically have it memorized.



Now for the Pipeline:
I'm working on my pipeline trying to get it to stream smoothly to twitch without lagging.
I noticed no matter what I set video_bitrate to, including 500, the pixel quality doesn't change on my stream. This makes me think I'm missing something in the pipeline to force it or I have it in the wrong place.

The stream runs all fine if there's very minor changes in what's happening on screen, but the second I start doing something in-game I get the warning message about things not keeping up. "downstream can't keep up and is consuming samples too slowly..."
I've been messing around with settings and such trying to figure it out. Figured time to come ask for help!


Here's my current pipeline broken down line by line: (Also the Sound quality is like listening inside a tube but that's the least of my problems I think setting the bitrate of the audio to 128k will solve that)

I built the pipeline based on a lot of google searches, copy pasting stuff and all around being a Dr. Frankenstein.

So what I gathered from a full night of testing last night:
- I think line #5 is unnecessary.
- video_bitrate on line 4 doesn't do anything other than break the stream if I set it too low (like 100) - quality looks the same no matter what it's set to.
- Adding ! videoconvert and ! videorate before line 4 randomly stabilizes my stream, but most of the time will lag as if nothing was changed (had a good 15 minutes lapping the racetrack in a racing game without any video lag on two of my stream tests) - So I know the pi is fully capable of doing what I'm asking of it, just not sure what I need in my pipeline.


Here's a video of me driving really badly (on purpose.. right) to get the pixels moving and there's no video lag at all
I muted audio on my PC when I did this one, but don't think that's the reason it isn't lagging.
https://www.twitch.tv/videos/402289986

Here's one where it's lagging pretty badly:
https://www.twitch.tv/videos/402296220

The vids expire in 2 weeks from this post if anyone is looking at this in the future!


1. gst-launch-1.0 flvmux streamable=true name=mux ! rtmpsink location="rtmp://live.justin.tv/app/STREAMKEY" v4l2src
2. ! "video/x-raw,framerate=60/1,format=UYVY"
3. ! identity sync=true
4. ! v4l2h264enc extra-controls="controls,h264_profile=0,video_bitrate=256000;"
5. ! video/x-h264,profile=high
6. ! h264parse
7. ! queue
8. ! mux. alsasrc device=hw:1
9. ! audio/x-raw,rate=48000,channels=2
10. ! identity sync=true
11. ! audioconvert
12. ! avenc_aac bitrate=48000
13. ! aacparse ! queue ! mux.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
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 Mar 28, 2019 4:57 pm

cyphercolt wrote:
Thu Mar 28, 2019 4:35 pm
So now that I know the pi is capable of streaming the B101 to twitch at at least 720p60, I now have to get my pipeline right.

Starting with the small annoying thing (not too big of a deal just bugs me each time)
"export LD_LIBRARY_PATH=/usr/local/lib/"
Any way to make this permanent so I don't have to type it in every time I open a new SSH session though I practically have it memorized.
Edit ~/.bashrc, or amend the script to install somewhere else.
cyphercolt wrote: Now for the Pipeline:
<snip>

1. gst-launch-1.0 flvmux streamable=true name=mux ! rtmpsink location="rtmp://live.justin.tv/app/STREAMKEY" v4l2src
2. ! "video/x-raw,framerate=60/1,format=UYVY"
3. ! identity sync=true
4. ! v4l2h264enc extra-controls="controls,h264_profile=0,video_bitrate=256000;"
5. ! video/x-h264,profile=high
6. ! h264parse
7. ! queue
8. ! mux. alsasrc device=hw:1
9. ! audio/x-raw,rate=48000,channels=2
10. ! identity sync=true
11. ! audioconvert
12. ! avenc_aac bitrate=48000
13. ! aacparse ! queue ! mux.
This is getting very off topic for this thread, but a couple of suggestions:
- Drop the identity components unless they are really performing a useful purpose. Particularly in the v4l2src to v4l2h264enc path you are dealing with buffers that are just under 2MB each and 60 of them a second, so you don't want to end up buffering up any of those unless you have to.
- "v4l2src io-mode=4 ! v4l2h264enc output-io-mode=5" should ensure that GStreamer is passing dma-bufs between the two components, otherwise those 2MB buffers will be copied between the components.
- Test by capturing to a local file, not streaming. Use "matroskamux ! filesink foo.mkv" instead of flvmux and rtmpsink. You'll probably want "gst-launch-1.0 -e" to push an end of stream message down the pipe when you hit ctrl-c to make it close the file off properly.
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.

cyphercolt
Posts: 14
Joined: Thu Mar 21, 2019 4:34 pm

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

Thu Mar 28, 2019 4:59 pm

6by9 wrote:
Thu Mar 28, 2019 4:57 pm
cyphercolt wrote:
Thu Mar 28, 2019 4:35 pm
So now that I know the pi is capable of streaming the B101 to twitch at at least 720p60, I now have to get my pipeline right.

Starting with the small annoying thing (not too big of a deal just bugs me each time)
"export LD_LIBRARY_PATH=/usr/local/lib/"
Any way to make this permanent so I don't have to type it in every time I open a new SSH session though I practically have it memorized.
Edit ~/.bashrc, or amend the script to install somewhere else.
cyphercolt wrote: Now for the Pipeline:
<snip>

1. gst-launch-1.0 flvmux streamable=true name=mux ! rtmpsink location="rtmp://live.justin.tv/app/STREAMKEY" v4l2src
2. ! "video/x-raw,framerate=60/1,format=UYVY"
3. ! identity sync=true
4. ! v4l2h264enc extra-controls="controls,h264_profile=0,video_bitrate=256000;"
5. ! video/x-h264,profile=high
6. ! h264parse
7. ! queue
8. ! mux. alsasrc device=hw:1
9. ! audio/x-raw,rate=48000,channels=2
10. ! identity sync=true
11. ! audioconvert
12. ! avenc_aac bitrate=48000
13. ! aacparse ! queue ! mux.
This is getting very off topic for this thread, but a couple of suggestions:
- Drop the identity components unless they are really performing a useful purpose. Particularly in the v4l2src to v4l2h264enc path you are dealing with buffers that are just under 2MB each and 60 of them a second, so you don't want to end up buffering up any of those unless you have to.
- "v4l2src io-mode=4 ! v4l2h264enc output-io-mode=5" should ensure that GStreamer is passing dma-bufs between the two components, otherwise those 2MB buffers will be copied between the components.
- Test by capturing to a local file, not streaming. Use "matroskamux ! filesink foo.mkv" instead of flvmux and rtmpsink. You'll probably want "gst-launch-1.0 -e" to push an end of stream message down the pipe when you hit ctrl-c to make it close the file off properly.
I'll start a new thread if I still can't get it working then! Sorry about that.

I'll check it out tonight. Thanks!

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

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

Fri Mar 29, 2019 5:38 pm

Hi All,

Has anyone else tried to produce their own board with the TC358743 on it? I'm having issues with it detecting a video input and I get the message "vidioc_query_dv_timings: failed: link has been severed". I've checked the usual, clean supplies, 27MHz clock present, device listed under lsmod, i2cdetect -y 0 shows it's present and I can upload the EDID all without issue. I'm pretty sure that the 2 EDID lines aren't used and that comms over the HDMI port are via DDC_CLK and DDC_DAT, and there is a nice and clean frequent query over it. I've checked mine against the B101 and the only differences I can see are the HotPlug detect lines showing a different voltage when the source isn't connected but is exactly the same when it is connected.

Please, please if anyone has any pointers can they help out a now going more and more bald each hour development engineer???
The ADV7280A-M version of this is working absolutely wonderfully by the way and I will give the person that helps me figure this out a free CVBS capture board when they're made and I'll also give you a free SGTL5000 sound card to play with and keep. I hope the incentive is enough guys and gals....

TIA, Dan

cyphercolt
Posts: 14
Joined: Thu Mar 21, 2019 4:34 pm

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

Fri Mar 29, 2019 7:34 pm

DanR wrote:
Fri Mar 29, 2019 5:38 pm
Hi All,

Has anyone else tried to produce their own board with the TC358743 on it? I'm having issues with it detecting a video input and I get the message "vidioc_query_dv_timings: failed: link has been severed". I've checked the usual, clean supplies, 27MHz clock present, device listed under lsmod, i2cdetect -y 0 shows it's present and I can upload the EDID all without issue. I'm pretty sure that the 2 EDID lines aren't used and that comms over the HDMI port are via DDC_CLK and DDC_DAT, and there is a nice and clean frequent query over it. I've checked mine against the B101 and the only differences I can see are the HotPlug detect lines showing a different voltage when the source isn't connected but is exactly the same when it is connected.

Please, please if anyone has any pointers can they help out a now going more and more bald each hour development engineer???
The ADV7280A-M version of this is working absolutely wonderfully by the way and I will give the person that helps me figure this out a free CVBS capture board when they're made and I'll also give you a free SGTL5000 sound card to play with and keep. I hope the incentive is enough guys and gals....

TIA, Dan
I'm nowhere near an expert but have been messing with my B101 board for the last week and have to set my EDID on each reboot.
I set my EDID file like this:

v4l2-ctl --set-edid=file=EDIDFILENAME.txt --fix-edid-checksums
v4l2-ctl --set-dv-bt-timings query

Not sure if that's what you're already doing!

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

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

Mon Apr 01, 2019 8:37 am

Hiya Cyphercolt et al,

Yep, I'm setting the EDID fine, I have the B101 board which I bought to check that the TC358743 did what I wanted. However the hardware needs to be all inclusive so I've designed the board with the TC358743 on board. As I say I can communicate with it fine and the input signals look absolutely fine to me but it just won't detect my video source. I guess my post is more of an electronics type of question rather than a driver one so this may be the wrong place to ask, sorry if that's the case but I'm quickly running out of options and I need this up and running asap. Don't worry @auvidea guys my product does not encroach on yours in anyway and it never will, so if you have any idea's too that would be great?? The product is not for the general public and is very niche.

Kind Regards,

Dan

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
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

Mon Apr 01, 2019 9:06 am

DanR wrote:
Mon Apr 01, 2019 8:37 am
Hiya Cyphercolt et al,

Yep, I'm setting the EDID fine, I have the B101 board which I bought to check that the TC358743 did what I wanted. However the hardware needs to be all inclusive so I've designed the board with the TC358743 on board. As I say I can communicate with it fine and the input signals look absolutely fine to me but it just won't detect my video source. I guess my post is more of an electronics type of question rather than a driver one so this may be the wrong place to ask, sorry if that's the case but I'm quickly running out of options and I need this up and running asap. Don't worry @auvidea guys my product does not encroach on yours in anyway and it never will, so if you have any idea's too that would be great?? The product is not for the general public and is very niche.
"v4l2-ctl --log-status" will dump out a load of the internal state of the chip, including the status for cable detected, DDC enabled, hotplug, CEC, and a load of other stuff. I'd suggest you compare between the B101 and your board to see if something is amiss there.

I believe you are correct that the EDID lines are not required. They appear to be an I2C master, with the comment
EDID controller is capable of fetching the EDID data from external memory device.
To download the external EPROM data into EDID_SRAM, Application processor need to writes
into EDID configuration to trigger the EDID master controller to download the external Eprom data
into EDID_SRAM.
I read that as being used to store a default EDID should you not program it from the Pi.
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

Mon Apr 01, 2019 10:30 am

Hiya 6by9,

Thanks I'll check that between my board and the B101 I have. I think you're spot on with the i2c master on the edid lines so I can rule that out. I think it's more likely the hot plug lines being my issue and I may have a dead chip so I'll be checking against my second dev board when I get it back tomorrow.

Cheers, Dan

johnashmore
Posts: 5
Joined: Wed Apr 03, 2019 11:50 am

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

Wed Apr 03, 2019 12:01 pm

Hi,

Had some success so far with the Auvidea B101 rev 4 by following this forum. Following 6x9's guides I've been able to use yavta to capture some video through the board.

What I'm really trying to do though is use this for Hyperion and wondered if anyone had success making the this work as the v4l2 grabber?

When I use the following command:

Code: Select all

sudo hyperion-v4l2 --width 320 --height 180 --screenshot
I get this error:

Code: Select all

hyperion-v4l2:
version : V1.03.4 (brindosch-c750c41/dc6a602-1522918225
build time: Apr 5 2018 01:57:25
V4L2GRABBER INFO: width=640 height=480
V4L2GRABBER ERROR: Only pixel formats UYVY, YUYV, and RGB32 are supported ERROR
I re-tried running:

Code: Select all

v4l2-ctl --set-edid=file=/boot/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
And then:

Code: Select all

$ v4l2-ctl --query-dv-timings
Active width: 1280
Active height: 720
Total width: 1980
Total height: 750
Frame format: progressive
Polarities: -vsync -hsync
Pixelclock: 74250000 Hz (50.00 frames per second)
Horizontal frontporch: 0
Horizontal sync: 700
Horizontal backporch: 0
Vertical frontporch: 0
Vertical sync: 30
Vertical backporch: 0
Standards: 
Flags: 
But still cannot get the test screenshot. When I actually try and run Hyperion, I get the following error:

Code: Select all

VIDIOC_S_STD ERROR 25, Inappropriate ioctl for device
Anyone else trying Hyperion or had success that can guide me?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
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 Apr 03, 2019 3:31 pm

johnashmore wrote:
Wed Apr 03, 2019 12:01 pm
When I use the following command:

Code: Select all

sudo hyperion-v4l2 --width 320 --height 180 --screenshot
I get this error:

Code: Select all

hyperion-v4l2:
version : V1.03.4 (brindosch-c750c41/dc6a602-1522918225
build time: Apr 5 2018 01:57:25
V4L2GRABBER INFO: width=640 height=480
V4L2GRABBER ERROR: Only pixel formats UYVY, YUYV, and RGB32 are supported ERROR
That would appear to be from https://github.com/hyperion-project/hyp ... r.cpp#L435, but the TC358743 supports UYVY, so it's a little odd that it is objecting that much.
Unless it isn't bothering to select a format and finds that the default (BGR888) isn't one that it likes.
You could try "v4l2-ctl -v pixelformat=UYVY" first to choose UYVY and see if it is happier.
johnashmore wrote:
Wed Apr 03, 2019 12:01 pm
But still cannot get the test screenshot. When I actually try and run Hyperion, I get the following error:

Code: Select all

VIDIOC_S_STD ERROR 25, Inappropriate ioctl for device
Anyone else trying Hyperion or had success that can guide me?
It is correct that VIDIOC_S_STD is an inappropriate ioctl for the TC358743. S_STD selects an analogue TV standard (NTSC/PAL/SECAM and their variants), whilst we're looking at digital video timings (VIDIOC_S_DV_TIMINGS).

It looks to be the code at https://github.com/hyperion-project/hyp ... r.cpp#L326 that is throwing this out. If you can get a value of VIDEOSTANDARD_NO_CHANGE passed in at https://github.com/hyperion-project/hyp ... 2.cpp#L122 then it should skip that step (the default should be NO_CHANGE, so something slightly odd is happening). Is there a config file that contains any reference to the colour standard?
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.

johnashmore
Posts: 5
Joined: Wed Apr 03, 2019 11:50 am

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

Wed Apr 03, 2019 5:09 pm

6by9 wrote:
Wed Apr 03, 2019 3:31 pm
johnashmore wrote:
Wed Apr 03, 2019 12:01 pm
When I use the following command:

Code: Select all

sudo hyperion-v4l2 --width 320 --height 180 --screenshot
I get this error:

Code: Select all

hyperion-v4l2:
version : V1.03.4 (brindosch-c750c41/dc6a602-1522918225
build time: Apr 5 2018 01:57:25
V4L2GRABBER INFO: width=640 height=480
V4L2GRABBER ERROR: Only pixel formats UYVY, YUYV, and RGB32 are supported ERROR
That would appear to be from https://github.com/hyperion-project/hyp ... r.cpp#L435, but the TC358743 supports UYVY, so it's a little odd that it is objecting that much.
Unless it isn't bothering to select a format and finds that the default (BGR888) isn't one that it likes.
You could try "v4l2-ctl -v pixelformat=UYVY" first to choose UYVY and see if it is happier.
johnashmore wrote:
Wed Apr 03, 2019 12:01 pm
But still cannot get the test screenshot. When I actually try and run Hyperion, I get the following error:

Code: Select all

VIDIOC_S_STD ERROR 25, Inappropriate ioctl for device
Anyone else trying Hyperion or had success that can guide me?
It is correct that VIDIOC_S_STD is an inappropriate ioctl for the TC358743. S_STD selects an analogue TV standard (NTSC/PAL/SECAM and their variants), whilst we're looking at digital video timings (VIDIOC_S_DV_TIMINGS).

It looks to be the code at https://github.com/hyperion-project/hyp ... r.cpp#L326 that is throwing this out. If you can get a value of VIDEOSTANDARD_NO_CHANGE passed in at https://github.com/hyperion-project/hyp ... 2.cpp#L122 then it should skip that step (the default should be NO_CHANGE, so something slightly odd is happening). Is there a config file that contains any reference to the colour standard?
I think you definitely picked up on something here. The HyperCon utility automatically adds either PAL or NTSC to the config file. By manually removing this I was able to get Hyperion to actually run with no errors thrown.

I know need to try with my full set up and report back.

johnashmore
Posts: 5
Joined: Wed Apr 03, 2019 11:50 am

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

Wed Apr 17, 2019 5:55 pm

I'm having a bit of an issue trying to control the B101. I've been able to change the pixel format to match what is required for Hyperion but can't get the size to change. When using:

Code: Select all

sudo v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=1
I get:

Code: Select all

pi@raspberrypi:~ $ sudo v4l2-ctl --all
Driver Info (not using libv4l2):
Driver name : unicam
Card type : unicam
Bus info : platform:unicam 3f801000.csi
Driver version: 4.19.30
Capabilities : 0x85200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x05200001
Video Capture
Read/Write
Streaming
Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: ok)
DV timings:
Active width: 640
Active height: 480
Total width: 800
Total height: 525
Frame format: progressive
Polarities: -vsync -hsync
Pixelclock: 25175000 Hz (59.94 frames per second)
Horizontal frontporch: 16
Horizontal sync: 96
Horizontal backporch: 48
Vertical frontporch: 10
Vertical sync: 2
Vertical backporch: 33
Standards: CEA-861, DMT
Flags: 
DV timings capabilities:
Minimum Width: 640
Maximum Width: 1920
Minimum Height: 350
Maximum Height: 1200
Minimum PClock: 13000000
Maximum PClock: 165000000
Standards: CEA-861, DMT, CVT, GTF
Capabilities: Progressive, Reduced Blanking, Custom Formats
Format Video Capture:
Width/Height : 640/480
Pixel Format : 'UYVY'
Field : None
Bytes per Line : 1280
Size Image : 614400
Colorspace : SMPTE 170M
Transfer Function : Default
YCbCr/HSV Encoding: Default
Quantization : Default
Flags : 

User Controls

audio_sampling_rate (int) : min=0 max=768000 step=1 default=0 value=0 flags=read-only
audio_present (bool) : default=0 value=0 flags=read-only

Digital Video Controls

power_present (bitmask): max=0x00000001 default=0x00000000 value=0x00000001 flags=read-only
I just can't get the size to change from 640x480, even if I run these commands before::

Code: Select all

v4l2-ctl --set-edid=file=/boot/1080P50EDID.txt --fix-edid-checksums

v4l2-ctl --query-dv-timings
Any ideas why?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
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 Apr 17, 2019 7:16 pm

There is no resizing available in the pipe. Whatever is detected/set as the dv timings is what will be produced - you can not change the width/height from what the source produces.
If necessary then alter the edid to make vga the only advertised mode, but that may then mess up other bits of your media system.
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.

johnashmore
Posts: 5
Joined: Wed Apr 03, 2019 11:50 am

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

Sat Apr 20, 2019 9:32 am

OK, so using something like the following command is useless, because the source dictates the size right? :

Code: Select all

v4l2-ctl --device /dev/video0 --set-fmt-video=width=1280,height=720,pixelformat=UYVY
What I can't seem to understand though is why when I query the DV timings I get the correct active sizes (tested with an Apple TV and MacBook Pro connected):

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl --query-dv-timings
	Active width: 1280
	Active height: 720
	Total width: 1650
	Total height: 750
	Frame format: progressive
	Polarities: -vsync -hsync
	Pixelclock: 74250000 Hz (60.00 frames per second)
	Horizontal frontporch: 0
	Horizontal sync: 370
	Horizontal backporch: 0
	Vertical frontporch: 0
	Vertical sync: 30
	Vertical backporch: 0
	Standards: 
	Flags: 
But when I run the --all command, the active DV Timings are different and match the Format Video Capture settings, which I understand shouldn't matter?

Code: Select all

pi@raspberrypi:~ $ v4l2-ctl --all
Driver Info (not using libv4l2):
	Driver name   : unicam
	Card type     : unicam
	Bus info      : platform:unicam 3f801000.csi
	Driver version: 4.19.30
	Capabilities  : 0x85200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
		Device Capabilities
	Device Caps   : 0x05200001
		Video Capture
		Read/Write
		Streaming
		Extended Pix Format
Priority: 2
Video input : 0 (Camera 0: ok)
DV timings:
	Active width: 640
	Active height: 480
	Total width: 800
	Total height: 525
	Frame format: progressive
	Polarities: -vsync -hsync
	Pixelclock: 25175000 Hz (59.94 frames per second)
	Horizontal frontporch: 16
	Horizontal sync: 96
	Horizontal backporch: 48
	Vertical frontporch: 10
	Vertical sync: 2
	Vertical backporch: 33
	Standards: CEA-861, DMT
	Flags: 
DV timings capabilities:
	Minimum Width: 640
	Maximum Width: 1920
	Minimum Height: 350
	Maximum Height: 1200
	Minimum PClock: 13000000
	Maximum PClock: 165000000
	Standards: CEA-861, DMT, CVT, GTF
	Capabilities: Progressive, Reduced Blanking, Custom Formats
Format Video Capture:
	Width/Height      : 640/480
	Pixel Format      : 'UYVY'
	Field             : None
	Bytes per Line    : 1280
	Size Image        : 614400
	Colorspace        : SMPTE 170M
	Transfer Function : Default
	YCbCr/HSV Encoding: Default
	Quantization      : Default
	Flags             : 

User Controls

            audio_sampling_rate (int)    : min=0 max=768000 step=1 default=0 value=48000 flags=read-only
                  audio_present (bool)   : default=0 value=1 flags=read-only

Digital Video Controls

                  power_present (bitmask): max=0x00000001 default=0x00000000 value=0x00000001 flags=read-only
When I'm using Hyperion, my config file dictates a size of 1280x720 but this seems to be ignored and reverts to 640x480.

Is there something I'm missing here? I actually got it working once, but only once.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
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 Apr 20, 2019 11:21 am

"v4l2-ctl --query-dv-timings" asks the hardware what it can see on the input. It does not adopt those settings.

"v4l2-ctl --set-dv-bt-timings query" will set the dv timings to be the same as those detected.
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.

johnashmore
Posts: 5
Joined: Wed Apr 03, 2019 11:50 am

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

Sun Apr 21, 2019 6:02 pm

6by9 you are a legend!

That worked and I can now consistently get it all to work. So grateful for your support and advice, as well as TPmodding over on the Hyperion forums.

Super pleased I now have a RPi with the Auvidea B101 working for Hyperion. Makes a much cleaner set up than the other options.

Thanks!

BliMatrix
Posts: 5
Joined: Tue Apr 23, 2019 9:14 am

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

Wed Apr 24, 2019 9:20 am

This is a cheap way to get HDMI input to Raspberry Pi.The main chip of the module is Toshiba TC358743XBG. It's usage is exactly the same as the ordinary Raspberry Pi camera.https://www.youtube.com/watch?v=lYQuocM7VPI

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23079
Joined: Sat Jul 30, 2011 7:41 pm

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

Wed Apr 24, 2019 9:28 am

BliMatrix wrote:
Wed Apr 24, 2019 9:20 am
This is a cheap way to get HDMI input to Raspberry Pi.The main chip of the module is Toshiba TC358743XBG. It's usage is exactly the same as the ordinary Raspberry Pi camera.https://www.youtube.com/watch?v=lYQuocM7VPI
Too many posts like this - it's starting to look spammy. You don't want me to think you are spamming....have deleted other thread ressurections.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

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

Sat Apr 27, 2019 7:32 am

Hello everyone.
I read almost all the pages of this discussion and did not find a problem similar to my. I apologize in advance if I chose the wrong topic.

I'm using B102 HDMI to CSI-2 Bridge with PiZero to capture 720p60 from DVR camera (camera can output only 720p60 mode via HDMI) and send video over WiFi.
On Raspberry I'm using TinyCore linux distribution with camera software extension, so default raspivid utility is avaible. In B102 module discription there is no 720p60 mode listed, but it seems to work almost fine with raspivid set to 1280x720 and 60 fps. But the problem is very unstable output bitrate. If I ask raspivid to output h264 stream with 2 Mbit/s, real bitrate can be from 0.2 to 10 Mbit/s. Period of bitrate change is about 2-20 seconds and it's independent of scene (static/moving).

What could be the problem? Do I need to use special utility (described in this thread) to capture stream from B102 device or it can be some kind of hardware problem?
Thank you!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
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 Apr 27, 2019 7:55 am

SergCoder wrote:
Sat Apr 27, 2019 7:32 am
Hello everyone.
I read almost all the pages of this discussion and did not find a problem similar to my. I apologize in advance if I chose the wrong topic.

I'm using B102 HDMI to CSI-2 Bridge with PiZero to capture 720p60 from DVR camera (camera can output only 720p60 mode via HDMI) and send video over WiFi.
On Raspberry I'm using TinyCore linux distribution with camera software extension, so default raspivid utility is avaible. In B102 module discription there is no 720p60 mode listed, but it seems to work almost fine with raspivid set to 1280x720 and 60 fps. But the problem is very unstable output bitrate. If I ask raspivid to output h264 stream with 2 Mbit/s, real bitrate can be from 0.2 to 10 Mbit/s. Period of bitrate change is about 2-20 seconds and it's independent of scene (static/moving).

What could be the problem? Do I need to use special utility (described in this thread) to capture stream from B102 device or it can be some kind of hardware problem?
Thank you!
Please note the mesaage that should appear every time you run raspivid with the b102
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.
If you want support then you need to be using the Linux kernel drivers.
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

Tue May 14, 2019 9:52 am

6by9 wrote:
Sat Apr 27, 2019 7:55 am
Please note the mesaage that should appear every time you run raspivid with the b102
Thank you for work and support.
Now I read all thread carefully... sorry for dumb question :oops:
Now I compiled raspi_tc358743 and it works good.

Let me post this little instruction about compilation again:
git clone https://github.com/6by9/userland.git
cd userland
git checkout -t -b hdmi_in_hack origin/hdmi_in_hack
./buildme
/opt/vc/bin/raspi_tc358743
One more complicated question from me - is it possible to get 720p60 HDMI signal and encode only 50% of frames to get 720p30 output?
I need to drop frames somewhere between TC358743 and encoder, but my knowledge is not enough to find the right place in the code :(

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

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

Thu May 16, 2019 6:38 pm

Got some free time to work on this some more.
Wiped the SD card, reloaded everything as per instructions compiled by koop, noticed that my amazon device drops it's output when it does not see a device. rebooted the pi with device removed, then plugged device in and ran the 2 v4l commands for timing and this is what i get

pi@raspberrypi:~/yavta $ 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:~/yavta $ v4l2-ctl --query-dv-timings
Active width: 1280
Active height: 720
Total width: 1650
Total height: 750
Frame format: progressive
Polarities: -vsync -hsync
Pixelclock: 115087500 Hz (93.00 frames per second)
Horizontal frontporch: 0
Horizontal sync: 370
Horizontal backporch: 0
Vertical frontporch: 0
Vertical sync: 30
Vertical backporch: 0
Standards:
Flags:

Assuming it is correct, so ran ./yavta --capture=1000 -n 3 --encode-to=file.h264 -f UYVY -m -T /dev/video0 and now every frame is dropped

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) 1280x720 (stride 2560) field none buffer size 1843200
QUERY_DV_TIMINGS returned 1280x720 pixclk 115087500
Framerate is 93
Video format: UYVY (59565955) 1280x720 (stride 2560) field none buffer size 1843200
vc.ril.isp:in:0(UYVY)(0xe04fb0)type: video, fourcc: UYVY bitrate: 0, framed: 0 extra data: 0, (nil) width: 1280, height: 720, (0,0,1280,720) pixel aspect ratio: 0/0, frame rate: 0/0
buffers num: 3(opt 1, min 1), size: 1843200(opt 1843200, min: 1843200), 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 1382400 for encode/render
Writing data to file.h264
Create pool of 8 buffers of size 262144
Sent buffer 0xe0ed58
Sent buffer 0xe0ef30
Sent buffer 0xe0f108
Sent buffer 0xe0f2e0
Sent buffer 0xe0f4b8
Sent buffer 0xe0f690
Sent buffer 0xe0f868
Sent buffer 0xe0fa40
3 buffers requested, V4L2 returned 3 bufs.
length: 1843200 offset: 0 timestamp type/source: mono/EoF
Buffer 0/0 mapped at address 0x71a3e000.
Importing DMABUF 8 into VCSM...
...done. vcsm_handle 401408
Exported buffer 0 to dmabuf 8, vcsm handle 401408
Linking V4L2 buffer index 0 ptr 0xe10760 to MMAL header 0xe0b4c0. mmal->data 0xC0000003
length: 1843200 offset: 1843200 timestamp type/source: mono/EoF
Buffer 1/0 mapped at address 0x7187c000.
Importing DMABUF 9 into VCSM...
...done. vcsm_handle 405504
Exported buffer 1 to dmabuf 9, vcsm handle 405504
Linking V4L2 buffer index 1 ptr 0xe107d0 to MMAL header 0xe0b698. mmal->data 0xC0000004
length: 1843200 offset: 3686400 timestamp type/source: mono/EoF
Buffer 2/0 mapped at address 0x716ba000.
Importing DMABUF 10 into VCSM...
...done. vcsm_handle 409600
Exported buffer 2 to dmabuf 10, vcsm handle 409600
Linking V4L2 buffer index 2 ptr 0xe10840 to MMAL header 0xe0b870. mmal->data 0xC0000005
0 (0) [-] none 0 1843200 B 554.503887 554.511021 -15873.016 fps ts mono/EoF
1 (1) [-] none 1 1843200 B 554.511022 554.527706 140.154 fps ts mono/EoF
2 (2) [-] none 2 1843200 B 554.527706 554.544391 59.938 fps ts mono/EoF
DROPPED FRAME - 7135 and 23819, delta 16684
3 (0) [-] none 3 1843200 B 554.544389 554.561084 59.941 fps ts mono/EoF
DROPPED FRAME - 23819 and 40502, delta 16683
4 (1) [-] none 4 1843200 B 554.561073 554.577766 59.938 fps ts mono/EoF
DROPPED FRAME - 40502 and 57186, delta 16684
5 (2) [-] none 5 1843200 B 554.577758 554.594452 59.934 fps ts mono/EoF
DROPPED FRAME - 57186 and 73871, delta 16685
6 (0) [-] none 6 1843200 B 554.594440 554.611137 59.945 fps ts mono/EoF
DROPPED FRAME - 73871 and 90553, delta 16682
7 (1) [-] none 7 1843200 B 554.611124 554.627818 59.938 fps ts mono/EoF
DROPPED FRAME - 90553 and 107237, delta 16684
8 (2) [-] none 8 1843200 B 554.627808 554.644498 59.938 fps ts mono/EoF


HELP?

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7008
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 16, 2019 7:01 pm

Something sounds odd on those timings. 93fps and 115MHz pixel clock?!
Rerun the query dv timings, possibly after having disconnected and reconnected the source.
The frame timing is correct for 60fps, and the warning message just tells you that it differs from that which it has been told it is.
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.

Return to “Graphics, sound and multimedia”