Jump to content

Record audio with ffmpeg


Recommended Posts

Hi there,

 

I've been wasting many hours trying to figure out the following:

 

- I can use ffmpeg in my Terminal without problems

- when using ffmpeg in a workflow (bash), I get "[22:27:01.911] ERROR: 0 Record and Transcribe[Run Script] /Users/henrikpetersen/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/F0EC9245-15A1-413D-BCD3-9D2A1FF7C06E: line 24: 19662 Abort trap: 6           $FFMPEG_PATH -f avfoundation -i ":0" -t 5 -loglevel verbose "$RECORDINGS_DIR/$FILENAME" 2>&1"

 

My script is the following:

 

# Set the directory and file name
RECORDINGS_DIR="/Users/henrikpetersen/My_Drive/Recordings"
mkdir -p "$RECORDINGS_DIR"
FILENAME="recording_$(date "+%Y-%m-%d_%H-%M-%S").wav"

# Path to ffmpeg
FFMPEG_PATH="/opt/homebrew/bin/ffmpeg"

# Check if ffmpeg is available
if ! [ -x "$FFMPEG_PATH" ]; then
  echo "ffmpeg not found at $FFMPEG_PATH"
  exit 1
fi


# Kill any existing instances of ffmpeg
pkill -x ffmpeg

# Wait a moment to ensure the process has been terminated
sleep 1


# Record the audio
$FFMPEG_PATH -f avfoundation -i ":0" -t 5 -loglevel verbose "$RECORDINGS_DIR/$FILENAME" 2>&1


# Check if recording was successful
if [ $? -ne 0 ]; then
  echo "Recording failed"
  exit 1
else
  echo "Recording saved to $RECORDINGS_DIR/$FILENAME"
fi

 

 

- Any ideas?

- I realized that Alfred has Full Disk Access but is not listed under the microphone accessibility; but I also don't know how to trigger the accessibility for Alfred

 

Best,

Henrik 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...