[FFmpeg-user] xmedian questions

Mark Filipak (ffmpeg) markfilipak at bog.us
Fri Jan 1 05:05:22 EET 2021


On 12/31/2020 09:50 PM, list+ffmpeg-user at jdlh.com wrote:
> On 2020-12-31 17:25, Mark Filipak (ffmpeg) wrote:
>> 1, Median? Really? (Or maybe really average?)
>>
>> For inputs = 239+15+15+15:
>> median = (239+15)/2 = 127
>> average = (239+15+15+15)/4 = 71
>> For inputs = 239+239+239+15:
>> median = (239+15)/2 = 127 (again)
>> average = (239+239+239+15)/4 = 183
> 
> It jumped out at me that the expressions you are computing for "median" don't match the definition I 
> am used to. It looks like you are computing the average of the largest and smallest samples. I 
> understand "median" to be a value such that half the samples are greater than or equal to, and half 
> are less than equal to, the value.
> 
> For inputs = 239+15+15+15:
> median = 15 (239, 15 >= 15; 15, 15 <= 15)
> For inputs = 239+239+239+15:
> median = 239 (239, 239 >= 239; 239, 15 <= 15)
> 
> So, how to you define "median"? And how does FFmpeg?
> 
>       —Jim DeLaHunt

Thank you, Jim. You are correct. I reckon I was thinking of some sort of mean value -- there are 
several versions of mean.

Median: The middle number in a given sequence of numbers, taken as the average of the two middle 
numbers when the sequence has an even number of numbers.

Hmmm... What sort of weighting is that?

For inputs = 239+15+15+15:
median = (15+15)/2 = 15
average = (239+15+15+15)/4 = 71
For inputs = 239+239+239+15:
median = (239+239)/2 = 239
average = (239+239+239+15)/4 = 183

As you see, the median winds up being either 15 or 239.
So, what's the function of 'percentile'?
And why is "inputs=2" not allowed?


More information about the ffmpeg-user mailing list