Open main menu

Changes

CSI Audio Video capturing using GStreamer

41 bytes added, 16:21, 27 June 2023
no edit summary
If you need to run RASPISTILL or RASPIVID again after the GStreamer is installed. You will need to reinstall a fresh Raspberry Pi OS and follow [[X630-Hardware-Reset | this guide]]
'''1. After the device is booted, update your Raspberry Pi by running the following commands in a terminal window:'''
sudo apt-get update
sudo apt-get upgrade -y
'''2. Install necessary dependency and remaining plugins for GStreamer'''
sudo apt-get install libx264-dev libjpeg-dev
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-tools
'''3. With all GStreamer modules installed let's test the installation with (not via SSH)'''
gst-launch-1.0 --version
gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
[[File:TestRPi-X630.png]]
'''4. Edit /boot/config.txt and enter the following'''
sudo nano /boot/config.txt
Then add the following comments:
Save and exit with ctrl + x, followed by y when prompted to save, and then enter.
'''5. Reboot the Raspberry Pi'''
sudo reboot
'''6. Once rebooted and check that the audio drivers / card is available to ALSA.'''
arecord -l
If the X630 module and drivers have been installed correctly you should see something similar to:
Note: card 2 means that the card number for the TC358743XBG is "2" and it might be different.
'''7. Create an EDID file so it can be loaded into the chip to allow it to tell the HDMI source what resolutions are supported.'''
sudo nano edid.txt
then enter the following:
Save and exit with ctrl + x, followed by y when prompted to save, and then enter.
'''8. Push this to the device using'''
v4l2-ctl --set-edid=file=edid.txt --fix-edid-checksums
'''9. To print the currently detected timings'''
v4l2-ctl --query-dv-timings
'''10. To select the currently detected timings'''
v4l2-ctl --set-dv-bt-timings query
'''11. Capture the incoming audio (no video)'''
arecord -D hw:x,0 -V stereo -r 48000 -f S16_LE -c 2 audio.wav
Press ctrl + c to finish a recording, the file will be saved to /home/pi
'''12. Capture the incoming video and audio'''
gst-launch-1.0 v4l2src io-mode=0 ! 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=video.mkv alsasrc device=hw:2 ! audio/x-raw,rate=48000,channels=2 ! audioconvert ! avenc_aac bitrate=48000 ! aacparse ! queue ! mux.