<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: HD Detection Algorithm — Help Us Build It!</title>
	<atom:link href="http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/</link>
	<description></description>
	<lastBuildDate>Sat, 07 Nov 2009 10:33:08 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Anthony</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49956</link>
		<dc:creator>Anthony</dc:creator>
		<pubDate>Tue, 14 Oct 2008 01:00:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49956</guid>
		<description>I think the comment from Svein is barking up the right tree.  His suggestion is the most complicated but if you&#039;re going to do something, why not do it right?

You can come up with a score based just on the numbers but at the end of the day it doesn&#039;t mean a whole lot unfortunately.  Somebody who encodes videos with an &quot;overkill&quot; bitrate setting would get a higher score by consuming more data, which means longer downloads and more file storage, but doesn&#039;t mean better video.  (i.e., I can take a 320x240 video with a web cam in horrid lighting, then resize it to 1080p and encode it at 10mbps bitrate... do I now magically have bluray quality HD video on my hands?  Of course not!)

Likewise, motion and solid areas of color will present greatly varying video quality even at the same resolution and bitrate.  For example: low motion (say, a slide show), will look great because the contents of the screen do not change often, compared to a high paced fast motion clip... or a cartoon for example will look better than &quot;real life&quot; video at the same bitrate because of larger areas of solid color.  Codecs look for these things and handle slower/solid areas much more efficiently by design.

