I have a video with the following ffprobe output:
Input #0, matroska,webm, from 'video.mkv':
Metadata:
title : Video - 01
creation_time : 2021-07-14T02:49:59.000000Z
ENCODER : Lavf58.29.100
Duration: 00:22:57.28, start: 0.000000, bitrate: 392 kb/s
Chapters:
Chapter #0:0: start 0.000000, end 86.169000
Metadata:
title : Opening
Chapter #0:1: start 86.169000, end 641.266000
Metadata:
title : Part A
Chapter #0:2: start 641.266000, end 651.359000
Metadata:
title : Eyecatch
Chapter #0:3: start 651.359000, end 1286.160000
Metadata:
title : Part B
Chapter #0:4: start 1286.160000, end 1356.355000
Metadata:
title : Ending
Chapter #0:5: start 1356.355000, end 1376.876000
Metadata:
title : Preview
Stream #0:0: Video: hevc (Main 10), yuv420p10le(tv, bt709), 854x480 [SAR 1280:1281 DAR 16:9], 23.98 fps, 23.98 tbr, 1k tbn (default)
Metadata:
DURATION : 00:22:56.959000000
Stream #0:1(eng): Audio: vorbis, 48000 Hz, stereo, fltp (default)
Metadata:
title : English [FLAC 2.0]
DURATION : 00:22:57.278000000
Stream #0:2(jpn): Audio: vorbis, 48000 Hz, stereo, fltp
Metadata:
title : Japanese [FLAC 2.0]
DURATION : 00:22:57.276000000
Stream #0:3(eng): Subtitle: ass (ssa)
Metadata:
title : Signs and Songs [FMA1394/Redc4t]
DURATION : 00:22:51.090000000
Stream #0:4(eng): Subtitle: ass (ssa)
Metadata:
title : English [FMA1394/Redc4t]
DURATION : 00:22:51.090000000
Stream #0:5(eng): Subtitle: hdmv_pgs_subtitle (pgssub), 1920x1080
Metadata:
title : Full English Retail
DURATION : 00:22:51.120000000
Stream #0:6: Attachment: ttf
Metadata:
filename : 8bitoperator.ttf
mimetype : application/x-truetype-font
Stream #0:7: Attachment: ttf
Metadata:
filename : Cabin-Bold.ttf
mimetype : application/x-truetype-font
Stream #0:8: Attachment: ttf
Metadata:
filename : calibrib.ttf
mimetype : application/x-truetype-font
Stream #0:9: Attachment: ttf
Metadata:
filename : daniel_0.ttf
mimetype : application/x-truetype-font
Stream #0:10: Attachment: ttf
Metadata:
filename : DEATH_FONT.TTF
mimetype : application/x-truetype-font
Stream #0:11: Attachment: ttf
Metadata:
filename : Dominican.ttf
mimetype : application/x-truetype-font
Stream #0:12: Attachment: ttf
Metadata:
filename : gishabd.ttf
mimetype : application/x-truetype-font
Stream #0:13: Attachment: ttf
Metadata:
filename : PATRICK_0.TTF
mimetype : application/x-truetype-font
Stream #0:14: Attachment: ttf
Metadata:
filename : Qlassik-Medium.ttf
mimetype : application/x-truetype-font
Unsupported codec with id 98304 for input stream 6
Unsupported codec with id 98304 for input stream 7
Unsupported codec with id 98304 for input stream 8
Unsupported codec with id 98304 for input stream 9
Unsupported codec with id 98304 for input stream 10
Unsupported codec with id 98304 for input stream 11
Unsupported codec with id 98304 for input stream 12
Unsupported codec with id 98304 for input stream 13
Unsupported codec with id 98304 for input stream 14
I am trying to extract the subtitles, edit them and reattach them to the video.
(I need my program to do that so I don’t want to use other software)
Command 1
ffmpeg -i video.mkv -map 0:3 -c:s ssa subs.ass
ffmpeg -i video.mkv -i subs.ass -map 0 -map -0:s -map 1 -c copy out.mkv
Command 2
ffmpeg -i video.mkv -map 0:3 subs.ass
ffmpeg -i video.mkv -i subs.ass -map 0 -map -0:s -map 1 -c copy out.mkv
Command 3
ffmpeg -i video.mkv -map 0:3 subs.srt
ffmpeg -i video.mkv -i subs.srt -map 0 -map -0:s -map 1 -c copy out.mkv
Command 4
ffmpeg -i video.mkv -map 0:3 subs.srt
ffmpeg -i subs.srt subs.ass
ffmpeg -i video.mkv -i subs.ass -map 0 -map -0:s -map 1 -c copy out.mkv
Command 5
ffmpeg -i video.mkv -map 0:3 subs.ass
ffmpeg -i subs.ass subs.srt
ffmpeg -i video.mkv -i subs.srt -map 0 -map -0:s -map 1 -c copy out.mkv
The problem
After extraction the subtitles seem to be really quick, meaning they are displayed and disappear really quickly.
For example the first subtitle is as follows in srt:
1
00:00:03,100 --> 00:00:03,560
<font face="Dominican" size="77" color="#f7f7f7">Within the spreading darkness</font>
Now, in srt it also has wrong size but I assume that’s because of the conversion from ass to srt.
If I reattach the subtitle file in the video and open it, it is displayed and disappears way too fast and it doesn’t match the original subtitles in the video.
(ie, the original video subtitles are showing for at least a second)
Expected behaviour
The subtitles should be displayed for the same duration as the original subtitles.
NOTE
It’s my first question for ffmpeg related issues so feel free to ask me for anything else you may need.