Opened 3 months ago
#11135 new defect
Text outline becomes stretched depending on video aspect ratio when converting SRT to ASS subtitles
Reported by: | omgold | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | unspecified | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
When burning SRT subtitles with the subtitles filter into a video, the outline/border (not the text itself) becomes stretched according to the aspect ratio of the video.
I tracked the problem down to a rather odd behavior of ass, where the outline width in x/y directions are scaled with PlayResX/PlayResY parameters.
If these are set to values match the video aspect ratio, it works fine. But apparently ffmpeg does not do that when converting SRT to ASS (which it does before burning the subtitle into the images with the subtitles filter).
The problem appears both when using the filter and also when keeping the subtitle as a separate track (converted to ASS), but not with a separate track keeping it in SRT format. (With an embedded separate ASS track the stretching is visible with a player that uses libass, like mpv, but not with vlc).
It can be worked around by converting the SRT to an ASS file with ffmpeg, then edit the PlayResX/PlayResY by hand and using the fixed ASS for desired operation with ffmpeg.
Note, though, that the issue propagates into higher-level video editing software like kdenlive, which use SRT internally and do not give the user to ability to apply such a workaround.
How to reproduce:
% ffmpeg -report -i untitled.mp4 -i test.srt -vcodec copy -scodec copy test-srt.mkv % ffmpeg -report -i untitled.mp4 -i test.srt -vcodec copy -scodec ass test-ass.mkv % ffmpeg -i untitled.mp4 -filter subtitles=filename=test.srt test-embedded.mkv ffmpeg version 7.0.1 built on Arch Linux