superbrain-server 1.0.36 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "superbrain-server",
3
- "version": "1.0.36",
3
+ "version": "1.0.37",
4
4
  "description": "1-Line Auto-Installer and Server Execution wrapper for SuperBrain",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -85,20 +85,22 @@ def _unique_folder(base: pathlib.Path, name: str) -> pathlib.Path:
85
85
 
86
86
 
87
87
  def extract_audio_from_video(video_path: str, audio_path: str) -> bool:
88
- """Extract audio track from a video file and save as MP3."""
89
- if not MOVIEPY_AVAILABLE:
90
- print(" ⚠ moviepy not installed — skipping audio extraction")
91
- return False
88
+ """Extract audio track from a video file using ffmpeg to save memory and time."""
89
+ import subprocess
92
90
  try:
93
- print(" Extracting audio...")
94
- video = VideoFileClip(video_path)
95
- if video.audio is not None:
96
- video.audio.write_audiofile(audio_path, verbose=False, logger=None)
97
- video.close()
91
+ print(" Extracting audio via ffmpeg...")
92
+ # Extract audio track to MP3, skip video, use low bitrate since we only need Shazam/Whisper
93
+ proc = subprocess.run([
94
+ "ffmpeg", "-y", "-i", video_path,
95
+ "-vn", "-acodec", "libmp3lame", "-q:a", "3",
96
+ audio_path
97
+ ], stdout=subprocess.DEVNULL, stderr=subprocess.PIPE, text=True)
98
+
99
+ if proc.returncode == 0 and os.path.exists(audio_path) and os.path.getsize(audio_path) > 1024:
98
100
  print(f" ✓ Audio saved: {os.path.basename(audio_path)}")
99
101
  return True
100
- video.close()
101
- print(" No audio track in video")
102
+
103
+ print(f" ⚠️ No audio track found or ffmpeg failed (code: {proc.returncode})")
102
104
  return False
103
105
  except Exception as e:
104
106
  print(f" ⚠ Audio extraction failed: {e}")