Any anons want to share ffmpeg webm settings? Here's my script for clipping for Jow Forums:

Any anons want to share ffmpeg webm settings? Here's my script for clipping for Jow Forums:
#!/bin/bash
#gets the duration in seconds from the input format of HH:MM:SS.Milliseconds
parseSeconds() {
splitString=(${1//:/ })
hours=${splitString[0]}
minutes=${splitString[1]}
splitArr=(${splitString[2]//./ })
seconds=${splitArr[0]}
totalSeconds=$(($((10#$hours * 60 * 60))+$((10#$minutes * 60))+$((10#$seconds))))
echo $totalSeconds
}

#convert start/end time in time format to just seconds
startSeconds=$(parseSeconds $2)
endSeconds=$(parseSeconds $3)


#target filesize. a little less than 3MB to account for fucked up max bitrate shit
targetFilesize=$((28000))

lengthSeconds=$((endSeconds - startSeconds))

#change the target filesize based on duration since again, maxbitrate doesn't mean shit
#90-120 secs
if [ $lengthSeconds -gt 90 ]; then
targetFilesize=$((15000))
#60-90 secs
elif [ $lengthSeconds -gt 60 ]; then
targetFilesize=$((20000))
#30-60 secs
elif [ $lengthSeconds -gt 30 ]; then
targetFilesize=$((25000))
fi

#filesize = bitrate * duration
#bitrate = filesize / duration
targetBitrate=$((targetFilesize/lengthSeconds)


#used to determine when the encoder should check the bitrate limits
#raise the multiplier to have a more variable bitrate, lower it to keep it closer to target
targetBufSize=`bc

Attached: departures-1.webm (1920x1080, 2.84M)

Other urls found in this thread:

trac.ffmpeg.org/wiki/Encode/VP8
vcodex.com/h264avc-4x4-transform-and-quantization/
twitter.com/NSFWRedditVideo

Another sample from the script. I saw something once about modifying the frequency of keyframes to get smoother motion, is that necessary?
Also can anyone tell me why the bitrate goes over the -maxrate parameter? Even if I set the bufsize to be ridiculously small it still goes over it consistently which is why I have a scaling filesize based on duration.

Attached: departures-2.webm (1920x1080, 2.77M)

>Also can anyone tell me why the bitrate goes over the -maxrate parameter?
a) You are using qmax. If necessary the encoder will increase the bitrate to reach this minimum quality level
b) You are not using CBR. To tell the encoder to use CBR, minrate:v, maxrate:v and b:v must have the same value.

Also there's no preset option for libvpx.

I am not using CBR since I want a variable bitrate, one would think that -maxbitrate would then limit the bitrate on vbr but I guess not. Why would qmax be necessary if I am giving a specific max bitrate for a variable bitrate encode? I guess I just am missing something because I would assume that MAX BITRATE means the encoder would cap it at that bitrate but I guess I am wrong? I guess I do not see how -qmax would play into the matter?

Also the comment specifically states that -threads and --preset do not apply to libvpx

I have a script for converting into gifs, with optional vidstab filter and other shit, but I don't have it with me now. Can post later if there's interest.

max bitrate for any encoding library is almost always a soft limit

Doesn't that seem a little retarded? Makes calculating filesize based off bitrate and duration a nightmare

Minrate and maxrate parameters are for CBR encoding. Remove these and keep -b:v for proper VBR encoding.

If you use VBR you trust the encoder to distribute the video bitrate based on the footage. Using a bitrate cap kinda defeats that purpose.
Also I think you are confusing qmax with qmin. qmax is the minimum quality level, qmin the maximum quality level. If your bitrate is less than necessary to reach qmax 50, then it'll increase the bitrate to reach it.

Yeah, my mistake. Although -threads applies to libvpx. It's just that threads 12 will never be utilized because of the way the encoder handles multi-threading.

If you use the calculated bitrate with VBR it's still very likely to stay within the limit. The average bitrate will be close to the passed value.

-threads on libvpx is based on the horizontal pixels of the video you are encoding iirc, that is why is doesn't really matter.
And honestly the bitrate does NOT stay anywhere near -minbitrate and -maxbitrate, I would not be complaining if it kept ANYWHERE NEAR the specified limits. The limits seem to be worthless since the encoder will go above the max for the almost the entire duration of an encode.

WHY THE FUCK WOULD THERE BE A MIN RATE AND MAX RATE FOR A CONSTANT BITRATE ENCODE? THIS MAKES NO SENSE. EITHER YOU ARE WRONG OR THE SPECS ARE FUCKING RETARDED. WHEN WOULD MINRATE AND MAXRATE BE USEFUL IF NOT FOR VARIABLE BITRATE ENCODES??????

>If your bitrate is less than necessary to reach qmax 50, then it'll increase the bitrate to reach it.
I'm confused on how this works. I would think that qMAX would set the MAX bitrate, why would it raise the average bitrate to be that value? Either I am misunderstanding what you said or what you said makes no sense.

If I were to make a guess, I suppose it would be due to in-loop assignment of q values.

Here is the FFMpeg wiki page for more info.
trac.ffmpeg.org/wiki/Encode/VP8

Why are -qmax and -qmin under the variable bitrate section of the manpages then?

e.g. "ffmpeg -i input.mp4 -c:v libvpx -qmin 0 -qmax 50 -crf 5 -b:v 1M -c:a libvorbis output.webm"

Yes, threads 12 won't be utilized, but threads 2 or 3 makes a difference when converting videos in a high enough resolution (e.g 1080p).
Also you can trust the VBR mode. It doesn't always stay in the limits, but it's still fairly reliable.

CQ and CRF values work on a different scale. Low values mean higher quality, high values mean lower quality. The highest value therefore refers to the lowest allowed quality.

Attached: results.png (1241x1754, 395K)

>CQ and CRF values work on a different scale. Low values mean higher quality, high values mean lower quality. The highest value therefore refers to the lowest allowed quality.
So how does setting -qmax make the min bitrate based on that value? Was that just a simple mistake that the other user made? -qmax 50 shouldn't make the bitrate an average of -qmax 50's value, right since it is a maximum?

>Also you can trust the VBR mode
Then why is it if I make -qmin 0K and -qmax X then average bitrate is higher than X? That doesn't sound very trustworthy?

Let me give you an (extreme) example. You have a 2 minute long 1080p video and want to fit it into the 3MB limit.
The theoretical bitrate is 200Kbps. So you start encoding. The encoder realizes, that it needs e.g. 1Mbps in the first and 700Kbps in the second minute to reach qmax 50. So it'll override your 200Kbps with 1Mpbs and 700Kbps respectively.

qmin is also a CQ value, not a bitrate limit. I'm surprised 0K didn't throw an error.

-qmax and -qmin directly manipulate quantization values used by the encoder which ultimately determines the quality and filesize of your encodes. In fact, because they override all other rate control parameters, they can serve to define 'hard' upper and lower limits to bitrate.

So I should get rid of -qmin and -qmax in variable bitrate encodes even though ffmpeg has it in its manpages? trac.ffmpeg.org/wiki/Encode/VP8 in the "Variable Bitrate" section?

You don't have to (I usually use qmax 50 as well, since it improves the result), but you have to understand that if you specify a minimum quality, the encoder will ensure said minimum quality.
If this minimum quality exceeds your file size limit you have to downscale or trim your video.

Why would something labeled "MAX" literally by its definition, raise the minimum quality, is what I am wondering?

Yes, you can get rid of qmin. Use qmax when you need to improve the quality of a few scenes if they have too many artifacts, otherwise you can omit it.

I am confused why q"MAX" would involve the average (or even minimum) of the video stream at all? Wouldn't you expect a maximum to be...the maximum and not affect the minimum or average at all?

Because higher (Q)uantization values=Lower quality
Lower (Q)uantization values=Higher quality.

Again, if it is a q"MAX" wouldn't you expect it to only apply to the maximums?

"Just use qmax when you have a minimum value to reach, it makes sense". Nigga what the fuck do you think -qmin is supposed to be for?

It has a technical background. See vcodex.com/h264avc-4x4-transform-and-quantization/ for an explanation.

For setting the maximum allowed quality.

>For setting the maximum allowed quality.
-q"MIN" is for setting the maximum allowed quality. You read it here, folks.

Yes, and that's what it does. It defines a ceiling for the range of Q values (usually from 4 to 63) assigned internally by the encoder. In a nutshell, Q's are inversely proportional to bitrate and quality of the output stream.

>It defines a ceiling
Clearly has to do with the conversation. LMAO at your dumb ass.

If it set a real "MAX" value then the fucking encoder wouldn't AVERAGE a higher bitrate than it, now would it?

What is so hard to understand about it? It doesn't stand for "minimum quality" but "minimum quality rate factor".

What difference does "minimum quality" not equal "minimum quality rate factor"? In WHAT SPECIFIC circumstances are they actually different?

This user has it right. An average encode should NOT exceed the MAX value. It is common sense.

Why is using ffmpeg such a pain in the ass?

Like I said, qmax overrides other rate control parameters, so if you set it up too high, the output will overshoot the target bitrate.

You should use WebM for Retards, it really suits your use case, user.

It's user interface is a command line and a much more sensible use for it is a backend to programs that leverage its functions.

A minimum quality is something you perceive, a minimum quality rate factor is a parameter for the encoder based on macroblock quantifiction.
Low quality rate factor = high perceived quality
High quality rate factor = low perceived quality
This is the way it is and as for the why, there's already a more in-depth link in this thread. If you can't accept this simple fact, then fork the encoder.

An average encode is supposed to produce an average bitrate over the course of the entire video. Different scenes need a different bitrate to look the same quality wise. Hectic scenes need more bitrate than calm scenes. The great thing about VBR is that it gives each scene the bitrate it needs to achieve an average quality for the video.
If you want to restrict the video bitrate itself then use CBR.

It really isn't. The encoders themselves can be a bit of a hassle, if there isn't a good documentation available.