Add a maxWidth parameter in the profiles configuration

Issue #876 resolved
Giovanni Musto created an issue

When configuring a profile you can specify a maxHeight parameter so that all videos with a larger height are transcoded to fit the TV. This works fine if the aspect ratio of the video is smaller or equal of the aspect ratio of the TV, but it's useless if the video has an aspect ratio bigger than the one of the TV (usually 16:9), like the largest part of the movies. For example if a video has an aspect ratio of 2,35:1, scaling it to a maxHeight of 1080 produces a video of 2538x1080, totally useless on a FullHD TV. Implementing a maxWidth parameter would solve this issue.

I wrote some pseudo-code to implement this simple change: If iw>maxWidth or ih>maxHeight then (If iw/ih>maxWidth/maxHeight then 'scale=maxWidth:-1' else 'scale=-1:maxHeight')

iw and ih are respectively the width and height of the input video. Setting one of the parameters of the scale filter to -1 keeps the aspect ratio.

Comments (4)

  1. Giovanni Musto reporter

    It's also possible to handle this problem directly in ffmpeg: if iw>maxWidth or ih>maxHeight then 'scale=w=maxWidth:h=maxHeight:force_original_aspect_ratio=decrease'

    Using force_original_aspect_ratio=decrease on videos smaller than maxWidth and maxHeight (for example 1280x720 on a 1920x1080 TV) will upscale the video (not well documented).

  2. Log in to comment