-
Notifications
You must be signed in to change notification settings - Fork 1
/
FFMPEG_NOTES_SUBTITLE_ISSUES.txt
57 lines (39 loc) · 1.53 KB
/
FFMPEG_NOTES_SUBTITLE_ISSUES.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
NEED REGEX To fix issue on TIME FORMAT for SRT
----------------------------------------------
ffmpeg -i karaokeBASE.jpg -i 'What will your verse be.mp3' -vf ass=donesub.ass 'What will your verse be.mp4'
ffmpeg -i karaokeBASE.jpg -i 'What will your verse be.mp3' -vf ass=donesub.ass -c:a copy -c:s mov_text 'What will your verse be.mp4'
ffmpeg -i donesub.srt donesub.ass
ffmpeg -i 'What will your verse be.mp4' -vf subtitles=donesub.srt output_srt.mp4
RESOURCES
https://trac.ffmpeg.org/wiki/HowToBurnSubtitlesIntoVideo
https://stackoverflow.com/questions/7240247/add-srt-subtitle-to-video-with-ffmpeg
https://www.baeldung.com/linux/subtitles-ffmpeg
https://ffmpeg.org/ffmpeg.html#Subtitle-options
SRT FORMAT SHUOLD BE
https://stackoverflow.com/questions/71585253/matching-srt-file-subtitle-line-and-timestamps-with-regex
```
1
00:00:04,700 --> 00:00:05,090
You know what
2
00:00:05,100 --> 00:00:05,990
we should all do.
```
TRANSCRBE FROM VIDEO
```
# Video https://youtube.com/shorts/MNUdPGIjMPw
# Python 3.10
# pip install openai-whisper
# pip install git+https://github.com/openai/whisper.git
# install ffmpeg
# brew install ffmpeg
import subprocess
import whisper
model = whisper.load_model("base")
video_in = 'video.mp4'
audio_out = 'audio.mp3'
ffmpeg_cmd = f"ffmpeg -i {video_in} -vn -c:a libmp3lame -b:a 192k {audio_out}"
subprocess.run(["ffmpeg", "-i", video_in, "-vn", "-c:a", "libmp3lame", "-b:a", "192k", audio_out])
result = model.transcribe(audio_out)
print(result["text"])
```