Skip to content

Commit e4332d6

Browse files
committed
feat: enhance setup process for Python runtime and FFmpeg across platforms; update extraction utility to use bundled binaries
1 parent 0ae33cf commit e4332d6

File tree

10 files changed

+395
-54
lines changed

10 files changed

+395
-54
lines changed

.github/workflows/build-artifacts.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,23 @@ jobs:
2020
node-version: '18'
2121
cache: 'npm'
2222

23-
- name: Setup Python
23+
- name: Setup Python (for setup script)
2424
uses: actions/setup-python@v4
2525
with:
26-
python-version: '3.9'
26+
python-version: '3.11'
2727

2828
- name: Install dependencies
2929
run: npm ci
3030

31-
- name: Install Python dependencies
32-
run: pip install -r requirements.txt
33-
34-
- name: Install FFmpeg
31+
- name: Setup binary dependencies
32+
shell: bash
3533
run: |
36-
choco install ffmpeg -y
37-
echo "FFmpeg installed successfully"
34+
chmod +x setup-binaries.sh
35+
./setup-binaries.sh windows
36+
# Install Python dependencies for Windows
37+
cd python-runtime-windows
38+
./python.exe get-pip.py
39+
./Scripts/pip.exe install -r ../requirements.txt
3840
3941
- name: Build Windows application
4042
run: npm run build:win
@@ -61,21 +63,19 @@ jobs:
6163
node-version: '18'
6264
cache: 'npm'
6365

64-
- name: Setup Python
66+
- name: Setup Python (for setup script)
6567
uses: actions/setup-python@v4
6668
with:
67-
python-version: '3.9'
69+
python-version: '3.11'
6870

6971
- name: Install dependencies
7072
run: npm ci
7173

72-
- name: Install Python dependencies
73-
run: pip install -r requirements.txt
74-
75-
- name: Install FFmpeg
74+
- name: Setup binary dependencies
75+
shell: bash
7676
run: |
77-
brew install ffmpeg
78-
echo "FFmpeg installed successfully"
77+
chmod +x setup-binaries.sh
78+
./setup-binaries.sh macos
7979
8080
- name: Build macOS application
8181
run: npm run build:mac

.github/workflows/build.yml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,26 @@ jobs:
2323
node-version: '18'
2424
cache: 'npm'
2525

26-
- name: Setup Python
26+
- name: Setup Python (for setup script)
2727
uses: actions/setup-python@v4
2828
with:
29-
python-version: '3.9'
29+
python-version: '3.11'
3030

3131
- name: Install dependencies
3232
run: npm ci
3333

34-
- name: Install Python dependencies
35-
run: pip install -r requirements.txt
36-
37-
- name: Install FFmpeg (Windows)
38-
if: matrix.os == 'windows-latest'
39-
run: |
40-
choco install ffmpeg -y
41-
echo "FFmpeg installed successfully"
42-
43-
- name: Install FFmpeg (macOS)
44-
if: matrix.os == 'macos-latest'
34+
- name: Setup binary dependencies
35+
shell: bash
4536
run: |
46-
brew install ffmpeg
47-
echo "FFmpeg installed successfully"
37+
chmod +x setup-binaries.sh
38+
if [ "${{ matrix.os }}" = "windows-latest" ]; then
39+
./setup-binaries.sh windows
40+
cd python-runtime-windows
41+
./python.exe get-pip.py
42+
./Scripts/pip.exe install -r ../requirements.txt
43+
else
44+
./setup-binaries.sh macos
45+
fi
4846
4947
- name: Build Windows application
5048
if: matrix.os == 'windows-latest'

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,10 @@ build
1111
.env.local
1212
.env.development.local
1313
.env.test.local
14-
.env.production.local
14+
.env.production.local
15+
16+
# Binary dependencies (downloaded by setup script)
17+
python-runtime/
18+
python-runtime-windows/
19+
ffmpeg-bin/
20+
ffmpeg-bin-windows/

README.md

Lines changed: 125 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ A powerful desktop application for recording meetings, lectures, and presentatio
1515
- **👀 Live Preview** - See what you're recording in real-time
1616
- **🔄 Cross-Platform** - Works seamlessly on Windows, macOS, and Linux
1717
- **🔒 Privacy-First** - All processing happens locally, no data sent to external servers
18+
- **⚡ Automated Setup** - One-command setup for all binary dependencies
1819

1920
## 📸 Screenshots
2021

