I have a video which FFmpeg identifies as 720x480 [SAR 8:9 DAR 4:3]. When viewed in a player, the correctly displayed video occupies 720x540 pixels, which makes sense since 480/8*9=540.

However, when burning subtitles into the video, the subtitles are vertically stretched, by something that probably is a factor of 9/8. I assume what's happening is that the subtitles are applied to the vertically compressed 720x480 video data, and then the video player stretches the video to 720x540, which gives a correctly displayed video, but unfortunately stretched subtitles.

How do I burn subtitles into the video and maintain correct aspects for both video and subtitles? Is there any way I can "get rid of" the SAR in the conversion process, for example?

My basic command line, using FFmpeg 4.1:

ffmpeg -i in.mp4 -vf in.srt out.mp4

Typically, players stretch the video horizontally, but you may be using mpv or similar, which stretches vertically. Safest option is to make video square-pixeled.

ffmpeg -i in.mp4 -vf scale=iw*sar:ih,setsar=1,subtitles=in.srt -c:a copy out.mp4
| improve this answer | |
  • I'm using VLC, which by all accounts seems to stretch vertically, since the 720x480 video is displayed as 720x540 actual pixels on the screen. Anyway, your solution works perfectly inasmuch as the subtitles are not stretched anymore! Thanks a lot. However, the output video was shrunk to 640x480, so I tried scale=iw:ih/sar which gave an output video of 720x540. Wouldn't that be more correct? – forthrin Feb 15 '19 at 12:12
  • No, SAR is meant to be stretched horizontally. – Gyan Feb 15 '19 at 12:16
  • I'm not quite following. I'm starting out with a video that is displayed as 720x540 on-screen. With your suggestion I'm ending up with a video that's 640x480 on-screen. Thus I've lost resolution, which seems undesirable. – forthrin Feb 15 '19 at 12:24
  • You can scale the video however you want, but in case of SAR, video is supposed to be altered horizontally. VLC is doing it wrong. The original analog standards which created this mess, has 480 or 576 visible lines and a continuous signal meant to take up 4/3 of the vertical size. – Gyan Feb 15 '19 at 12:36
  • Interesting! I'm sure there's a long and complicated history behind all this that my sanity can do very well without. Anyway, you provided a quick and concise solution that solved the problem. Hope it will help someone else too! – forthrin Feb 15 '19 at 12:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.