Menu

Auto Crop

Anonymous
2023-11-01
2023-11-14
  • Anonymous

    Anonymous - 2023-11-01

    I'm trying to resize video to 640x480, aspect Ratio 4:3 and KEEP the black bars. The first season of the video is in 4:3 and the second season is in 16:9 so I'm just resizing them both to 4:3 which SHOULD leave the black bars for season 2 but the software keeps changing the resolution & auto-cropping the file to a different size and leaving the aspect for season 2 at 16:9. What do I need to do to FORCE ffmpeg to convert the aspect to what I set it to?

     
  • Abel

    Abel - 2023-11-01

    I'm not sure if I understand your needs. If you resize 16:9 to 4:3 image is deformed:
    -vf scale=ih*4/3:ih,setsar=1

    If you want both vertical/horizontal black bars, this could be the parameter:
    -filter:v "pad=iw:iw*3/4:(ow-iw)/2:(oh-ih)/2"

     

    Last edit: Abel 2023-11-01
  • Abel

    Abel - 2023-11-01

    This could work:
    -filter:v "pad=iw:iw*3/4:(ow-iw)/2:(oh-ih)/2,setsar=1"

     
  • Anonymous

    Anonymous - 2023-11-13

    Can you tell me how to force not the display aspect ratio but the actual video resolution and aspect to either:

    1. 640x480 w/ 4:3 ratio
    2. 640x360 w/ 16:19 ratio

    Example: I have a video with 720x480 resolution and 3:2 aspect ratio I want to resize and change to 640x480, 4:3 which I know will display correctly but ffmpeg won't change the aspect and I'm having trouble understanding how to change aspects in ffmpeg.

    Thanks so much!

     
  • Anonymous

    Anonymous - 2023-11-13

    I'm trying to make ffmpeg force 1 of 2 sets of resolutions/aspects

    1. 640x480, 4:3
    2. 640x360, 16:9

    I tried the below for option 1 but got 640x480 with 16:9 aspect ratio? I'm totally confused.

    -map 0 -c:v hevc_amf -quality balanced -rc cqp -qp_p 28 -qp_i 28 -quality balanced -rc cqp -qp_p 28 -qp_i 28 -vf "scale=640:480,setsar=sar=4/3" -c:a aac -b:a 128K -filter:a loudnorm

     
  • Abel

    Abel - 2023-11-14

    Did you try setdar=dar=4/3

     
  • Anonymous

    Anonymous - 2023-11-14

    Ok, Just ried the following preset:

    -map 0 -c:v hevc_amf -quality balanced -rc cqp -qp_p 28 -qp_i 28 -quality balanced -rc cqp -qp_p 28 -qp_i 28 -vf "scale=640:480,setsar=sar=4/3" -c:a aac -b:a 128K -filter:a loudnorm -c:s copy

    ...and it gave me the attached in Media Info. Can you explain?

    The original video was 720x480 with 3:2 Aspect Ratio. Just as an fyi. Thanks!

     

    Last edit: Anonymous 2023-11-14
  • Abel

    Abel - 2023-11-14

    I hope this helps:

    Conceptually, there are three terms DAR (display aspect ratio), PAR (pixel aspect ratio), and SAR (storage aspect ratio), these terms are used interchangeably to refer to/denote video resolution creating confusion sometimes.

    DAR: The aspect ratio at which a video should be shown on a screen or monitor is called the Display Aspect Ratio, or DAR. It considers the scaling or display of the video samples (SAR) as well as their requirements. DAR determines how a video will appear on a monitor and is sometimes described as a ratio, such as 16:9 or 4:3.

    In the event that the SAR and DAR coincide, the video ought to appear blur-free. If they do not match, the video may be shown with black bars (also known as letterboxing or pillarboxing) in order to preserve the desired aspect ratio.
    
    When a video has a 4:3 SAR but a 16:9 DAR, for instance, it indicates that the video is meant to be seen in a 16:9 aspect ratio, but the individual video samples are in a 4:3 aspect ratio. To achieve the correct 16:9 aspect ratio, would cause the video to be presented with black bars on the sides.
    

    PAR: Pixel aspect ratio is a mathematical ratio that describes how the width of a pixel in a digital image compares to the height of that pixel. Most digital devices display an image as a grid of tiny, square pixels so for that kind of device PAR will be 1:1. But some devices display an image as a grid of rectangular pixels, in which the pixel width and height are different. The pixel aspect ratio describes this difference.

    SAR: Storage aspect ratio is the ratio of pixel dimensions when an image/video is displayed on a particular device. If an image/video is displayed with square pixels then PAR and SAR are the same but for rectangular pixels, the PAR and SAR differ.

    A video with a SAR of 16:9, for example, indicates that every pixel in the video is meant to be shown in a 16:9 aspect ratio. Depending on the device, this video could appear compressed or stretched if you watched it with square pixels.
    

    FFmpeg denotes PAR as SAR in their metadata information, so what you see as the value of SAR (sample_aspect_ratio) is the PAR (pixel aspect ratio) for the video.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.