I think the first step is something that actually quantifies the &quot;look&quot; of the video... That&#039;s the hard part... but I guess it can stop there because that&#039;s the goal here.  But to take it one step further, you could combine it with the actual bitrate numbers and you can also come up with an &quot;efficiency&quot; score.  Say that first step ranks a video from 1 to 10.  Work that score into a math formula with the bitrate.  If somebody pulls off a &quot;10&quot; at 1000kbps and somebody else pulls off a &quot;10&quot; at only 400kpbs, the latter is more efficient - the end user gets top quality video on a quicker download.  Ignore codecs all together, because some codecs that may be lower-tech on paper might actually pull off better subjective quality depending on the content of the video.  The final efficiency score would be really useful to a viewer to know they&#039;re getting high quality video and making best use of their bandwidth and disk space to get it!</description>
		<content:encoded><![CDATA[<p>I think the comment from Svein is barking up the right tree.  His suggestion is the most complicated but if you&#8217;re going to do something, why not do it right?</p>
<p>You can come up with a score based just on the numbers but at the end of the day it doesn&#8217;t mean a whole lot unfortunately.  Somebody who encodes videos with an &#8220;overkill&#8221; bitrate setting would get a higher score by consuming more data, which means longer downloads and more file storage, but doesn&#8217;t mean better video.  (i.e., I can take a 320&#215;240 video with a web cam in horrid lighting, then resize it to 1080p and encode it at 10mbps bitrate&#8230; do I now magically have bluray quality HD video on my hands?  Of course not!)</p>
<p>Likewise, motion and solid areas of color will present greatly varying video quality even at the same resolution and bitrate.  For example: low motion (say, a slide show), will look great because the contents of the screen do not change often, compared to a high paced fast motion clip&#8230; or a cartoon for example will look better than &#8220;real life&#8221; video at the same bitrate because of larger areas of solid color.  Codecs look for these things and handle slower/solid areas much more efficiently by design.</p>
<p>I think the first step is something that actually quantifies the &#8220;look&#8221; of the video&#8230; That&#8217;s the hard part&#8230; but I guess it can stop there because that&#8217;s the goal here.  But to take it one step further, you could combine it with the actual bitrate numbers and you can also come up with an &#8220;efficiency&#8221; score.  Say that first step ranks a video from 1 to 10.  Work that score into a math formula with the bitrate.  If somebody pulls off a &#8220;10&#8243; at 1000kbps and somebody else pulls off a &#8220;10&#8243; at only 400kpbs, the latter is more efficient &#8211; the end user gets top quality video on a quicker download.  Ignore codecs all together, because some codecs that may be lower-tech on paper might actually pull off better subjective quality depending on the content of the video.  The final efficiency score would be really useful to a viewer to know they&#8217;re getting high quality video and making best use of their bandwidth and disk space to get it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joey</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49955</link>
		<dc:creator>Joey</dc:creator>
		<pubDate>Mon, 13 Oct 2008 19:45:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49955</guid>
		<description>Maybe I&#039;m over simplifying this, (I probably am, seeing as I know just enough about resolution and codecs to royally screw this up.) but if HD resolution is a question of data over time, then couldn&#039;t there just be a bps level, like there is in music, and once it passes a certain ratio in a certain codec, it could be declared HD content?</description>
		<content:encoded><![CDATA[<p>Maybe I&#8217;m over simplifying this, (I probably am, seeing as I know just enough about resolution and codecs to royally screw this up.) but if HD resolution is a question of data over time, then couldn&#8217;t there just be a bps level, like there is in music, and once it passes a certain ratio in a certain codec, it could be declared HD content?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Pentek</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49923</link>
		<dc:creator>Pentek</dc:creator>
		<pubDate>Sat, 04 Oct 2008 12:50:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49923</guid>
		<description>You say &quot;The idea is to end up with a single number that gives us an idea of how relatively badass a video will look.&quot;

Now, I think the art of coming up with a single number based on such values is called &quot;fuzzy logic&quot;, and it has quite some literature. You might want to take a look at that.</description>
		<content:encoded><![CDATA[<p>You say &#8220;The idea is to end up with a single number that gives us an idea of how relatively badass a video will look.&#8221;</p>
<p>Now, I think the art of coming up with a single number based on such values is called &#8220;fuzzy logic&#8221;, and it has quite some literature. You might want to take a look at that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bab</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49902</link>
		<dc:creator>bab</dc:creator>
		<pubDate>Sun, 28 Sep 2008 13:39:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49902</guid>
		<description>Hi,
Nice challenge.
I would also consider the entropy calculation as a good investigation path, to check the inner quality of a video.
I have, by the way, two other directions to propose:
Frequency transformation (fourier) and check about the spectrum of the image itself (should be able to detect some articfacts and upgraded images). The more spectrum used, the better the image should be.
Upscaling detection: after downscaling the image, calculate a new one by different upscaling methods and chek how distant it is from the original image.

Cheers</description>
		<content:encoded><![CDATA[<p>Hi,<br />
Nice challenge.<br />
I would also consider the entropy calculation as a good investigation path, to check the inner quality of a video.<br />
I have, by the way, two other directions to propose:<br />
Frequency transformation (fourier) and check about the spectrum of the image itself (should be able to detect some articfacts and upgraded images). The more spectrum used, the better the image should be.<br />
Upscaling detection: after downscaling the image, calculate a new one by different upscaling methods and chek how distant it is from the original image.</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Caliga</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49858</link>
		<dc:creator>Caliga</dc:creator>
		<pubDate>Fri, 19 Sep 2008 23:22:04 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49858</guid>
		<description>I also think that you must keep format and quality separate.
By the way, there is a reason, why the size of screens is always given as a diameter: The diameter directly relates to the area, regardless of the aspect ratio. (c² = a²+c²)
So, instead of adding width and height, you would rather get the diameter.
However, if the resulting value should be presented to users, it may be better to use the area, and that in megapixels.
Following MDoggyDog, id suggest the following classification:
            diam           area
HD:     1468px      0.9MP         ( 720*1280=921,600px - sqrt(720*720+1280*1280)=1468 )
SD:     800px        0.3MP         ( 640*480=307200 - sqrt(640*640+480*480)=1468 )
LD:     the rest...
Personally I would not include the frames, although it may be in the &quot;official&quot; definitions.
First, you&#039;ll probably not get a lot of HD stuff, that saves on frames, and second, if you get that stuff you might not notice. Except it&#039;s an action movie... And for that, even 24fps is hardly enough.

Now, quality...
For the first step I&#039;d go the pragmatic way:
If somebody creates a video in HD resolution, he will rarely intentionally squeeze it in low-bitrate files.
The standard shaky-badlight-badcontrast-manyartifacts-youtube video will be LD anyway.

For anything more I&#039;d say you need either lots of calculating time or lots of superbrains, maybe both.
Especially to check several videos in a batch may be time consuming.
However, here are three ideas to perform the actual check:
1. artifact search:
search for 8x8px-blocks that are single-colored and surrounded by a rather different color. (the more the difference, the more the artifactiness :)
I assume that the blocks will be aligned to 8px-values, like in jpeg. maybe motion-compensation moves them?
2. edge detection:
both bad compression and up-scaling remove hard edges.
3. entropy testing
as entropy is the opposite of compressability, there is not a whole lot of entropy in over-compressed videos.
again, the 8x8 pixel-blocks need to be checked. this time we check how many different colors are in one block.
Thinking about it, this is the same as artifact search... The worst artifact is a block with an entropy of zero.
I remember an article that showed a picture of patterns (wavelets?) that are composed to more complex patterns.
The most basic pattern is empty. following are patterns with one vertical or horizontal gradient. (then more complex waves)
If you look at youtube videos, you may notice exactly those types of artifacts. (single-colored or 2-colored gradient)
If I remember correctly, usually those patterns are combined to more complex ones. But at low bitrates you only get one basic pattern.
so, maybe you would have to look for those patterns.
You can also use the concept of frequency. (which is just another way to look at entropy) low frequency means not a lot of change. High frequencies are cut of by compression.

The algorithms for those things are no secrets. (frequency, entropy, edge detections, artifact detection)
Knowledge about those things is not only used for video codecs but also for image editing, like in gimp.
So, a look at the gimp toolkit or imagemagick source codes may be enlightening. (Or hooking up with the devs there)

No matter which algorithm is used, it only can detect missing details if there *were* details.
So you can not just grab the first frame in the video, as it may be just black or blue with white font on it.
also, keyframes are not good candidates to look for bad quality I guess.</description>
		<content:encoded><![CDATA[<p>I also think that you must keep format and quality separate.<br />
By the way, there is a reason, why the size of screens is always given as a diameter: The diameter directly relates to the area, regardless of the aspect ratio. (c² = a²+c²)<br />
So, instead of adding width and height, you would rather get the diameter.<br />
However, if the resulting value should be presented to users, it may be better to use the area, and that in megapixels.<br />
Following MDoggyDog, id suggest the following classification:<br />
            diam           area<br />
HD:     1468px      0.9MP         ( 720*1280=921,600px &#8211; sqrt(720*720+1280*1280)=1468 )<br />
SD:     800px        0.3MP         ( 640*480=307200 &#8211; sqrt(640*640+480*480)=1468 )<br />
LD:     the rest&#8230;<br />
Personally I would not include the frames, although it may be in the &#8220;official&#8221; definitions.<br />
First, you&#8217;ll probably not get a lot of HD stuff, that saves on frames, and second, if you get that stuff you might not notice. Except it&#8217;s an action movie&#8230; And for that, even 24fps is hardly enough.</p>
<p>Now, quality&#8230;<br />
For the first step I&#8217;d go the pragmatic way:<br />
If somebody creates a video in HD resolution, he will rarely intentionally squeeze it in low-bitrate files.<br />
The standard shaky-badlight-badcontrast-manyartifacts-youtube video will be LD anyway.</p>
<p>For anything more I&#8217;d say you need either lots of calculating time or lots of superbrains, maybe both.<br />
Especially to check several videos in a batch may be time consuming.<br />
However, here are three ideas to perform the actual check:<br />
1. artifact search:<br />
search for 8&#215;8px-blocks that are single-colored and surrounded by a rather different color. (the more the difference, the more the artifactiness <img src='http://www.getmiro.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
I assume that the blocks will be aligned to 8px-values, like in jpeg. maybe motion-compensation moves them?<br />
2. edge detection:<br />
both bad compression and up-scaling remove hard edges.<br />
3. entropy testing<br />
as entropy is the opposite of compressability, there is not a whole lot of entropy in over-compressed videos.<br />
again, the 8&#215;8 pixel-blocks need to be checked. this time we check how many different colors are in one block.<br />
Thinking about it, this is the same as artifact search&#8230; The worst artifact is a block with an entropy of zero.<br />
I remember an article that showed a picture of patterns (wavelets?) that are composed to more complex patterns.<br />
The most basic pattern is empty. following are patterns with one vertical or horizontal gradient. (then more complex waves)<br />
If you look at youtube videos, you may notice exactly those types of artifacts. (single-colored or 2-colored gradient)<br />
If I remember correctly, usually those patterns are combined to more complex ones. But at low bitrates you only get one basic pattern.<br />
so, maybe you would have to look for those patterns.<br />
You can also use the concept of frequency. (which is just another way to look at entropy) low frequency means not a lot of change. High frequencies are cut of by compression.</p>
<p>The algorithms for those things are no secrets. (frequency, entropy, edge detections, artifact detection)<br />
Knowledge about those things is not only used for video codecs but also for image editing, like in gimp.<br />
So, a look at the gimp toolkit or imagemagick source codes may be enlightening. (Or hooking up with the devs there)</p>
<p>No matter which algorithm is used, it only can detect missing details if there *were* details.<br />
So you can not just grab the first frame in the video, as it may be just black or blue with white font on it.<br />
also, keyframes are not good candidates to look for bad quality I guess.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mike</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49846</link>
		<dc:creator>mike</dc:creator>
		<pubDate>Wed, 17 Sep 2008 00:28:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49846</guid>
		<description>for many users the important thing will be bitrate, because when choosing video its important to know how long the file will take to download, and how much space it will consume</description>
		<content:encoded><![CDATA[<p>for many users the important thing will be bitrate, because when choosing video its important to know how long the file will take to download, and how much space it will consume</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Francisco</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49836</link>
		<dc:creator>Francisco</dc:creator>
		<pubDate>Sun, 14 Sep 2008 16:49:37 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49836</guid>
		<description>I suggest multiply the width and the height, then divided by the bitrate (bitrate per pixel). In your example of H.264 this number vary from 170 to 200.</description>
		<content:encoded><![CDATA[<p>I suggest multiply the width and the height, then divided by the bitrate (bitrate per pixel). In your example of H.264 this number vary from 170 to 200.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Svein</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49830</link>
		<dc:creator>Svein</dc:creator>
		<pubDate>Sat, 13 Sep 2008 03:13:14 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49830</guid>
		<description>A system like this should make a clear difference between technical delivery format and quality.

Counting pixels, bitrate, and codec is not too difficult. This can mostly be read out of the files metadata and if you generate some kind of algorithm where you give each of these criterias a weight, you can have a number telling how nice this video COULD HAVE BEEN.

Yes, because this number will not be able to say anything about the quality of the video. That all depends on where the video comes from. Was this originally shot with an HD camera, or is it a 50kb/s streaming video that has been uprezzed?

With this in mind, the first mentioned algorithm is totally meaningless. People will soon start fixing their bad videos just to get higher automatic ratings or better exposure in the system.

The only way to get around this and give the numbers meaning is to employ a system that can actually say something about the quality of the video. And it is possible. A system like this has as far as I know been developed in Norway. I will get back with more details as soon as I have it. I think it has been developed to monitor the quality of broadcast video.</description>
		<content:encoded><![CDATA[<p>A system like this should make a clear difference between technical delivery format and quality.</p>
<p>Counting pixels, bitrate, and codec is not too difficult. This can mostly be read out of the files metadata and if you generate some kind of algorithm where you give each of these criterias a weight, you can have a number telling how nice this video COULD HAVE BEEN.</p>
<p>Yes, because this number will not be able to say anything about the quality of the video. That all depends on where the video comes from. Was this originally shot with an HD camera, or is it a 50kb/s streaming video that has been uprezzed?</p>
<p>With this in mind, the first mentioned algorithm is totally meaningless. People will soon start fixing their bad videos just to get higher automatic ratings or better exposure in the system.</p>
<p>The only way to get around this and give the numbers meaning is to employ a system that can actually say something about the quality of the video. And it is possible. A system like this has as far as I know been developed in Norway. I will get back with more details as soon as I have it. I think it has been developed to monitor the quality of broadcast video.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ben</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49819</link>
		<dc:creator>ben</dc:creator>
		<pubDate>Fri, 12 Sep 2008 05:39:41 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49819</guid>
		<description>No algorithm is going to be perfect.  In addition to the issues above, you also have the issue of how hard the movie is to compress in the first place.  I won&#039;t get into why my friend choose to screen a film that consisted of more than 1 hour of a single frame.  However, I would think 1kbps would be produce fine quality there with any codec.  Obviously that&#039;s an extreme example, but the same thing happens on a smaller scale with more normal content.  There&#039;s also the issue of how good the encoder was, different encoders can use the same bitrate and coded to produce different quality.

So I say, just pick some numbers and try to tweak them to work well, and don&#039;t worry about things like &quot;optimal&quot;.</description>
		<content:encoded><![CDATA[<p>No algorithm is going to be perfect.  In addition to the issues above, you also have the issue of how hard the movie is to compress in the first place.  I won&#8217;t get into why my friend choose to screen a film that consisted of more than 1 hour of a single frame.  However, I would think 1kbps would be produce fine quality there with any codec.  Obviously that&#8217;s an extreme example, but the same thing happens on a smaller scale with more normal content.  There&#8217;s also the issue of how good the encoder was, different encoders can use the same bitrate and coded to produce different quality.</p>
<p>So I say, just pick some numbers and try to tweak them to work well, and don&#8217;t worry about things like &#8220;optimal&#8221;.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam</title>
		<link>http://www.getmiro.com/blog/2008/09/hd-detection-algorithm-%e2%80%94%c2%a0help-us-build-it/comment-page-1/#comment-49813</link>
		<dc:creator>Adam</dc:creator>
		<pubDate>Thu, 11 Sep 2008 01:58:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.getmiro.com/blog/?p=499#comment-49813</guid>
		<description>Dean,

Yes, using the Bayesian approach I suggested would require a crop of videos to compare to. If you can&#039;t get or easily generate a database of files&#039; important attributes and whether they&#039;re HD (e.g. they come from a pre-identified HD channel or non-HD channel), it may not be the best approach. (Though having estimates of the percentages themselves would work too, I doubt you would stumble upon statistics like that on the web.)

Some advantages would include that it can continue to &quot;learn&quot; by user or moderator feedback. Say, an HD video type with specs you didn&#039;t think of comes around, you don&#039;t need to re-code an algorithm. Instead, you mark a video (or a few videos) with those specs as HD and put that info in the database. Similarly, if something gets mis-identified as HD, then that error can be made less likely by continuing to add stats along with a &quot;high/standard def&quot; label to your database as time goes on. Since you said you want the software to help you in weeding out low-resolution video, it seems that having a system that progressively takes more and more load off of humans is a good fit.

Another advantage is mentioned a little in the previous paragraph, but you don&#039;t have to rely on textbook definitions of what an HD video has.

I really think spam filter example demonstrates well how the system works, except that the spammers keep trying to trick Bayesian filters by obfuscating the things that would identify it as spam. In this usage, there seems to be no reason for video encoders to try to fool the system.

It may or may not be a good fit. I&#039;m getting a degree in stats and this was the first thing that came to mind.</description>
		<content:encoded><![CDATA[<p>Dean,</p>
<p>Yes, using the Bayesian approach I suggested would require a crop of videos to compare to. If you can&#8217;t get or easily generate a database of files&#8217; important attributes and whether they&#8217;re HD (e.g. they come from a pre-identified HD channel or non-HD channel), it may not be the best approach. (Though having estimates of the percentages themselves would work too, I doubt you would stumble upon statistics like that on the web.)</p>
<p>Some advantages would include that it can continue to &#8220;learn&#8221; by user or moderator feedback. Say, an HD video type with specs you didn&#8217;t think of comes around, you don&#8217;t need to re-code an algorithm. Instead, you mark a video (or a few videos) with those specs as HD and put that info in the database. Similarly, if something gets mis-identified as HD, then that error can be made less likely by continuing to add stats along with a &#8220;high/standard def&#8221; label to your database as time goes on. Since you said you want the software to help you in weeding out low-resolution video, it seems that having a system that progressively takes more and more load off of humans is a good fit.</p>
<p>Another advantage is mentioned a little in the previous paragraph, but you don&#8217;t have to rely on textbook definitions of what an HD video has.</p>
<p>I really think spam filter example demonstrates well how the system works, except that the spammers keep trying to trick Bayesian filters by obfuscating the things that would identify it as spam. In this usage, there seems to be no reason for video encoders to try to fool the system.</p>
<p>It may or may not be a good fit. I&#8217;m getting a degree in stats and this was the first thing that came to mind.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
