user23128: I'd like to encode a video, say, in 960 x 720 but have video players automatically play it in 1280 x 720.
I know how to do this in 2 steps, by first encoding in 960 x 720 (ffmpeg with -vf scale=960:720) and then modifying the display ratio with MKVToolNix/mkvmerge, but it would be a lot more convenient if I could do it all directly with a single ffmpeg command. Is it possible?
I don't think that matters, but my current code looks like this:
ffmpeg -i "input.mkv" -vf scale=960:720 -ac 2 -codec:a libopus -b:a 96k -vbr on -compression_level 10 -frame_duration 60 -application audio -codec:v libx265 -preset slow -x265-params crf=21 "output.mkv"


user1871: There's the setsar and setdar filters for this purpose
-vf scale=960:720,setdar=16/9

Since you know the output display ratio, it's convenient to use setdar here, although both filters only alter the SAR.

23128: <p>I'd like to encode a video, say, in 960 x 720 but have video players automatically play it in 1280 x 720.</p>

<p>I know how to do this in 2 steps, by first encoding in 960 x 720 (ffmpeg with -vf scale=960:720) and then modifying the display ratio with MKVToolNix/mkvmerge, but it would be a lot more convenient if I could do it all directly with a single ffmpeg command. Is it possible?</p>

<p>I don't think that matters, but my current code looks like this:</p>

<pre><code>ffmpeg -i "input.mkv" -vf scale=960:720 -ac 2 -codec:a libopus -b:a 96k -vbr on -compression_level 10 -frame_duration 60 -application audio -codec:v libx265 -preset slow -x265-params crf=21 "output.mkv"
</code></pre>
 1871: <p>There's the setsar and setdar <a href="https://ffmpeg.org/ffmpeg-filters.html#setdar_002c-setsar" rel="nofollow noreferrer">filters</a> for this purpose</p>

<pre><code>-vf scale=960:720,setdar=16/9
</code></pre>

<p>Since you know the output display ratio, it's convenient to use setdar here, although both filters only alter the SAR.</p>
