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.
+ Reply to Thread
Results 1 to 8 of 8
-
-
"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.
-
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). -
Not really. It's double-stitched and sets the flag. For a source of 1080 height the player should default to 709.
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.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).
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.
-
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.
-
Shouldn't be a problem.
You could set -crf to a lower value at the expense of a larger file size. -crf 0 would be lossless.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
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).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?
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.
-
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
Audio quality vs filesize is controlled by the bitrate (-b:a xxxk) and the video quality vs filesize is controlled by the -crf xx.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"
Similar Threads
-
Updated the ffmpeg-build-script with many codecs
By slyfox1186 in forum LinuxReplies: 3Last Post: 29th Sep 2024, 19:13 -
ffmpeg via batch script question
By imkira3 in forum Video ConversionReplies: 4Last Post: 8th Oct 2023, 12:35 -
Can anyone help me improve this FFMPEG script?
By Guernsey in forum Newbie / General discussionsReplies: 8Last Post: 13th Dec 2022, 10:33 -
AviSynth Script Exporting causes FFMPEG and Virtualdub to stall
By Tek03 in forum Video ConversionReplies: 4Last Post: 27th Jul 2022, 15:34 -
script to extract 1st frame of each second (ffmpeg)
By davidfurst in forum ProgrammingReplies: 3Last Post: 23rd Dec 2021, 02:26


Quote