# Audio and video encode
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-80021-50/topic/gst-audio-video-encode.html#section-mj1-yfn-4bc).
## Run the 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. Ensure that you complete the [Prerequisites](https://docs.qualcomm.com/doc/80-80021-50/topic/mm_sample_apps_prerequisites.html).
2. In the terminal of the target device, run the use case:
gst-audio-video-encode -w -h -c -o /etc/media/.mp4
Copy to clipboard
| 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:
``` {#codeblock_p5n_dm3_y1c}
gst-audio-video-encode -w 1920 -h 1080 -c 1 -o /etc/media/audiovideo.mp4
```
- HEVC:
``` {#codeblock_jz5_dm3_y1c}
gst-audio-video-encode -w 1920 -h 1080 -c 2 -o /etc/media/audiovideo.mp4
```
Copy to clipboard
3. To stop the use case, use **CTRL + C**.
4. 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 --help
Copy to clipboard
5. 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 multiplexed to an MP4 container and written to a file.
## Pipeline flow
| Plugin | Description |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-80021-50/topic/qtiqmmfsrc.html) and capsfilter | Captures the media stream. |
| [v4l2h264enc](https://docs.qualcomm.com/doc/80-80021-50/topic/v4l2h264enc.html) | Encodes the video for AVC (H.264) format. |
| [v4l2h265enc](https://docs.qualcomm.com/doc/80-80021-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-80021-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. |
## Known issue
Audio and video encode may not work if the sink isn't selected using wpctl.
Last Published: Mar 26, 2026
[Previous Topic
Video playback](https://docs.qualcomm.com/bundle/publicresource/80-80021-50/topics/gst-video-playback-example.md) [Next Topic
Audio playback](https://docs.qualcomm.com/bundle/publicresource/80-80021-50/topics/gst-audio-decode-sample.md)