# Audio recording
Source: [https://docs.qualcomm.com/doc/80-70020-50/topic/gst-audio-encode-example-without-flac.html](https://docs.qualcomm.com/doc/80-70020-50/topic/gst-audio-encode-example-without-flac.html)
The **gst-audio-encode-example** application encodes audio in FLAC or WAV formats.
A common use case for this application can be to encode live audio data for streaming or
storage.
The following figure shows the pipeline, which captures the audio, converts the stream
into FLAC or WAV formats, encodes the stream, and stores it in a file. For more
information about the plugins used in the pipeline, see [Pipeline flow](https://docs.qualcomm.com/doc/80-70020-50/topic/gst-audio-encode-example-without-flac.html#gst-audio-encode-example-without-flac__section_uj5_4v5_4bc).
Figure : gst-audio-encode-example 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
For this use case, if you have a live audio source (such as a microphone or an
internet radio stream), you can encode this audio data into a more compact or
standardized format for efficient transmission or storage.
1. In the terminal of the target device, run the following command for different
audio formats:
`gst-audio-encode-example -o
--audio_format=`
The following table provides a description of the command-line
parameters:
| Command-line parameter | Description |
| --- | --- |
| `-o` | Specifies the absolute path to the output audio file. |
| `-format` | Specifies the format of the audio file:
1 = FLAC
2 = WAV
|
For example, use the following commands to run the application for
FLAC and WAV audio formats:
- Encode FLAC
audio:
gst-audio-encode-example -o /etc/media/.flac --audio_format=1Copy to clipboard
- Encode WAV audio:
gst-audio-encode-example -o /etc/media/.wav --audio_format=2Copy 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-encode-example --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 captured audio is encoded and written to a file based on the chosen format (FLAC
or WAV).
## Pipeline flow
In the audio encoding, the pipeline differs slightly based on the encoding
format.
The following table lists the plugins used to run the audio recording
pipeline:
| Plugin | FLAC | WAV |
| --- | --- | --- |
| pulsesrc | Captures audio from the system sound device. | Captures audio from the system sound device. |
| capsfilter | Ensures that the audio is in a format suitable for the FLAC encoder. | – |
| audioconvert | Converts the audio to the required format. | Converts the audio to the required format. |
|
flacenc
wavenc
| flacenc encodes the audio into FLAC format. | wavenc encodes the audio into WAV format. |
| filesink | Writes the encoded audio to a file. | Writes the encoded audio to a file. |
## Related information
[Audio use cases](https://docs.qualcomm.com/doc/80-70020-50/topic/audio-use-cases.html)
**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
Audio playback](https://docs.qualcomm.com/bundle/publicresource/80-70020-50/topics/gst-audio-decode-sample.md) [Next Topic
Video transformation](https://docs.qualcomm.com/bundle/publicresource/80-70020-50/topics/gst-transform-example.md)