Skip to main content

Camera on Ubuntu 20.04

Ubuntu 20.04 Only

This guide covers camera usage on Ubuntu 20.04. For Ubuntu 24.04, see the Camera - 24.04 guide which uses libcamera instead of the Qualcomm QMMF stack.

The Tachyon board supports a variety of camera configurations, including both CSI and V4L2 cameras.

  • The Qualcomm chipset includes 4 CSI2 interfaces, with 2 accessible on the board
  • V4L2-compatible USB cameras are supported and typically appear as /dev/video2
  • The Cheese application is pre-installed on the desktop image for quick webcam testing

Testing the Camera

note

These commands assume you are running as root. You can configure proper permissions for video devices later.

Set Environment Variable

Before launching graphical GStreamer applications as root, set the runtime directory:

export XDG_RUNTIME_DIR=/run/user/root

Display a Test Pattern

Verify your display pipeline is working by showing a test pattern on any connected display (HDMI or DSI):

gst-launch-1.0 videotestsrc ! videoconvert ! waylandsink async=true sync=false

Stream Live Camera Feed

Stream video from the internal CSI camera to the display using Qualcomm's QMMF (Qualcomm Multimedia Framework):

gst-launch-1.0 qtiqmmfsrc camera=0 name=qmmf \
! video/x-raw \
! videoflip method=clockwise \
! waylandsink fullscreen=true

You can adjust parameters like rotation, resolution, and framerate as needed.

Known Issue

This is currently not working on the desktop build due to errors opening the waylandsink. Investigation is ongoing.


Record Video to Disk

Save H.264-encoded video from the camera to a file:

gst-launch-1.0 -e qtiqmmfsrc camera=0 name=qmmf \
! video/x-raw,format=NV12,width=640,height=480,framerate=30/1 \
! qtic2venc \
! h264parse \
! mp4mux \
! queue \
! filesink location=/data/misc/camera/video.mp4

The -e flag ensures proper end-of-stream handling so the MP4 file is playable.


Capture a JPEG Snapshot

Capture a still image (single frame) as a JPEG:

gst-launch-1.0 -e qtiqmmfsrc camera=0 name=qmmf \
! video/x-raw,format=NV12,width=640,height=480,framerate=30/1 \
! jpegenc \
! multifilesink location=/data/misc/camera/snapshot.jpg

V4L2 Camera Notes

For USB webcams and other V4L2-compatible cameras:

  • Devices typically appear at /dev/video2 or higher
  • Use v4l2-ctl --list-devices to inspect connected cameras
  • GStreamer pipelines using v4l2src work with these devices:
gst-launch-1.0 v4l2src device=/dev/video2 \
! videoconvert \
! waylandsink

GUI Testing

For simple tests, launch the Cheese webcam application from the desktop:

cheese

No additional setup is required for most USB webcams. Cheese will auto-detect available cameras.


Troubleshooting

Camera not detected

  1. Check if the camera module is properly connected
  2. Verify kernel modules are loaded: lsmod | grep camera
  3. Check dmesg for errors: dmesg | grep -i camera

Wayland sink errors

If you encounter waylandsink errors, try:

  • Using a different sink: ximagesink or autovideosink
  • Ensuring your display session is properly initialized
  • Running from a full desktop session rather than SSH