VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    I accidentally recorded the file in VirtualDub in avi format instead of mov (ProRes).

    How to copy it to a mov file (it's easy using ffmpeg with -c copy), but at the same time change PAR to 12/11 (I can do this for mp4, but it doesn't work here). -aspect only changes DAR.
    Quote Quote  
  2. https://mediaarea.net/MOVMetaEdit

    PAR editor only works with CLI version
    Code:
    MOVMetaEdit --par 12:11 input.mov
    Quote Quote  
  3. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    It works, but probably not as it should. The image is now skinny

    Summary:
    OK = file is correctly detected and does not need to be modified ('Yes') or is correctly detected and need to be modified ('Mod') or is correctly detected and need to be modified but not supported ('No') or there was a problem with it (empty)
    PAR = PAR atom is not present ('No'), not present but can be (or is) inserted ('Can'), present and can be (or is) modified (value of the old PAR)
    PAR|M = PAR will be modified ('Y') or should be modified but it is not possible due to feature not implemented ('N')
    w-scale = (old) width scale of the picture
    w-scale|M = w-scale will be modified ('Y')
    | OK| PAR|M|Width|w-scale|M|
    out.mov|Yes| 9:10| | 720| 1.000| |
    Last edited by rgr; 20th Apr 2024 at 02:48.
    Quote Quote  
  4. If you keep storage aspect ratio (SAR) the same, and you change the DAR (display aspect ratio) you also change the PAR (pixel aspect ratio).
    Thus, if your source is displayed properly, and you change the PAR or DAR till will get distorted unless you re-encode and also change the storage aspect ratio (SAR).

    https://en.wikipedia.org/wiki/Pixel_aspect_ratio
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  5. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Link to the correct version of the program:
    https://mediaarea.net/download/snapshots/binary/movmetaedit/20240413/MOVMetaEdit_CLI_1...indows_x64.zip

    With this version, PAR change works properly.
    Quote Quote  
  6. Member hydra3333's Avatar
    Join Date
    Oct 2009
    Location
    Australia
    Search Comp PM
    Originally Posted by rgr View Post
    (I can do this for mp4, but it doesn't work here)
    Hi. Can you please tell how to set the DAR in ffmpeg when using ffmpeg with `-c:v copy` ... is it `-vf "setdar=16/9"` which works or does it fail ?


    edit:

    Oh.
    1. cannot use filtering like '-vf "setdar=16/9"' with 'c:v copy'
    2. bitstreamfiltering '-bsf:v h264_metadata=' does not have a Display Aspect Ratio (DAR) option, one has to calculate the Sample Aspect Ratio (SAR) and use that.

    ChatGPT just told me:


    edit 2: IGNORE THIS BIT, ChatGPT fibs.
    Yes, you can use variables in ffmpeg to calculate SAR dynamically. You can use the variables $width and $height to refer to the width and height of the input video respectively. Here's how you can do it for 4:3:
    This command dynamically calculates the SAR based on the dimensions of the input video, which allows you to adjust the DAR without re-encoding and without needing to know the exact resolution in advance.

    Code:
    ffmpeg -i input.mp4 -c:v copy -bsf:v h264_metadata=sample_aspect_ratio=$((4*$height)):$((3*$width)) output.mp4
    $((4*$height)) calculates the numerator of the SAR, which is 4 times the height of the video.
    $((3*$width)) calculates the denominator of the SAR, which is 3 times the width of the video.
    Code:
    -c:v copy
    ensures that the video stream is copied without re-encoding
    Code:
    -bsf:v h264_metadata=sample_aspect_ratio=$((4*$height)):$((3*$width))
    applies the h264_metadata bitstream filter to set the sample aspect ratio using the dynamically calculated values for 4:3 DAR and the video's width & height

    For a 4:3 DAR, you can use the formula to calculate SAR. Assuming the height and width of your video are standard (480p or 720p), you can calculate the SAR accordingly. For example:
    For 720p (1280x720): SAR = 4:3 * (720/1280) = 4:3 * 0.5625 ≈ 4:3 * 9:16 = 9:12
    For 480p (640x480): SAR = 4:3 * (480/640) = 4:3 * 0.75 = 3:4

    So, for a 720p video, you would use SAR 9:12:
    Code:
    ffmpeg -i input.mp4 -c:v copy -bsf:v h264_metadata=sample_aspect_ratio=9:12 output.mp4
    And for a 480p video, you would use SAR 3:4:
    Code:
    ffmpeg -i input.mp4 -c:v copy -bsf:v h264_metadata=sample_aspect_ratio=3:4 output.mp4
    For PAL 576p resolution, which typically has dimensions of 720x576, use SAR 32:27.
    Here's the ffmpeg command to set the SAR dynamically for a PAL 576p video:
    Code:
    ffmpeg -i input.mp4 -c:v copy -bsf:v h264_metadata=sample_aspect_ratio=32:27 output.mp4
    Adjust the SAR value accordingly based on your video's resolution to achieve the desired 4:3 DAR.
    Last edited by hydra3333; 21st Apr 2024 at 07:09.
    Quote Quote  
  7. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    ffmpeg -i in.mp4 -c copy -bsf:v "h264_metadata=sample_aspect_ratio=x/y" out.mp4
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!