Open main menu

Changes

C779

11,303 bytes removed, 13:09, 27 December 2021
no edit summary
* Chip Information-EN: [[File:TC358743XBG_datasheet_en_20171026.pdf|none|HDMI TO CSI-2 Chip-EN]]
* Chip Information-CN: [[File:TC358743XBG_datasheet_zh_cn_20151218.pdf|none|HDMI TO CSI-2 Chip-CN]]
 
==How to check whether this module is driven correctly?==
 
'''step1'''. Check this module if be driven?
 
After connecting all the cables, power on the Raspberry Pi, the C779 indicator light is normally green, and after opening the Raspberry Pi terminal, enter the following command:
ls /dev/video0
[[File:Ls-dev.png|none]]
 
then check if video0 appears. If it appears correctly, it means that the module has been successfully driven and is working normally.
 
Please try the following oreration if you can't find 'video0'
 
'''step2'''. update & upgrade the raspberry pi system (It may be necessary to update the software source according to your country, and this will take a long time)
sudo apt-get update
sudo apt-get upgrade
 
'''step3'''. Open camera module via raspi-config command;
sudo raspi-config
 
[[File:Raspi-config-1.jpg|800px]]
 
Navigate to ''''Interfacing Options'''' and hit Enter. Now select the ''''Camera'''' option, and hit the Enter key to enable it. Select “Finish” and select to '''reboot''' your Raspberry Pi.
 
[[File:Raspi-config-2.jpg|800px]]
 
sudo reboot
 
'''step4''': goto step1
 
'''step5''': if you still can't find 'video0' file in the /dev path, please try the following methods:
 
A: Confirm whether the HDMI input device has a signal, (you can test whether it is displayed normally by connecting to the screen)
 
B. Confirm whether the resolution and frame rate of the HDMI input device are below the maximum input resolution and frame rate(720p50\720p60\1080i50\1080p25);
 
C: We recommend that you download the lastest official image of Raspberry pi if you still don't solve your questions. Download URL: https://www.raspberrypi.org/downloads/raspberry-pi-os/
 
==Driver configuration==
 
1、edit / boot / config.txt, and add the line to the end of the file. Sudo is required.
 
dtoverlay=tc358743
 
2、Use "dmesg | grep CMA" to check the amount of memory allocated to the CMA heap.
 
dmesg | grep cma
 
Output: [ 0.000000] cma: Reserved 256 MiB at 0x000000001ec00000'''
 
If the report has less than 96MB of files assigned to CMA, edit / boot / config.txt and add.
 
dtoverlay=cma,cma-128
 
3、Restart raspberry pi.
sudo reboot
 
If all goes well, you should get a '''/dev/video0''' device.Using "arecord - L" will tell you whether the sound card of tc358743 is loaded correctly.
sudo arecord - L
 
==Use raspistill to take photos==
 
Raspistil function: run the camera at a specified time, and capture jpg images if necessary.
 
Format:raspistill [options]
 
Main image parameters and commands:
 
-?, --Help: help document
 
-w. -- width: set the image width < size > width
 
-h. -- height: set image height < size > height
 
-q. -- Quality: set JPEG quality < 0 to 100 >
 
-r. -- raw: add raw raw Bayer data to JPEG metadata
 
-o. -- output: output file name < file name >,
 
-l. -- Latest: link the latest complete image to the specified file < file name >
 
-v. -- verb: output details when running the camera
 
-t. -- timeout: the time delay is specified when photographing and closing. If it is not specified, the default is 5S
 
-e. -- encoding: encode to output the specified format file (jpg, BMP, GIF, PNG)
 
-TL, - timelapse: take one picture every < MS > at intervals
 
-k. -- keypress: press the key to trigger, press&apos; Enter &apos;to take a picture, press&apos; x&apos; and then &apos;Enter&apos; to exit
 
-s. - signal: signal triggered, waiting for another process signal to take a picture
 
