# Audio recording 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-80021-50/topic/gst-audio-encode-example-without-flac.html#section-uj5-4v5-4bc). Audio capture pulsesrc capsfilter audioconvert flacenc wavenc filesink Filter flac wav Convert Encode Audio capture Convert Encode Write file Open source ## 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. 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 following command for different audio formats: `gst-audio-encode-example -o --audio_format=` | Command-line parameter | Description | | --- | --- | | `-o` | Specifies the absolute path to the output audio file. | | `-format` | Specifies the format of the audio file:
| For example, use the following commands to run the application for FLAC and WAV audio formats: - Encode FLAC audio: ``` {#codeblock_nrb_gm3_y1c} gst-audio-encode-example -o /etc/media/.flac --audio_format=1 ``` - Encode WAV audio: ``` {#codeblock_lhk_gm3_y1c} gst-audio-encode-example -o /etc/media/.wav --audio_format=2 ``` 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-encode-example --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 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. | **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. | ## Known issue Audio encode may not work if the audio sink isn't selected using wpctl. ## Related information [Audio use cases](https://docs.qualcomm.com/doc/80-80021-50/topic/audio-use-cases.html) Last Published: Mar 26, 2026 [Previous Topic Audio playback](https://docs.qualcomm.com/bundle/publicresource/80-80021-50/topics/gst-audio-decode-sample.md) [Next Topic Video transformation](https://docs.qualcomm.com/bundle/publicresource/80-80021-50/topics/gst-transform-example.md) Source: [https://docs.qualcomm.com/doc/80-80021-50/topic/gst-audio-encode-example-without-flac.html](https://docs.qualcomm.com/doc/80-80021-50/topic/gst-audio-encode-example-without-flac.html)