This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] SK-AM68: How can I get started with streaming H264/H265 from a camera input

Part Number: SK-AM68

I am trying to get started streaming from a camera input to display on my host machine. Are there any steps to get started?

  • From the perspective of the Linux SDK here are steps to stream camera input to an external display monitor or stream on host machine.

    Camera Input Stream on to External Display Monitor:

    • Initial set up requires having a clean image and device tree binary (.dtb) on the sd card. Once the board is booting you can add the connection to the peripheral device by hot-plugging it. This should print a log on the interface showing the camera was successfully connected.
    • Additionally running v4l2-ctl --list-devices will print a list of what video capture devices are connected including the connected camera.
    • From here, the external display can be connected and should be recognized by the board, indicated by another log printing on the console.
    • Turn the graphical display server "Weston" by running systemctl stop weston.
    • The camera I am using is a logitech 1280x720p camera which captures as jpeg images that need to be decoded into raw video data to be displayed on the monitor. This is described by the pipeline below: 
      gst-launch-1.0 v4l2src device=/dev/video2 ! image/jpeg, width=1280, height=720 ! jpegparse ! jpegdec ! video/x-raw ! videoconvert ! kmssink driver-name=tidss plane-id=41 sync=false
    • Keep in mind, depending on your camera input the pipeline may be slightly different due to different input data, resolution, and device probing for the respective camera.

    Camera Input Stream on to Host Machine:

    • The initial setup on the host machine requires creating a .sdp file which contains the contents below:
      m=video 8887 RTP.AVP 96
      a=rtpmap:96 H264/90000
      c=IN IP4 127.0.0.1
      a=framerate:30

      I named this file 8887.sdp with 8887 being the port number I used. Name and edit the .sdp file according to whatever port you decide to use.
    • Additonally, for the setup you need to have ffmpeg installed to be able to run an ffplay command later on the host machine.
    • On the SK-AM68, ensure the device is probing the camera peripheral correctly. This can be checked with running v4l2-ctl --list-devices on the console. 
    • Once you can confirm the camera is probed, the Gstreamer pipeline command can be run:
      gst-launch-1.0 v4l2src device=/dev/video2 ! image/jpeg, width=1280, height=720 ! jpegparse ! jpegdec ! video/x-raw ! videoconvert ! v4l2h264enc extra-controls="enc,prepend_sps_and_pps_to_idr=1,video_gop_size=5" ! rtph264pay ! udpsink host=<yourip> port=<sdp port specified>
      Modify the pipeline according to the camera's resolution, input format, and device probing. For my particular camera, it captures 1280x720p jpeg images so I specified decoding them to be reformatted to raw-video to be encoded to h264 in the pipeline. Additionally, specify the host ip and sdp port from the .sdp file created earlier. 
    • Once this pipeline is running, on the host machine run this command specifying the .sdp file previously created:
      ffplay -protocol_whitelist "file,rtp,udp" -i 8887.sdp
    • Completing all these steps should create a window displaying the camera stream on the host machine.

    Initial Debugging Steps for Peripheral Probing and Booting:

    If the peripherals are not being probed by the board or having boot problems here are some debug steps:

    • To check if the board is probing your device run v4l2-ctl --list-devices to see the camera peripherals that are probed.
    • run lsmod on the console to see if modules are being read by the board. Make sure you are copying over the correct images and device tree binary. 
      • For the SK-AM68, the device tree binary needs to be k3-am68-sk-base-board.dtb in /root/boot/dtb/ti
    • If you are running into boot problems make sure the correct boot files are in the boot partition:
      • tiboot3.bin, tiboot3-j721s2-gp-evm.bin, tiboot3-j721s2-hs-fs-evm.bin, tispl.bin, u-boot.img, uEnv.txt
      • If you ls /boot and the boot partition is mounted here, listing the above boot files then run umount /boot. This should now list the Image and the device tree binary folder (dtb) instead.