@@ -72,7 +73,77 @@ npm run dev
7273
| **Ollama** | Local AI model for summarization |
7374
| **Python packages** | Speech-to-text processing |
7475

75-
## 🛠️ Installation Guide
76+
## 🛠️ Setup Guide
77+
78+
### Automated Setup (Recommended)
79+
80+
The easiest way to set up all binary dependencies:
81+
82+
```bash
83+
# Setup for current platform (recommended)
84+
./setup-binaries.sh
85+
86+
# Or setup for all platforms
87+
./setup-binaries.sh all
88+
89+
# Or setup for specific platform
90+
./setup-binaries.sh macos
91+
./setup-binaries.sh windows
92+
./setup-binaries.sh linux
93+
```
94+
95+
### What the Setup Script Does
96+
97+
#### macOS Setup
98+
- Creates a Python virtual environment in `python-runtime/`
99+
- Installs all dependencies from `requirements.txt`
100+
- Downloads FFmpeg binary to `ffmpeg-bin/`
101+
102+
#### Windows Setup
103+
- Downloads Python embeddable package to `python-runtime-windows/`
104+
- Sets up pip and prepares for dependency installation
105+
- Downloads FFmpeg binary to `ffmpeg-bin-windows/`
106+
107+
#### Linux Setup
108+
- Creates a Python virtual environment in `python-runtime/`
109+
- Installs all dependencies from `requirements.txt`
110+
- Downloads static FFmpeg binary to `ffmpeg-bin/`
111+
112+
### Directory Structure After Setup
113+
114+
After running the setup script, you'll have:
115+
116+
```
117+
├── python-runtime/ # macOS/Linux Python environment
118+
├── python-runtime-windows/ # Windows Python environment
119+
├── ffmpeg-bin/ # macOS/Linux FFmpeg binary
120+
├── ffmpeg-bin-windows/ # Windows FFmpeg binary
121+
├── audio_extractor.py # Python script for audio processing
122+
├── requirements.txt # Python dependencies
123+
└── setup-binaries.sh # Setup script
124+
```
125+
126+
### Windows Post-Setup
127+
128+
After running the Windows setup, manually install Python dependencies:
129+
130+
```bash
131+
cd python-runtime-windows
132+
python get-pip.py
133+
Scripts/pip install -r ../requirements.txt
134+
```
135+
136+
### Cross-Platform Builds
137+
138+
- Run `./setup-binaries.sh all` to set up binaries for all platforms
139+
- Use the appropriate npm script for your target platform:
140+
```bash
141+
npm run build:mac
142+
npm run build:win
143+
npm run build:linux
144+
```
145+
146+
## 🛠️ Manual Installation Guide
76147

77148
### FFmpeg Setup
78149

