FFMPEG reduce a video to specific file size and keep best quality
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
FFMPEG reduce a video to specific file size and keep best quality
The videos have 1.5gb to 10gb, length 0.20h to 10h, and the target size should not exceed about 1gb.
Similar to the example but with the best possible quality, can libx265 be used or better option than in the example?
How can I use "-crf" for the best quality without first manually testing and calculating to get the average size from about 1gb to a maximum of 1.5gb?
The videos have very different values 1="size:3889957442, bit_rate:2108103 duration:14762", 2="size:1856409823, bit_rate:6785433 duration:2189", 3="size:1752405186, bit_rate:1841002 duration:7779".
I think video1 would have to be strongly compressed by size with regard to quality because of medium bitrate and long duration, video2 would have to be compressed a little more because duration is short and bitrate is high, video3 would have to be compressed with regard to quality because of longer duration and low bitrate.
There are a lot of videos to be edited, so I would have to calculate a suitable crf value in my opinion.
Is there a better way or can my example still be optimized?
I can't test the compression on my slow pc, a single video would be converted for days.
How can I optimize the result for CRF, and could the results be approximately suitable for the respective video size?
Last edited by blumenwesen; 03-16-2024 at 09:55 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.