-GC, - glcapture: capture GL frame buffer instead of camera image
 
-Set, - settings: retrieve the camera settings and write them to stdout
 
-CS, - camselect: select camera device < digital >, default 0
 
 
The above is just a list of some common commands. More detailed commands can be used by Baidu, Google or viewing help documents. Here are some specific examples:
 
After a delay of two seconds (in milliseconds), take a picture and save it as
 
image.jpg.raspistill -t 2000 -o image.jpg
 
Take a custom size photo.raspistill -t 2000 -o image.jpg -w 640 -h 480
 
Record a 5 second video clip (1080p25) using the default settings.raspivid -t 5000 -o
 
video.h264
 
Save to file a 5 second encoded camera stream image raspivid - t 5000 - O - >
 
My_file.h264
 
==Use gstreamer to call camera and audio==
NOTE: C779 does not support audio,if you refer to the following command, you must delete the content after mkv.
 
The driver of the Raspberry Pi transfers all controls to the user or the user's application. By default, there is no EDID loaded on the chip so that it can tell the resolution supported by the HDMI source. If you do not have an EDID file, you can create a file edid.txt and copy the following content to edid.txt.
<pre>
00ffffffffffff005262888800888888
1c150103800000780aEE91A3544C9926
0F505400000001010101010101010101
010101010101011d007251d01e206e28
5500c48e2100001e8c0ad08a20e02d10
103e9600138e2100001e000000fc0054
6f73686962612d4832430a20000000FD
003b3d0f2e0f1e0a2020202020200100
020321434e041303021211012021a23c
3d3e1f2309070766030c00300080E300
7F8c0ad08a20e02d10103e9600c48e21
0000188c0ad08a20e02d10103e960013
8e210000188c0aa01451f01600267c43
00138e21000098000000000000000000
00000000000000000000000000000000
00000000000000000000000000000000
</pre>
 
1. create edid.txt
cd ~
touch edid.txt
sudo nano edid.txt
 
Copy the above comment to edit.txt, save&exit;
[[File:Csi-edid-txt.png|none]]
 
Then use the following command to push it to the device.
v4l2-ctl --set-edid=file=edid.txt --fix-edid-checksums
 
[[File:Csi-edid.png|none]]
 
2. The driver will not automatically switch to the detected resolution. Use the following command to view the current input resolution.
<pre>
v4l2-ctl --query-dv-timings
v4l2-ctl --set-dv-bt-timings query
</pre>
[[File:Csi-framerate.png|none]]
 
4. Use gstreamer to save video and audio<ref name="note1"/>
gst-launch-1.0 v4l2src io-mode=5 ! video/x-raw, format=UYVY, framerate=25/1 ! v4l2h264enc output-io-mode=4 ! video/x-h264,profile=high ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv alsasrc device=hw:1 ! audio/x-raw,rate=48000,channels=2 ! audioconvert ! avenc_aac bitrate=48000 ! aacparse ! queue ! mux.
 
If the video and audio are well connected, you can get a playable video foo.kmv after running the above command. If the input video source has sound, you will be able to hear the corresponding sound.
 
'''Note''' that the version of the gst command tested here is below 1.8.
 
If your gstreamer is version 1.8 or above, you can try the following test command. In addition, alsasrc device=hw:1 represents the sound card of TC358743, you can use "arecord -l" to query.
 
#The sample command to recode a video with audio.
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,<span style="color:red;">framerate=30/1</span>,format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv alsasrc device=hw:1 ! audio/x-raw,rate=48000,channels=2 ! audioconvert ! avenc_aac bitrate=48000 ! aacparse ! queue ! mux.
 
#The sample command to recode a video without audio. (C779 doesn't support audio <ref name="note1"/>)
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,'''<span style="color:red;">framerate=30/1</span>''',format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv
 
Press CTRL+C to end recording.
 
