mkv 파일, mp4 파일에서 추출 방법
1. mkvtoolnix 이용 (mkv)
2. ffmpeg 이용 (mkv, mp4)
MKV files
In order to extract subtitles from Matroska (MKV) files, you need the free and open source mkvtoolnix packages. They come for Windows and Linux, and on a Mac you can install them through Homebrew with brew install mkvtoolnix.
Then, inspect the file:
mkvmerge -i input.mkv
This will list the tracks, for example like this:
File 'input.mkv': container: Matroska
Track ID 1: video (V_MPEG4/ISO/AVC)
Track ID 2: audio (A_AAC)
Track ID 3: subtitles (S_TEXT/UTF8)
Based on the ID of the track, call the following command, where <trackID> is the one you identified above. <output> is just a dummy name, you can use any you want.
mkvextract tracks input.mkv <trackID>:<output>.srt
So, in our case, that would have been:
mkvextract tracks input.mkv 3:subs.srt
FFMPEG
FFmpeg can easily extract embedded subtitles from videos.
This command will grab the default subtitle track and export it as a srt file:
ffmpeg -i input_file out.srt
What if we want to get a different subtitle?
First we need to figure out the track number for that subtitle by running ffmpeg ‑i input_file.
You will get an output that something like this:
[...] Stream #0:2(eng): Subtitle: subrip (default) Metadata: title : English-SRT Stream #0:3(eng): Subtitle: hdmv_pgs_subtitle Metadata: title : English-PGS Stream #0:3(chi): Subtitle: hdmv_pgs_subtitle Metadata: title : Chinese-PGS [...]
Notice the tracks are numbered #0:2, #0:3, etc. This is the value we want to pass over to the map command to select the proper subtitle.
ffmpeg -i input_file -map 0:3 out.srt
'맥' 카테고리의 다른 글
[MAC] Numbers (넘버스) 맥용 엑셀 - 값만 붙여넣기 (0) | 2023.01.12 |
---|---|
맥에서 파일 생성일 수정일 날짜 바꾸기 (0) | 2022.04.22 |
Karabiner 카라비너에 하이퍼키 추가하기 (0) | 2022.03.01 |
맥에서 한영변환 지정키 설정하기 (0) | 2022.03.01 |
ASCII Code 아스키 코드표 (0) | 2021.09.28 |
댓글