DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far...

Welcome! This is a Q&A website for computer programmers and users alike, focused on helping fellow programmers and users. Read more

What are you stuck on? Ask a question and hopefully somebody will be able to help you out!
+1 vote

I want all the parameters of a video to be just good enough to minimize the size as much as possible.

I want to know how to write the ffmpeg command so that a video has a max height of 720p, a max bitrate of 2 megabits per second or less, a max frame rate of 30 fps, a max audio bitrate of 64 kilobits per second.

How do I know if I should use -crf or b:v because I've read I have to chose one of them. I wanted to use -crf and if the resulting video was going to be above a given max bitrate I would use -b:v instead. How can I be sure I use the one that achieves the lowest bitrate between -crf 26 and b:v 2000k?

There are some arguments that I have to use always, right? Like the video and audio encoding. I've tried adding it only when it's not already the one I want and it was turning aac audio to vorbis. So I guess the base command needs to be:

ffmpeg -i input.mp4 -c:v libx265 -crf 26 -c:a aac output.mkv

And then depending on the input I would add more parameters?

I want to make sure to avoid executing the command twice for the same video. How can I skip a video if it's already been processed?

Here is what I'm trying to do in python:

https://codeberg.org/LifeSymbiont/reduce_video_size/src/branch/main/main.py

I would also like to know what are all this options for. I've copied them from another project.

-progress pipe:1 -map 0 -map -v -map V
by

1 Answer

0 votes

How do I know if I should use -crf or b:v because I've read I have to
chose one of them. I wanted to use -crf and if the resulting video was
going to be above a given max bitrate I would use -b:v instead. How
can I be sure I use the one that achieves the lowest bitrate between
-crf 26 and b:v 2000k?

This is bitrate-capped CRF. -crf=23 -maxrate <bitrate> -bufsize 2*<bitrate>

by
edited by
0

Sorry, is this an answer or a clarification of the question?

0

An answer.

Contributions licensed under CC0
...