Open main menu

Changes

C779-Software

442 bytes added, 16:04, 27 December 2021
no edit summary
v4l2-ctl -v pixelformat=UYVY
9. Check that the audio drivers / card is available to ALSA.<pre>pi@raspberrypi:~ $ arecord -l**** List of CAPTURE Hardware Devices ****card 1: tc358743 [tc358743], device 0: bcm2835-i2s-dir-hifi dir-hifi-0 [bcm2835-i2s-dir-hifi dir-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0</pre>Note: <span style="color:red;">card 1</span> means that the card number for the TC358743XBG is "1" and it might be different. 10. Install GStreamer tool;
sudo apt install gstreamer1.0-tools
view Check gstreamer tool version:
<pre>
pi@raspberrypi:~ $ gst-launch-1.0 --version
Different versions have different command line parameters, which is very annoying.
1011. Use gstreamer to record video and audio
#GStreamer v1.14 command
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 mkv is the corresponding soundoutput file.  
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.
Press CTRL+C to end recording.
PS: Please We recommend that you 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]]
Record the video and audio:
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 <span style="color:red;">alsasrc device=hw:1 </span> ! audio/x-raw,rate=48000,channels=2 ! audioconvert ! avenc_aac bitrate=48000 ! aacparse ! queue ! mux. Note: <span style="color:red;">alsasrc device=hw:1</span> - "1" means the audio card number, You must change to correct audio card number. 
10. For old raspberry pi os, you can use [[Raspistil]] to take photo.
<!--增加评论功能! -->
<comments />