@@ -144,6 +215,59 @@ ffmpeg -version
144215
ollama list # if installed
145216
```
146217

218+
### Setup Troubleshooting
219+
220+
#### "Python not found" error
221+
- Make sure you've run `./setup-binaries.sh` first
222+
- Check that the Python runtime was created successfully
223+
- Verify the paths in `transcript.utils.ts` match your setup
224+
225+
#### "FFmpeg not found" error
226+
- Ensure FFmpeg was downloaded by the setup script
227+
- Check that the FFmpeg binary has execute permissions
228+
- Verify the FFmpeg path is correct for your platform
229+
230+
### Manual Binary Setup (Alternative)
231+
232+
If the automated setup doesn't work, you can manually set up the binaries:
233+
234+
#### Python Runtime
235+
1. Create a virtual environment: `python3 -m venv python-runtime`
236+
2. Activate it: `source python-runtime/bin/activate` (macOS/Linux)
237+
3. Install dependencies: `pip install -r requirements.txt`
238+
4. Deactivate: `deactivate`
239+
240+
#### FFmpeg
241+
1. Download from [FFmpeg website](https://ffmpeg.org/download.html)
242+
2. Extract to `ffmpeg-bin/` directory
243+
3. Ensure the binary is executable: `chmod +x ffmpeg-bin/ffmpeg`
244+
245+
### Python Dependencies
246+
247+
The app requires these Python packages (from `requirements.txt`):
248+
- `openai-whisper>=20231117` - For speech-to-text conversion
249+
- `SpeechRecognition>=3.10.0` - Alternative speech recognition
250+
- `pydub>=0.25.1` - Audio processing
251+
- `torch>=2.0.0` - Machine learning backend
252+
- `numpy>=1.24.0` - Numerical computations
253+
254+
### Important Notes
255+
256+
#### Development vs Production
257+
258+
- **Development mode**: Uses system Python and FFmpeg
259+
- **Packaged app**: Uses bundled Python runtime and FFmpeg
260+
261+
#### Gitignore
262+
263+
The binary directories are automatically ignored by git:
264+
- `python-runtime/`
265+
- `python-runtime-windows/`
266+
- `ffmpeg-bin/`
267+
- `ffmpeg-bin-windows/`
268+
269+
This keeps the repository clean while allowing developers to set up their own binaries.
270+
147271
## 🎯 Usage
148272

149273
### Basic Recording Workflow

audio_extractor.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from pydub import AudioSegment
1515
import whisper
1616

17-
def extract_audio_from_video(video_path, output_audio_path=None):
17+
def extract_audio_from_video(video_path, ffmpeg_path, output_audio_path=None):
1818
"""
1919
Extract audio from video file using ffmpeg
2020
"""
@@ -24,7 +24,7 @@ def extract_audio_from_video(video_path, output_audio_path=None):
2424
output_audio_path = os.path.join(temp_dir, f"extracted_audio_{os.path.basename(video_path)}.wav")
2525

2626
cmd = [
27-
'ffmpeg', '-i', video_path,
27+
ffmpeg_path, '-i', video_path,
2828
'-vn',
2929
'-acodec', 'pcm_s16le',
3030
'-ar', '16000',
@@ -91,14 +91,15 @@ def main():
9191
sys.exit(1)
9292

9393
video_path = sys.argv[1]
94-
output_audio_path = sys.argv[2] if len(sys.argv) > 2 else None
94+
ffmpeg_path = sys.argv[2]
95+
output_audio_path = sys.argv[3] if len(sys.argv) > 3 else None
9596

9697
if not os.path.exists(video_path):
9798
print(f"Error: Video file '{video_path}' not found", file=sys.stderr)
9899
sys.exit(1)
99100

100101
print(f"Extracting audio from: {video_path}", file=sys.stderr)
101-
audio_path = extract_audio_from_video(video_path, output_audio_path)
102+
audio_path = extract_audio_from_video(video_path, ffmpeg_path, output_audio_path)
102103

103104
if audio_path is None:
104105
print("Failed to extract audio", file=sys.stderr)

electron-builder.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,25 @@ extraResources:
1717
to: 'requirements.txt'
1818
- from: 'setup.py'
1919
to: 'setup.py'
20+
# For macOS (current setup)
21+
- from: 'python-runtime'
22+
to: 'python-runtime'
23+
filter: '**/*'
24+
- from: 'ffmpeg-bin'
25+
to: 'ffmpeg-bin'
26+
filter: '**/*'
2027
asarUnpack:
2128
- resources/**
2229
win:
2330
executableName: meetingvideo-transrecorder
31+
extraResources:
32+
# Windows-specific binaries (if available)
33+
- from: 'python-runtime-windows'
34+
to: 'python-runtime'
35+
filter: '**/*'
36+
- from: 'ffmpeg-bin-windows'
37+
to: 'ffmpeg-bin'
38+
filter: '**/*'
2439
nsis:
2540
artifactName: ${name}-${version}-setup.${ext}
2641
shortcutName: ${productName}

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
1212
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
1313
"typecheck": "npm run typecheck:node && npm run typecheck:web",
14+
"setup": "./setup-binaries.sh",
15+
"setup:all": "./setup-binaries.sh all",
1416
"start": "electron-vite preview",
1517
"dev": "electron-vite dev",
1618
"build": "npm run typecheck && electron-vite build",

scripts/release.sh

100644100755
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,17 @@ VERSION=$1
1414

1515
echo "🚀 Creating release for version $VERSION"
1616

17-
# Check if we're on main/master branch
1817
BRANCH=$(git branch --show-current)
1918
if [ "$BRANCH" != "main" ] && [ "$BRANCH" != "master" ]; then
2019
echo "❌ Error: You must be on main or master branch to create a release"
2120
exit 1
2221
fi
2322

24-
# Check if working directory is clean
2523
if [ -n "$(git status --porcelain)" ]; then
2624
echo "❌ Error: Working directory is not clean. Please commit or stash changes."
2725
exit 1
2826
fi
2927

30-
# Create and push tag
3128
echo "📝 Creating tag v$VERSION..."
3229
git tag "v$VERSION"
3330
git push origin "v$VERSION"

0 commit comments

Comments
 (0)