Burned-in subtitles stretched by SAR (FFmpeg)
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
ffmpeg video-conversion
add a comment |
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
ffmpeg video-conversion
add a comment |
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
ffmpeg video-conversion
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
ffmpeg video-conversion
ffmpeg video-conversion
asked Feb 15 at 11:00
forthrinforthrin
55731026
55731026
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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
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 triedscale=iw:ih/sar
which gave an output video of 720x540. Wouldn't that be more correct?
– forthrin
Feb 15 at 12:12
No, SAR is meant to be stretched horizontally.
– Gyan
Feb 15 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 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 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 at 12:40
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1406042%2fburned-in-subtitles-stretched-by-sar-ffmpeg%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
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 triedscale=iw:ih/sar
which gave an output video of 720x540. Wouldn't that be more correct?
– forthrin
Feb 15 at 12:12
No, SAR is meant to be stretched horizontally.
– Gyan
Feb 15 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 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 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 at 12:40
add a comment |
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
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 triedscale=iw:ih/sar
which gave an output video of 720x540. Wouldn't that be more correct?
– forthrin
Feb 15 at 12:12
No, SAR is meant to be stretched horizontally.
– Gyan
Feb 15 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 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 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 at 12:40
add a comment |
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
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
answered Feb 15 at 11:31
GyanGyan
15.6k21846
15.6k21846
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 triedscale=iw:ih/sar
which gave an output video of 720x540. Wouldn't that be more correct?
– forthrin
Feb 15 at 12:12
No, SAR is meant to be stretched horizontally.
– Gyan
Feb 15 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 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 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 at 12:40
add a comment |
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 triedscale=iw:ih/sar
which gave an output video of 720x540. Wouldn't that be more correct?
– forthrin
Feb 15 at 12:12
No, SAR is meant to be stretched horizontally.
– Gyan
Feb 15 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 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 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 at 12:40
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 at 12:12
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 at 12:12
No, SAR is meant to be stretched horizontally.
– Gyan
Feb 15 at 12:16
No, SAR is meant to be stretched horizontally.
– Gyan
Feb 15 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 at 12:24
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 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 at 12:36
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 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 at 12:40
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 at 12:40
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1406042%2fburned-in-subtitles-stretched-by-sar-ffmpeg%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown