> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://mediakind.ferndocs.com/mkio/how-to/live-streaming/set-up-the-source-stream-using-gstreamer/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://mediakind.ferndocs.com/_mcp/server. # Set up the source stream using GStreamer Use GStreamer, a command-line tool to configure your source stream. We recommend using GStreamer v1.18 or later. ## Example ```shell gst-launch-1.0 -v videotestsrc ! video/x-raw,width=1920,height=1080,framerate=30/1 ! x264enc tune=zerolatency bitrate=500 speed-preset=superfast key-int-max=60 ! h264parse ! queue ! mux. audiotestsrc ! audio/x-raw,rate=44100 ! voaacenc bitrate=128000 ! queue ! mux. flvmux streamable=true name=mux ! rtmpsink location="rtmp:///" ``` ## Command breakdown The table describes each part of the command: ### Video component | Command | Description | | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `videotestsrc` | This is a test video source in GStreamer, which generates a test pattern. Replace this with your actual video source (e.g. v4l2src for webcams). | | `video/x-raw,width=1920,height=1080,framerate=30/1` | This caps filter sets the resolution and framerate of the raw video ( 1920x1080 sets the resolution to 1080p ). | | `x264enc` | Encodes the video as H.264. `tune=zerolatency` lowers latency. `bitrate=500` sets the bitrate to 500 kbps. `speed-preset=superfast` selects the encoding-speed preset. `key-int-max=60` sets a 60-frame keyframe interval, which is two seconds at 30 frames per second. Match this value to the Input key frame interval configured in [MK.IO](/mkio/how-to/live-streaming/set-up-a-live-streaming-event#configure-a-live-event). `h264parse` prepares the H.264 stream for RTMP. | ### Audio component | Command | Description | | -------------- | ------------------------------------------------------------------------------------ | | `audiotestsrc` | A test audio source for generating sample audio. Replace with your own audio source. | | `voaacenc` | Encodes the audio to AAC, which is compatible with RTMP. | | `queue` | Adds buffers between streams to help with sync issues. | ### RTMP component | Command | Description | | --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `flvmux` | Packs the H.264 video (and audio if included) into an FLV container, suitable for RTMP. | | `rtmpsink` | Sends the output stream to an RTMP server. | | `location="rtmp:///"` | The RTMP Input URL provided after you [start the live event](/mkio/how-to/live-streaming/set-up-a-live-streaming-event#start-streaming). |