bob james
bob james

Reputation: 63

How to record microphone to mp3 in Termux on Android?

I'm interested to try out Termux command line on Android to record microphone audio to mp3. I've tried running different commands but without much effect. Can anyone pinpoint correct example command to start recording of the microphone, to mp3, at a default location, for example downloads folder? (This is on Android Oreo)

termux-microphone-record

-d Start recording w/ defaults

-f Start recording to specific file

-l Start recording w/ specified limit (in seconds, unlimited for 0)

-e Start recording w/ specified encoder (aac, amr_wb, amr_nb)

-b Start recording w/ specified bitrate (in kbps)

-r Start recording w/ specified sampling rate (in Hz)

-c Start recording w/ specified channel count (1, 2, ...)

-i Get info about current recording

-q Quits recording

from https://wiki.termux.com/wiki/Termux-microphone-record

Upvotes: 5

Views: 4187

Answers (3)

Rucent88
Rucent88

Reputation: 950

Termux does not (yet) appear to support recording directly to mp3 format. To get an mp3, you'll need to convert your recording using ffmpeg.

AWR Wide format has good quality for speech recording.

# Begin recording
termux-microphone-record -e awr_wide -f filename.amr

# Stop recording
termux-microphone-record -q

# Convert to mp3
ffmpeg -i filename.amr filename.mp3

Upvotes: 2

lakis
lakis

Reputation: 21

You need to install 1. the app for Android Termux.Api (i did from F-droid) and 2. the linux package (pkg install) 3. i had to give permission to microphone for termux.Api

after it records and stops automatically with -l.

Upvotes: 0

Khan Saad
Khan Saad

Reputation: 966

The Below command will record for 10 sec and save your file.mp3 in your termux Home directory.

termux-microphone-record -d -f filename.mp3 -l 10

Upvotes: 0

Related Questions