[inactive] [Caption with Intention #3] AI 자동화 구현 방안
발
발산동휘발류
Lv.1
02-28 09:41
·
조회 10
·
추천 0
[Caption with Intention #3] AI 자동화 구현 방안
수동 40시간 → AI 자동 5분
Caption with Intention의 가장 큰 약점: 수동 작업
90분 영화 자막 제작에 40~60시간 소요.
해결책: AI 완전 자동화
🚀 제안 기술 스택
OpenAI Whisper (음성 인식)
↓
GPT-4 (감정 분석)
↓
Variable Font + 색상 매핑
↓
FFmpeg (자막 렌더링)
↓
영상 합성
1️⃣ 음성 인식 - OpenAI Whisper
기능
- 음성 → 텍스트 변환
- 타임스탬프 생성 (단어 단위)
- 화자 식별 (Speaker Diarization)
출력 예시
{
"segments": [
{
"start": 1.23,
"end": 2.45,
"text": "Hello world",
"speaker": "A",
"words": [
{"start": 1.23, "end": 1.50, "word": "Hello"},
{"start": 1.52, "end": 2.45, "word": "world"}
]
}
]
}
장점
- ✅ 다국어 지원 (100개 언어)
- ✅ 정확도 높음
- ✅ 오픈소스 (MIT 라이선스)
대안
- Google Speech-to-Text
- AWS Transcribe
2️⃣ 감정 분석 - GPT-4
입력
텍스트: "Hello world"
오디오 특징:
- 볼륨: 85 dB (큼)
- 피치: 높음
- 속도: 빠름
Prompt 예시
분석해줘:
1. 감정 (angry/sad/happy/whisper/neutral)
2. 강도 (1~10)
3. 목소리 특징 (loud/soft/fast/slow)
텍스트: "Get out!"
볼륨: 90 dB
피치: 높음
출력
{
"emotion": "angry",
"intensity": 9,
"volume": "loud",
"suggestion": {
"weight": 900,
"size": 130,
"color": "#F44336"
}
}
한계 & 보완
- ❌ GPT는 텍스트만 분석 (실제 음성 못 들음)
- ✅ 보완: Whisper 오디오 특징 분석 + GPT 결합
# 오디오 특징 추출
volume = analyze_volume(audio_segment)
pitch = analyze_pitch(audio_segment)
speed = analyze_speech_rate(audio_segment)
# GPT에 컨텍스트 제공
prompt = f"텍스트: {text}\n볼륨: {volume} dB\n피치: {pitch}\n속도: {speed}"
3️⃣ 스타일 매핑 - JSON 룰셋
감정 → 스타일 매핑
{
"emotions": {
"angry": {
"weight": 900,
"size_multiplier": 1.3,
"color": "#F44336",
"animation": "shake"
},
"whisper": {
"weight": 300,
"size_multiplier": 0.6,
"color": "#9E9E9E",
"animation": "fade"
},
"sad": {
"weight": 400,
"size_multiplier": 1.0,
"color": "#2196F3",
"italic": true
},
"happy": {
"weight": 600,
"size_multiplier": 1.1,
"color": "#FFC107",
"animation": "bounce"
},
"neutral": {
"weight": 500,
"size_multiplier": 1.0,
"color": "#FFFFFF"
}
}
}
커스터마이징 가능
- 감독/제작자가 영화별로 조정
- 캐릭터별 색상 팔레트
- 장르별 프리셋 (액션/드라마/코미디)
4️⃣ 자막 렌더링 - FFmpeg + Python
Variable Font 렌더링
Python fontTools 사용:
from fontTools.varLib import instancer
# Variable Font 로드
font = TTFont("Roboto-VF.ttf")
# Weight 조정 (angry = 900)
instance = instancer.instantiateVariableFont(
font,
{"wght": 900}
)
# 텍스트 렌더링
render_text("Get out!", instance, color="#F44336")
FFmpeg 합성
# 자막 파일 생성 (ASS 포맷, 스타일 포함)
ffmpeg -i video.mp4 \
-vf "ass=emotional_captions.ass" \
output.mp4
ASS 포맷 예시
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, Bold, Italic
Style: Angry,Roboto,48,&HFF4433FF,1,0
Style: Whisper,Roboto,24,&H9E9E9EFF,0,0
[Events]
Format: Start, End, Style, Text
Dialogue: 0:01:23.45,0:01:25.00,Angry,Get out!
Dialogue: 0:01:26.00,0:01:28.00,Whisper,Okay...
5️⃣ 전체 파이프라인
# 1. 음성 인식
audio = extract_audio("movie.mp4")
transcript = whisper.transcribe(audio, word_timestamps=True)
# 2. 감정 분석
for segment in transcript['segments']:
audio_features = analyze_audio(
audio,
segment['start'],
segment['end']
)
emotion = gpt4_analyze(
text=segment['text'],
volume=audio_features['volume'],
pitch=audio_features['pitch']
)
segment['emotion'] = emotion
# 3. 스타일 매핑
style_map = load_json("emotion_styles.json")
for segment in transcript['segments']:
segment['style'] = style_map[segment['emotion']]
# 4. 자막 렌더링
ass_file = generate_ass(transcript)
render_video("movie.mp4", ass_file, "output.mp4")
처리 시간:
- 90분 영화: 약 5~10분 (GPU 사용 시)
🆚 비교: 수동 vs AI 자동화
| 항목 | 수동 (현재) | AI 자동화 |
|---|---|---|
| 시간 | 40~60시간 | 5~10분 |
| 비용 | $2,000~5,000 | $10~50 |
| 정확도 | 95% (전문가) | 85~90% (초기) |
| 확장성 | ❌ 불가능 | ✅ 무제한 |
| 실시간 | ❌ 불가능 | ✅ 가능 |
🎯 차별화 포인트
Caption with Intention:
- ❌ 수동 작업 (영화 전용)
- ❌ Burnt-in만
AI 자동화 시스템:
- ✅ 완전 자동화
- ✅ 라이브 스트리밍 지원 (Twitch, YouTube Live)
- ✅ WebVTT/SRT 출력 (전환 가능)
- ✅ 게임/교육/유튜브 확장
🔬 PoC (Proof of Concept) 계획
1주차: 기본 파이프라인
영상 → Whisper → SRT 생성
2주차: 감정 분석
SRT + audio → GPT-4 → 감정 라벨
3주차: 스타일 적용
감정 → Variable Font + 색상
4주차: 렌더링
FFmpeg → 데모 영상 완성
비용: ~$1K (OpenAI API)
다음 글: #4 오픈소스 사업화 전략
참고:
- OpenAI Whisper: https://github.com/openai/whisper
- Python fontTools: https://github.com/fonttools/fonttools
- FFmpeg: https://ffmpeg.org/
💬 0
로그인 후 댓글 작성
첫 댓글을 남겨보세요!