Search code examples
ffmpegvideo-processingvideo-encodingaspect-ratio

How to change DAR of a video to 11:9 by using FFMPEG?


I want to scale video to 176x144 with DAR 11:9 but I can't. It always sets DAR 4:3 and SAR 12:11. I use this command:

ffmpeg -i input.mp4 -y -r 12 -filter:v "scale=iw*min(176/iw\,144/ih):ih*min(176/iw\,144/ih),pad=176:144:(176-iw*min(176/iw\,144/ih))/2:(144-ih*min(176/iw\,144/ih))/2,setdar=11:9" -vcodec h263 -b:v 55k -crf 30 -minrate:v 0k -maxrate:v 63k -bufsize:v 128k -acodec libfaac -ac 1 -ab 32k -ar 22050 output.3gp

Please, help me understand what is going on.


Solution

  • H.263 uses a pixel aspect ratio defined in the recommendations for H.261 which is 12:11, targeted at the older 4:3 screens.

    Even if you set the values of SAR and DAR using filters they can be overriden later.

    Using the formula:

    DAR = HORIZONTAL_RESOLUTION / VERTICAL_RESOLUTION * SAR

    results in:

    DAR = 176/144 * 12/11 = 1,333333333 = 4/3

    If I remember correctly custom pixel formats were introduced in H.263+.