PS: Please modify the above '''<span style="color:red;">framerate</span>''' parameter to the actual frame rate of your HDMI signal, the actual frame rate value is from the result of ''''v4l2-ctl --query-dv-timings'''' command.
[[File:Csi-framerate.png|none]]
 
For the above HDMI device, because the frame rate is 60, so we modify the framerate parameter to 60 like the followint command.
gst-launch-1.0 -vvv v4l2src ! "video/x-raw,'''<span style="color:red;">framerate=60/1</span>''',format=UYVY" ! v4l2h264enc extra-controls="controls,h264_profile=4,h264_level=13,video_bitrate=256000;" ! "video/x-h264,profile=high, level=(string)4.2" ! h264parse ! queue ! matroskamux name=mux ! filesink location=foo.mkv
 
== Video ==
https://youtu.be/L5qbZPrpPp0
{{#ev:youtube|https://youtu.be/L5qbZPrpPp0}}
 
Test video: https://youtu.be/yoAsw189yPI
 
Thanks for the video from Joel Johnson!
https://youtu.be/z6Ir254MBBw
{{#ev:youtube|https://youtu.be/z6Ir254MBBw}}
 
== FAQ ==
Q1: What to do if the module can't work normally?
 
A1:
 
* 1. Please use monitor to test, DO NOT use VNC.(Customer Feedback: During the VNC it spend some of gpu and there is not enough for camera.Based on RPi 4 + Hawkeye Firefly Mini)
* 2. First the HDMI device should be plugged in and have signal output before the Raspberry Pi is started.
* 3. Please check if there is a video related file in the /dev file.
* 4. Please provide us more details for us to confirm the issue.
a. First please send us your '''order number''' and tell us "Call command" "Input Device" and "Using Device".
 
b. What is the HDMI input device, resolution and frequency?
 
c. Which version of Raspberry Pi you use?
 
d. What is the specific calling command?
 
e. What is the terminal error notification?
 
 
Q2: Some python sample code
 
A2: The HDMI source supported by Raspberry Pi with the module is 720p/50fps,720p/60fps,1080i/50fps,1080p/24fps,1080p/25fps. Lower resolution is also working.
 
This is the python code used in my video.The Pi uses an official image with no other changes.
 
<pre>
from picamera import PiCamera
from time import
camera = PiCamera()
camera.start_preview()
sleep(1000)
camera.stop_preview()
 
</pre>
 
 
Q3:Customer Feedback 1 for your reference(https://www.amazon.com/gp/product/B0899L6ZXZ#customerReviews)
 
A3:
If you want to use your Raspberry Pi for HDMI capture, this is the only device I'm aware of that will do it. Furthermore you can do some powerful things that would normally require equipment costing many hundreds of dollars. For example, using always-on camera preview and a few lines of Python code you can easily do image flipping, rotation, and rudimentary scaling. Note that you can't adjust color or exposure, and audio is not passed through.
 
I've tried this with a variety of HDMI devices; half of them work perfectly, half of them don't work at all.
 
Things that worked just fine:
* GoPro Hero2
* Generic no-name HDMI camera
* OREI HD-102 1x2 HDMI splitter with a Google Chromecast attached to it (but see below)
 
There's a downside, though. I could not get any of these to work:
 
* Canon 6D, which causes a "PiCameraMMALError: Failed to enable connection: Out of resources" error
* Blackmagic ATEM Mini, which produces a scrambled picture
* Google Chromecast, because I don't think this device supports HDCP; but it works fine if you strip off the HDCP.
 
This HDMI input module does what I care about (capturing my generic HDMI camera), but it failed at some things that thankfully I didn't need it to do. Your use case may vary so don't be surprised if some HDMI devices don't work with it.
 
 
Q4:How to access using cs-ii output using l language. i need to access the frame buffer of it?
 
A4:Try to use raspistil -GC command to capture GL frame buffer instead of camera image.
==Notes==