Skip to content

Instantly share code, notes, and snippets.

@rudolfbyker
Last active January 26, 2022 21:35
Show Gist options
  • Save rudolfbyker/0c613d20842b36e13b8482c6b34ff058 to your computer and use it in GitHub Desktop.
Save rudolfbyker/0c613d20842b36e13b8482c6b34ff058 to your computer and use it in GitHub Desktop.

Revisions

  1. rudolfbyker revised this gist Jan 26, 2022. No changes.
  2. rudolfbyker created this gist Jan 26, 2022.
    6 changes: 6 additions & 0 deletions purge.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    #!/usr/bin/env bash
    # Delete old recordings.

    DIR="$HOME/rec"
    EXPIRE=7
    find $DIR -mtime +$EXPIRE -type f -delete
    19 changes: 19 additions & 0 deletions record.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    #!/usr/bin/env bash

    # Put recordings in this folder
    DIR="$HOME/rec"

    # Prefix each file name with a timestamp
    NAME=$(date +%Y%m%d%H%M%S)

    # Split recording after $SEG seconds
    SEG=3600

    # Start recording

    # ALSA: (this works more directly with the hardware, but it disables pulseaudio, which is not so nice)
    #ffmpeg -loglevel warning -f alsa -i hw:0 -f segment -segment_time $SEG ${DIR}/${NAME}_%d.mp3

    # Pulseaudio:
    # TODO: Wait for pulseaudio to start!
    ffmpeg -loglevel warning -f pulse -i alsa_input.pci-0000_00_1b.0.analog-stereo -f segment -segment_time $SEG ${DIR}/${NAME}_%d.mp3