Open main menu

Changes

C779-Software

270 bytes added, 15:56, 27 December 2021
no edit summary
v4l2-ctl -v pixelformat=UYVY
9. Use Install GStreamer tool; sudo apt install gstreamer1.0-tools view gstreamer to save video and audiotool version:<pre>pi@raspberrypi:~ $ gst-launch-1.0 --versiongst-launch-1.0 version 1.18.4GStreamer 1.18.4http://packages.qa.debian.org/gstreamer1.0</pre> <span style="color:red;">Note: </span>
Install gstreamer tool; sudo apt install gstreamer1Different versions have different command line parameters, which is very annoying.0-tools
10. 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 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.(GStreamer 1.18.4)
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.