Files
subwatcher/services/core/src/utils/ffprobe.ts
wisecolt f1a1f093e6 feat: altyazı otomasyon sistemi MVP'sini ekle
Docker tabanlı mikro servis mimarisi ile altyazı otomasyon sistemi altyapısı kuruldu.

- Core (Node.js): Chokidar dosya izleyici, BullMQ iş kuyrukları, ffprobe medya analizi, MongoDB entegrasyonu ve dosya yazma işlemleri.
- API (Fastify): Mock sağlayıcılar, arşiv güvenliği (zip-slip), altyazı doğrulama, puanlama ve aday seçim motoru.
- UI (React/Vite): İş yönetimi paneli, canlı SSE log akışı, manuel inceleme arayüzü ve sistem ayarları.
- Altyapı: Docker Compose (dev/prod), Redis, Mongo ve çevresel değişken yapılandırmaları.
2026-02-15 23:12:24 +03:00

47 lines
1.3 KiB
TypeScript

import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const execFileAsync = promisify(execFile);
export async function analyzeWithFfprobe(path: string): Promise<any> {
const { stdout } = await execFileAsync('ffprobe', [
'-v',
'error',
'-print_format',
'json',
'-show_streams',
'-show_format',
path
]);
const json = JSON.parse(stdout);
const video = (json.streams || []).find((s: any) => s.codec_type === 'video');
const audio = (json.streams || [])
.filter((s: any) => s.codec_type === 'audio')
.map((s: any) => ({ codec_name: s.codec_name, channels: s.channels, language: s.tags?.language }));
return {
video: video
? {
codec_name: video.codec_name,
width: video.width,
height: video.height,
r_frame_rate: video.r_frame_rate
}
: null,
audio,
format: {
duration: json.format?.duration,
bit_rate: json.format?.bit_rate,
format_name: json.format?.format_name
}
};
}
export function fallbackMediaInfo(): any {
return {
video: { codec_name: 'unknown', width: 1920, height: 1080, r_frame_rate: '24/1' },
audio: [{ codec_name: 'unknown', channels: 2, language: 'und' }],
format: { duration: '0', bit_rate: '0', format_name: 'matroska' }
};
}