Skip to content

Run RTMP Demo

Prerequisites

Before running rtmp_demo, you first need to:

  1. Install AVT SDK on your device:

    See AVTSDK Environment Setup for details. The installation script will install everything you need.

  2. Set up an RTMP server:

    You need a running RTMP server to receive and distribute the video stream. This can be:

    • A local server (e.g., Nginx with RTMP module)
    • A streaming service provider (e.g., YouTube Live, Twitch)
  3. Connect the cameras to the device

Run the Demo

This demo demonstrates how to create a simple RTMP stream pipeline using AVT SDK. Users then can view the RTMP stream using media player software like ffplay, PotPlayer or VLC media player.

Steps

  1. Create a script init.sh to configure the Wayland display environment1 for the demo:

    init.sh
    export XDG_RUNTIME_DIR=/dev/socket/weston
    export WAYLAND_DISPLAY=wayland-1
    

    Then you can source the script in your terminal:

    source init.sh
    
  2. Run the RTMP demo application. The application is installed to /usr/bin, so you can run it directly with the following command:

    rtmp_demo
    
  3. The application will prompt you to select the settings as shown in Run Record Demo, with additional options for configuring the RTMP service. You may select each setting, including both the RTMP name and RTMP stream key, according to your RTMP server setting.

    RTMP demo

    Settings for the camera and the RTMP service.

  4. After setup, the RTMP stream will start. You may use a media player to view the stream. Here we take ffplay for example:

    • Install the ffmpeg on host machine
      sudo apt update
      sudo apt install ffmpeg -y
      
    • Execute the command
      ffplay rtmp://<RTMP_STREAM_IP>/<RTMP_STREAM_KEY>
      
      FFplay stream

  1. The Wayland environment variables are required for all the demos, even when there's no visual display output, as they are essential for proper initialization of some underlying AVT SDK components and plugins. In general, it is recommended to always set them to prevent any potential issues.