FORUMS: list search recent posts

Padding

COW Forums : FFmpeg

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Jay Patel
Padding
on Jul 4, 2011 at 5:30:10 am

Hi All,

I want to convert 1920x1080(16:9) .mov video to 720x526 (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 701x526 instead of specified 720x526 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 720x526 size, it does create output file with black bars but in the size of 539x526 and also video is still stretched

Can anyone please tell me where am I going wrong ?


Kind Regards,
Jay Patel.


Return to posts index

Michael Rampe
Re: Padding
on Jul 4, 2011 at 10:35:14 pm

[Jay Patel] "I want to convert 1920x1080(16:9) .mov video to 720x526 (4:3) .mov"

Your first problem is that 720x526 IS NOT 4:3!!! (720/526=1.3688 and it should be 1.3333)
Try 768x576 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 1920x1080 source to 768x432 dimensions (square pixel 16:9)
2. Pad this to the output size of 768x576
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


Return to posts index

Jay Patel
Re: Padding
on Jul 4, 2011 at 11:14:10 pm

Thanks a lot Michael,

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


Kind Regards,
Jay Patel.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]