VideoHelp Forum




+ Reply to Thread
Results 1 to 8 of 8
  1. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Looking for recommendations on a high quality ffmpeg scripts for encoding both 50p and 60p large HuffYUV (392 Mb/s) 4:2:2 8bit YUV AVI files that are already resized to 1440x1080 and converted to rec.709 during output, Audio is 48Khz 16bit, Encoding only, Looking for good 4:2:0 video quality and decent compressed audio.
    Quote Quote  
  2. "High/good quality" and "decent" can mean a lot ....
    You may start with something basic like this, for example. It outputs the video as 4:2:0 in mp4 container and keeps it anamorphic, but flags the SAR and DAR for a 16:9 playback (if this is what you eventually need?). Audio is encoded as aac with bitrate 224k (may be increased if required).
    Code:
    ffmpeg.exe -i "your.avi" -sn -c:a aac -b:a 224k -c:v libx264 -preset slow -crf 16 -pix_fmt yuv420p -movflags +faststart -vf scale=interl=0:in_color_matrix=bt709:out_color_matrix=bt709,setsar=4/3,setdar=16/9,format=yuv420p "out_.mp4"
    Last edited by Sharc; 9th Aug 2026 at 09:56.
    Quote Quote  
  3. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    Does the bt.709 has to be set despite the footage being already bt.709?
    I would like to set the 4:3 aspect ratio for any display not just 16:9 (in case it adds hard coded black pillars).
    Quote Quote  
  4. Originally Posted by dellsam34 View Post
    Does the bt.709 has to be set despite the footage being already bt.709?
    Not really. It's double-stitched and sets the flag. For a source of 1080 height the player should default to 709.
    I would like to set the 4:3 aspect ratio for any display not just 16:9 (in case it adds hard coded black pillars).
    Is the aspect ratio and intended view of the video 4:3 or 16:9? If it is 4:3 you will get black side pillars on a 16:9 TV, or you would have to crop top and bottom of the picture. If it is 16:9 on a 4:3 screen you get top and bottom bars on the 4:3 screen unless you crop the sides of the picture.

    In the commandline just drop the setsar and change the setdar=x/y as you need it, or if you know the Pixel Aspect Ratio of the video source (square pixels or anamorphic?) you can use the setsar=... accordingly and drop the setdar=..., in the hope that your player respects the SAR setting - for mp4 files players usually do.

    Do you have a sample of the video, if possible select a scene with an object of circular shape, like a wheel, clock or similar, filmed straight perpendicular to preserve the circular shape.
    Last edited by Sharc; 9th Aug 2026 at 14:28.
    Quote Quote  
  5. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    I set the dar to 4/3 and dropped the SAR, Will that be a problem? So far on computer (VLC, MPC-HC) looks correct, haven't tried a TV set or a smart device.

    Here is a frame grab side by side, The encoding lost a little bit of details but "I take that" as a mild DNR, I think it's as good as it can be for a lossy encoding:

    https://imgdiff.net/s/eb59a1a7df01f582ff45e02a6562be56

    imgsli is down for now, So I used another online tool.

    Edit:
    On a second thought I just set the SAR to 1 since these are analog SD tape captures, Not sure if adding set dar to 4/3 would help?
    Last edited by dellsam34; 9th Aug 2026 at 14:42.
    Quote Quote  
  6. Originally Posted by dellsam34 View Post
    I set the dar to 4/3 and dropped the SAR, Will that be a problem?
    Shouldn't be a problem.

    Here is a frame grab side by side, The encoding lost a little bit of details but "I take that" as a mild DNR, I think it's as good as it can be for a lossy encoding
    You could set -crf to a lower value at the expense of a larger file size. -crf 0 would be lossless.

    Edit:
    On a second thought I just set the SAR to 1 since these are analog SD tape captures, Not sure if adding set dar to 4/3 would help?
    The SAR of a 4:3 NTSC SD 720x480i (or 720x486i) analog capture is in very good approximation 10/11. It seems that you deinterlaced it and converted it to square pixels 1440x1080p (post#1). Hence the SAR of your 1440x1080p became 1/1 (means square pixels). In that case you don't even have to use -setsar or -setdar, but to be on the safe side I would just use -setdar=4/3, or setsar=1/1 (default anyway).
    If you had skipped the upscaling and base the encode on the 720x480 capture you would have to use -setsar=10/11 to instruct the player to play it undistorted.

    Edit: Maybe your video would benefit from some chroma sharpening and chroma/luma alignment. Would have to be tried out with the Avisynth script.
    Last edited by Sharc; 9th Aug 2026 at 15:42.
    Quote Quote  
  7. Capturing Memories dellsam34's Avatar
    Join Date
    Jan 2016
    Location
    Member Since 2005, Re-joined in 2016
    Search PM
    I'm not a big fan of post processing unless it's necessary but these are not my tapes anyway, If they ask for it I will be glad to do it.

    Edit: The above is a PAL Video8 tape by the way.
    Quote Quote  
  8. Originally Posted by dellsam34 View Post
    I'm not a big fan of post processing unless it's necessary but these are not my tapes anyway, If they ask for it I will be glad to do it.

    Edit: The above is a PAL Video8 tape by the way.
    Ok I understand.
    A standard 4:3 PAL analog capture of 720x576 has a SAR of 12/11. But as you already deinterlaced it and converted it to square pixels 1440x1080p BT.709 the ffmpeg commandline can be simplified like

    Code:
    ffmpeg -i "your .avi" -c:a aac -b:a 128k -c:v libx264 -preset slow -crf 16 -pix_fmt yuv420p -movflags +faststart -aspect 4:3 "out_.mp4"
    Audio quality vs filesize is controlled by the bitrate (-b:a xxxk) and the video quality vs filesize is controlled by the -crf xx.
    Quote Quote  



Similar Threads

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