# Audio and video encode Source: [https://docs.qualcomm.com/doc/80-70020-50/topic/gst-audio-video-encode.html](https://docs.qualcomm.com/doc/80-70020-50/topic/gst-audio-video-encode.html) The **gst-audio-video-encode** application encodes audio and video data, which is stored in a user-specified output file. A few use cases for this application are streaming services, video conferencing, and surveillance systems. The following figure shows the pipeline, which receives the video and audio feed, encodes, and parses the video stream. It then captures the audio stream and encodes it in MP3 format. Both streams are multiplexed and written to a file. For information about the plugins used in the pipeline, see [Pipeline flow](https://docs.qualcomm.com/doc/80-70020-50/topic/gst-audio-video-encode.html#gst-audio-video-encode__section_mj1_yfn_4bc). Figure : gst-audio-video-encode pipeline ## Prerequisites - [Get started with the Qualcomm IM SDK](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-51/install-sdk.html) for your Qualcomm Linux 1.5 or Ubuntu Server. - Activate SSH on your Qualcomm Linux or Ubuntu to sign in with SSH and connect to the target device. For instructions see: - [Sign in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-254/how_to.html#use-ssh) for Qualcomm Linux - [Sign in using SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-90441-1/Use_Ubuntu_on_RB3_Gen2_3.html#sign-in-to-the-rb3-gen-2-console-using-ssh) for Ubuntu Server Note: If SSH is already set up and Wi-Fi is connected, skip this step. - Use the HDMI port to connect the display to the device. For instructions, see [Set up HDMI display](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-18/samples.html). - Sign in to the target device using SSH. - In the terminal of the target device, run the following commands from the SSH shell of the target device to activate the display on the host computer: - For Linux: export XDG_RUNTIME_DIR=/dev/socket/weston && export WAYLAND_DISPLAY=wayland-1Copy to clipboard - For Ubuntu Server: export XDG_RUNTIME_DIR=/run/user/$(id -u ubuntu)/ && export WAYLAND_DISPLAY=wayland-1 Copy to clipboard - Connect the speaker to activate the audio on the target device. For instructions, see [Set up audio hardware](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-16/enable-audio.html). If you face issues in recording the audio, run the following command in the terminal of the target device: pactl set-default-source pal_source_speaker_micCopy to clipboard - If you face issues with the camera or display, see [Camera troubleshooting](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-17/troubleshooting.html) and [Display troubleshooting](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-18/debug.html). ## Run the application The following table lists the actions that can be performed for the common use cases of gst-audio-video-encode application:| Use case | Actions | | --- | --- | | Streaming services | Encode audio and video streams for live internet streaming. | | Security camera | Invert or rotate the video image to compensate for situations
where the camera is improperly mounted. | | Augmented reality | Scale or rotate the video feed to synchronize with the virtual
components. | 1. In the terminal of the target device, run the use case: gst-audio-video-encode -w -h -c -o /etc/media/.mp4Copy to clipboard The following table provides a description of the command-line parameters: | Command-line parameter | Description | | --- | --- | | `-w` | Specifies the camera width | | `-h` | Specifies the camera height | | `-c` | Specifies the video codec of the input file:

  • 1 for AVC (H.264)


  • 2 for HEVC (H.265)


| | `output-file` | Provides the absolute path to the output file | For example, use the following commands to run different video encode use cases: - AVC: gst-audio-video-encode -w 1920 -h 1080 -c 1 -o /etc/media/audiovideo.mp4Copy to clipboard - HEVC: gst-audio-video-encode -w 1920 -h 1080 -c 2 -o /etc/media/audiovideo.mp4Copy to clipboard 2. To stop the use case, use CTRL + C. 3. In the terminal of the target device, run the following command in the SSH shell to display the available help options: gst-audio-video-encode --helpCopy to clipboard 4. In the terminal of the host computer, run the following command to pull the files from the target device: scp root@:/etc/media/Copy to clipboard ## Expected output The encoded audio and video streams are multiplexed to an MP4 container and written to a file. ## Pipeline flow The following table lists the plugins used to run the audio and video stream encoding pipeline:| Plugin | Description | | --- | --- | | [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70020-50/topic/qtiqmmfsrc.html) and capsfilter | Captures the media stream. | | [v4l2h264enc](https://docs.qualcomm.com/doc/80-70020-50/topic/v4l2h264enc.html) | Encodes the video for AVC (H.264) format. | | [v4l2h265enc](https://docs.qualcomm.com/doc/80-70020-50/topic/v4l2h265enc.html) | Encodes the video for HEVC (H.265) format. | | h264parse | Parses the H.264 video stream. | | h265parse | Parses the H.265 video stream. | | [pulsesrc](https://docs.qualcomm.com/doc/80-70020-50/topic/pulsesrc.html) | Captures the audio from the stream, which is filtered using
capsfilter. | | audioconvert | Converts the audio for encoding. | | lamemp3enc | Encodes the audio in MP3 format. | | mp4mux | Multiplexes encoded video and audio into an MP4
container. | | filesink | Writes the stream into a file. | **Parent Topic:** [Run sample applications for video and audio](https://docs.qualcomm.com/doc/80-70020-50/topic/audio-sample-applications.html) Last Published: Jan 30, 2026 [Previous Topic Video playback](https://docs.qualcomm.com/bundle/publicresource/80-70020-50/topics/gst-video-playback-example.md) [Next Topic Audio playback](https://docs.qualcomm.com/bundle/publicresource/80-70020-50/topics/gst-audio-decode-sample.md)