Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Jay Patel on July 4, 2011 at 5:30 am

    Hi All,

    I want to convert 1920×1080(16:9) .mov video to 720×526 (4:3) .mov

    When I use this command
    ffmpeg -y -i test.mov -vcodec libx264 -vpre ultrafast -s 720x526 -aspect 4:3 -b 15000k -acodec libfaac -ab 128k -ac 2 -f mov test_1.mov

    it converts the file to 701×526 instead of specified 720×526 and also it stretch the video.

    So to keep the original aspect ration of 16:9, I decided to add a black bar on the top and here is the command I am using

    ffmpeg -y -i test.mov -vcodec libx264 -vpre ultrafast -s 720x404 -aspect 4:3 -vf "pad=720:526:0:61" -b 15000k -acodec libfaac -ab 128k -ac 2 -f mov test_1.mov

    But its not creating final file with 720×526 size, it does create output file with black bars but in the size of 539×526 and also video is still stretched

    Can anyone please tell me where am I going wrong ?

    Kind Regards,
    Jay Patel.

    Jay Patel replied 15 years, 1 month ago 2 Members · 2 Replies
  • 2 Replies
  • Michael Rampe

    July 4, 2011 at 10:35 pm

    [Jay Patel] “I want to convert 1920×1080(16:9) .mov video to 720×526 (4:3) .mov”

    Your first problem is that 720×526 IS NOT 4:3!!! (720/526=1.3688 and it should be 1.3333)
    Try 768×576 which IS true 4:3.

    Rounding errors become problematic very quickly in encoding.

    Your second problem is the size and aspect flags outside of the filter chain. These should now be performed inside the filter chain.

    I replicated your command line to get a working solution from a 1920p source.
    Example:

    ffmpeg -i tilt_shift_1.mp4 -vcodec libx264 -preset ultrafast -vf "scale=768:432,pad=768:576:0:72,setdar=4:3" -b 15000k test_2.mov

    Now all scale, pad and aspect is done inside the filter chain which avoids the conflicts you were experiencing.
    Basically:
    1. scale the 1920×1080 source to 768×432 dimensions (square pixel 16:9)
    2. Pad this to the output size of 768×576
    3. Set the aspect ratio to 4:3

    NOTE: When using libx264 in recent versions of FFmpeg, the -vpre option has been replaced by -preset. Modify the code or update your FFmpeg as required. Also, I left out your audio options for simplicity.

    Michael

  • Jay Patel

    July 4, 2011 at 11:14 pm

    Thanks a lot Michael,

    Its works very well and thanks a lot for explaining the concept and features.

    Kind Regards,
    Jay Patel.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy