A Python wrapper around ffmpeg for recording and segmenting audio from system audio output.
- Hybrid Approach: Uses ffmpeg for robust audio capture and Python for user interface
- Automatic Segmentation: Records audio in configurable time segments (default: 15 minutes)
- Recording Time Limit: Optional total duration cap with human-friendly input (e.g., 30m, 2h)
- PulseAudio Integration: Works seamlessly with Linux audio systems
- Ogg Opus Format: Speech-optimized, compact files by default
- Easy Configuration: Simple configuration file for customization
- Device Detection: Automatically finds the best audio source
- Session Logs: Per-session rotating logs with metadata, ffmpeg output, and events
- Python 3.8+
- ffmpeg
- PulseAudio (Linux)
- Audio output device (speakers/headphones)
- Clone or download this repository
- Install Python dependencies:
pip install -r requirements.txt
- Install ffmpeg (if not already installed):
# On Arch Linux sudo pacman -S ffmpeg # On Ubuntu/Debian sudo apt install ffmpeg
-
Install and set up:
make install
-
Check available audio devices:
make devices
-
Start recording:
make start meeting_2025-01-19
-
Test mode (1-minute segments):
make test # or make start test_session TEST=true
-
Stop recording:
make stop
-
Check status and files:
make status make files
-
Check available audio devices:
python echolog.py devices
-
Start recording a session:
python echolog.py start --session-id "meeting_2025-01-19" -
Start recording with a specific device (override):
python echolog.py start -s "my_session" --device "alsa_output.usb-...analog-stereo.monitor"
Tip: find devices with
python echolog.py devices. -
Start recording in test mode (1-minute segments):
python echolog.py start --session-id "test_session" --test -
Stop recording:
python echolog.py stop
-
Check recording status:
python echolog.py status
-
List all recording files:
python echolog.py files
Edit echolog.conf to customize settings:
[recording]
segment_duration = 900 # 15 minutes
sample_rate = 16000 # 16 kHz (speech)
channels = 1 # Mono (speech)
format = ogg # Ogg container with Opus codec
output_dir = ~/recordings
time_limit = 0 # 0 disables; supports 90s, 30m, 2h
limit_boundary = immediate # or end_segment
[audio]
auto_detect_device = true
[logging]
# Log level: debug, info, warning, error
level = info
# Rotation strategy: size | time | off (size default)
rotation = size
# Max size (bytes) before rotating
max_bytes = 5242880
# How many rotated files to keep
backup_count = 3
# Use UTC timestamps
utc = true# Start recording with a session ID
python echolog.py start -s "session_01"
# Stop recording
python echolog.py stoppython echolog.py start -s "session_01" -o "/path/to/recordings"python echolog.py start -s "test_session" -tpython echolog.py statusLimit total recording time via CLI (overrides config):
python echolog.py start --session-id "lecture_2025-10-05" --time-limit 30m
# or stop after current segment at the limit
python echolog.py start -s "podcast_ep1" --time-limit 2h --limit-boundary end-segment# Increase verbosity to debug
python echolog.py start -s "session_01" --log-level debug
# Adjust rotation size and backups
python echolog.py start -s "session_01" --log-max-bytes 1048576 --log-backup-count 5On start, the application logs: Logging to <path>/session.log (level=INFO). The status command shows the log path.
Recordings are organized as follows:
~/recordings/
└── session_01/
├── session_01_20250119_143022_chunk_001.ogg
├── session_01_20250119_143022_chunk_002.ogg
└── session_01_20250119_143022_chunk_003.ogg
└── session.log
- Make sure PulseAudio is running:
pulseaudio --check - Check available sources:
pactl list short sources - Restart PulseAudio if needed:
pulseaudio --kill && pulseaudio --start
- Install ffmpeg using your package manager
- Make sure ffmpeg is in your PATH
- Make sure your user is in the
audiogroup - Check PulseAudio permissions
- When stopping recording mid-segment, the last chunk may show incorrect duration metadata
- This is normal behavior - the file contains all recorded audio
- The duration shown in media players may be longer than actual content
- Use
python echolog.py filesto check actual file sizes
- If logs are too noisy, use
--log-level warningor setlevel = warninginecholog.conf. - ffmpeg lines are logged at DEBUG unless they indicate warnings/errors.
The Makefile provides convenient shortcuts for common tasks:
# Show all available commands
make help
# Install dependencies
make install
# Run test recording (1-minute segments)
make test
# Start recording with session name
make start my_meeting
# Start test mode recording
make start test_session TEST=true
# Stop current recording
make stop
# Show status and files
make status
make files
# List audio devices
make devices
# Clean up temporary files
make clean
# Show system info
make infomake test
# or
pytestecholog.py- Main application and EchologRecorder classecholog.conf- Configuration filerequirements.txt- Python dependenciesMakefile- Convenient build and run commands
MIT License - see LICENSE file for details.