
이전(현재는 더 이상 사용되지 않음) QuickTime 7 Pro의 "텍스트 트랙" 기능을 사용하여 생성된 형식화된 자막 트랙이 있는 .mov
파일이 있습니다 . mov_text
이것이 ffmpeg -i myfile.mov
그들에 대해 말해 주는 것입니다:
Stream #0:4(eng): Subtitle: mov_text (text / 0x74786574), 640x116, 0 kb/s (default)
Metadata:
rotate : 0
creation_time : 2021-11-20T03:08:45.000000Z
handler_name : Apple Text Media Handler
현재 저는 여전히 QuickTime 7 Pro에 액세스하여 자막을 추출한 다음 SubRip이나 다른 프로그램에서 읽을 수 있는 다른 형식으로 변환할 수 있습니다. 하지만 시스템을 업데이트해야 하는데 QuickTime 7 Pro가 macOS Catalina 이상에서 실행되지 않기 때문에 최신 시스템에서 해당 자막에 계속 액세스할 수 있는 방법을 찾고 있습니다. ffmpeg
가야 할 길인 것 같지만 여전히 갇혀 있습니다.
내가 시도한 것은 다음과 같습니다.
ffmpeg -i test.mov -map 0:s:0 -c copy -f data QT-subtitles.txt
자막의 일반 텍스트를 제공하지만 타임스탬프가 없으므로 자막을 다른 형식으로 변환하는 데는 꽤 쓸모가 없습니다.
ffmpeg -i test.mov -map 0:s:0 QT-subtitles.srt
타임스탬프를 포함하여 자막을 SubRip으로 올바르게 변환합니다. 그러나 줄 바꿈 및 기타 서식이 제거됩니다.
또한 잘못된 데이터가 발견되면 다음과 같은 오류 메시지가 표시됩니다.
Stream mapping:
Stream #0:4 -> #0:0 (mov_text (native) -> subrip (srt))
Press [q] to stop, [?] for help
[mov_text @ 0x7fa492823200] invalid UTF-8 byte in subtitle
[mov_text @ 0x7fa492823200] Invalid UTF-8 in decoded subtitles text; maybe missing -sub_charenc option
Error while decoding stream #0:4: Invalid data found when processing input
[mov_text @ 0x7fa492823200] invalid UTF-8 byte in subtitle
[mov_text @ 0x7fa492823200] Invalid UTF-8 in decoded subtitles text; maybe missing -sub_charenc option
Error while decoding stream #0:4: Invalid data found when processing input
size= 6kB time=00:02:04.30 bitrate= 0.4kbits/s speed=3.32e+04x
video:0kB audio:0kB subtitle:3kB other streams:0kB global headers:0kB muxing overhead: 82.697044%
-c text
지정 하거나 -sub_charenc
모두 나에게 동일한 결과를 제공하는 아래 의견의 제안 .
따라서 저는 여전히 QTText 형식(아래 참조)이거나 줄 바꿈 및 기타 형식을 유지하는 다른 방법으로 간단한 텍스트 파일로 자막을 추출하는 방법을 찾고 싶습니다. 이것은 QuickTime 7 Pro를 통해 추출하고 내보낼 때 원본 QuickTime 텍스트 트랙이 텍스트 파일로 보이는 방식입니다(사양 참조).여기).
{QTtext}{font:Verdana}{plain}{size:36}{textColor: 65535, 65535, 65535}{backColor: 0, 0, 0}{justify:default}{timeScale:30}{width:640}{height:116}{timeStamps:absolute}{language:0}{textEncoding:0}
[00:00:00.00]
Text here {bold} bold word {plain} text here
[00:00:01.12]
Text here text here text here
Next line here (respects spaces)
[00:00:02.14]
그런 다음 등과 같은 서식 지정 태그를 {bold}
html 태그로 변환하는 스크립트를 간단히 작성할 수 있습니다. 이는 SubRip이 이해한다고 믿습니다.
또는 ffmpeg
같은 파일 확장자에서 필요한 것을 추측하는 것 외에 출력 형식을 지정하는 방법이 있습니까 ? (특히 출력으로 지정할 수 있다면 위와 같은 QTText 형식의 파일이 제공될 수도 있다고 생각합니다. 하지만 어떻게 그렇게 할 수 있을까요?)srt
txt
mov_text
작업을 수행할 수 없다면 ffmpeg
다른 도구를 사용해 보도록 하겠습니다.
답변1
mov_text 자막을 다른 것(예: Subrip SRT 파일)으로 트랜스코딩하고 싶다면 다음을 시도해 보세요.
ffmpeg -i test.mov -map 0:s:0 -c:s srt subtitles.srt