Square and non square video pixels

Last update : August 27, 2013

Whereas in the graphic and computer world we have square video pixels, in the old video world (PAL and NTSC) we have non square video pixels (Recommendation ITU-R BT.601-4). Video pixels in the HD world are, fortunately, square.

The term which describes this squareness or non-squareness is the pixel aspect ratio, expressed as a fraction of horizontal (x) pixel size divided by vertical (y) pixel size.

The PAL (576i) pixel aspect ratio (PAR) is 59/54 (1,094), the NTSC (480i) pixel aspect ratio is 10/11.

The pixel aspect ratio must not be confused with the display aspect ratio (DAR) or where the common values are 4:3 and 16:9 (anamorphic format).

When doing a conversion of a video file from one size or format in another size or format, the resulting video geometry will be stretched or squished if the pixel aspect ratio is not accomodated. Usually the errors are small and there is no great damage in the result if the correct conversion factor is ignored. The difference can become critical if filters are applied or other synthetic effects are added.

More detailed informations are available in the lurker’s guide to video from Chris Pirazzi.

Another problem is that the commonly used digital video resolutions don’t exactly represent the actual 4:3 or 16:9 picture aspect ratios. All commonly used modern digital video standards  are based on their counterparts in analog video standards to avoid too many compatibility issues. The most used sampling rate in PAL and NTSC video systems is 13,5 Mhz.

PAL has a line length of 64 µs, of which 52 µs contains actual image information, the rest is reserved for horizontal blanking. 52 µs × 13.5 MHz = 702 samples per scanline. In the vertical direction, there are 574 complete lines and 2 half lines, giving a total of 576 scanlines. Thus, the active image area for a 4:3 or 16:9 frame at 13.5 MHz sampling is 702×576 pixels.

For NTSC, the same calculation gives an image area of 711×486 pixels.

Instead of using 702 or 711 samples per line, the digital video standard defines 720 samples (= pixels) per line to allow for little deviations from the ideal timing values and to use a common sampling rate of 13,5 Mhz.

When converting videos from one size to another, cropping or adding black side edges to the video is necessary to keep the correct image aspect ratio. Fortunately some video conversion softwares care for these conditions.

More details about square and non square video pixels and a conversion table are available in the Quick Guide to Digital Video Resolution and Aspect Ratio Conversions maintained by Jukka Aho. Another useful tutorial about Pixel Aspect Ratio is available at the doom9.net website.

Ken Burns video effect

The Ken Burns video effect is a popular name for a  panning and zooming effect used in video production from still imagery. The name refers to Kenneth Lauren “Ken” Burns,  an American director and producer of documentary films known for his style of using archival footage and photographs.

The technique is principally used in historical documentaries where film or video material is not available. The effect is included in several movie edition softwares, for instance on the Windows platform in AVS Video Editor.

Will McGugan published a tutorial about the Ken Burns effect in javascript and canvas on his blog.

CAPTCHA

CAPTCHA examples

CAPTCHA is standing for “Completely Automated Public Turing test to tell Computers and Humans Apart”. It is a type of challenge-response test used in computing as an attempt to ensure that the response is generated by a person. Because other computers are supposedly unable to solve the CAPTCHA, it is sometimes described as a reverse Turing test, because it is administered by a machine and targeted to a human.

A common type of CAPTCHA requires the user to type letters or digits from a distorted image that appears on the screen.

The term “CAPTCHA” was launched in 2000 by Luis von Ahn, Manuel Blum, Nicholas J. Hopper, and John Langford (all of Carnegie Mellon University).

A very interesting contribution about CAPTCHA (in french) has been published by Nicolas Kerschenbaum, a security consultant of the french company Xmco Partners.

Piwik : open source Web Analytics

Piwik Dashboard


Piwik, an open source alternative to Google Analytics, is a downloadable, open source (GPL licensed) real time web analytics software program. It provides you with detailed reports on your website visitors: the search engines and keywords they used, the language they speak, your popular pages, …

Piwik is a PHP MySQL program that is installed your own webserver. At the end of a five minute installation process, a JavaScript code is generated that you embed in the webpages you want to track.

Skype recorder : video & audio

Last update : November 16, 2013
The following tools are available to capture video and audio from skype calls :

  • VodBurner : 99,95 $ ; 14 day trial; record, edit, upload
  • Supertintin : 29,95 $ ; trial with 5 minutes recording limit; group video conference up to 10 ways
  • IMcapture (formerly SkypeCap) : 49,95 $ ; trial with 2 minutes recording limit and logo
  • eCamm (for Mac) : 19,95 $ ; free demo
  • PowerGramo : 14,95 $ (basic) up to 44,95 $ (enterprise); free trial; upgrades possible
  • Pamela : 14,95 $ (basic) up to 29,95 $ (business); 30 day trial; up to 15 minutes recording fro free ; cheap versions audio only
  • Replay Telecorder : 29,95 $ ; demo version; capture suit with 9 products in bundle for 59 $
  • Evaer : 19,95 $ ; free version with 5 minutes recording limit available ; licence pack for 5 users for 79,95 $ ; group video calls
  • AthTek Skype Recorder : (only audio) 19,95 $ ; free version with 5 minutes recording limit available; Lite version for 9,95 $

Screen recorders to capture video, sound and pictures of anything you see on your screen can also been used to record Skype video calls, but this is very CPU intensive.

I use the registered version of Evaer to capture skype video calls and to save them as mp4 videos in side by side format. The current Evaer version is 1.3.11.22, released on November 12, 2013.

If one of the Skype callers use an iPad or similar device, it’s best to set the tablet in landscape mode with the Home Button turned left, to assure that the user is displayed as expected in the video.

HTML CSS Box Model

last update: November 23, 2014

HTML CSS Box Model

All HTML elements can be considered as boxes. The CSS Box Model is shown in the figure at left.

The width and height properties specified for an element with CSS refers only to the content area. To get the full size of the element, you must also add the padding, the border and the margin.
The different parts are :

Firefox

Padding, border and margin are added to the lengths

  • Margin : transparent area around the border
  • Border : a border around the padding and content with a border color
  • Padding : clears an area around the content with the background color of the box
  • Content : where text and images appear

Padding is the inner space of an element, whereas margin is the outer space of an element. Border is in the middle. The following figures shows the three properties for different browsers :

Firefox - IE9 - Chrome - Safari

Firefox-33 * IE-9 * Chrome-39 * Safari-5.1

In CSS, it is possible to specify different margins for different sides :

margin-top:25px;
margin-right:50px;
margin-bottom:75px;
margin-left:100px;

These margins can also be declared as a shorthand property :

margin:25px 50px 75px 100px;

The values are set clockwise, starting for the top. The same is true for padding. The CSS border properties allow you to specify the style, width and color of an element’s border. The border-style values are :

  • none
  • solid
  • dashed
  • double
  • groove
  • ridge
  • outset

None of the other border properties will have any effect unless the border-style property is set! The border width can be specified in pixels (px) or with the three pre-defined values: thin, medium, or thick.

The shorthand code to set the border is :

border:5px solid red;

The order of the values are : border-width, border-style, border-color.

The following list provides links to websites with additional informations about the CSS Box Model and related topics :

Advanced stuff about CSS selectors

Last update : June 24, 2014

CSS selectors are made up of a pattern that is matched against all elements in the document tree, it’s the part that comes before the opening curly brace. The selector types are :

  • Universal : *  (Matches any element)
  • Type :  p  (Matches  element p)
  • Class :  .info (Matches any element whose class attribute contains the value info)
  • ID : #temp (Matches any element with an id equal to temp)
  • Descendant : p b (Matches any b element that is a descendant of an p element)
  • Child : p > b (Matches any b element that is a child of an p element)
  • Adjacent : p + b (Matches any b element immediately preceded by a sibling element p)
  • Attribute : p[att condition] (Matches any p element whose att attribute is compliant to the condition)
  • Pseudo-Class : p:action (Matches p during certain  actions; pseudo-classes are first-child, link, visited, active, hover, focus, lang(cc))
  • Pseudo-Element : p:content (Matches p for certain contents; pseudo-elements are first-line, first-letter, before, after)

CSS Selectors can be grouped and combined :

  • Multiple class selectors :p.info.error {color:#900;font-weight:bold;}(Matches p elements which have both “info” and “error” in their list of class names)
  • Descendant selectors :div#temp li p.info { color:#f00; }(Matches all p elements with a class name of “info” that are contained by an li element that is contained by a div element with the id “temp”)
  • Child selectors :p > strong { color:red }(Matches all strong elements that are children of a p element)
  • Adjacent siblings selectors :p + p { color:green }(Matches an element p which is the next sibling p to the first element)
  • Grouping :#my1, #my2,  #my3 {color:blue}(Matches all elements with the id’s my1, my2 and my3)
  • Attributes selectors :p[lang|=en] { color:yellow }(Matches all elements whose lang attribute starts with “en”)

:before and :after

The :before and :after pseudo-elements can be used to insert generated content before or after an element’s content.

3 digit color hex codes:

The 3 digit only hex codes are shorthand for the codes that have the numbers repeated in pairs.

#06C = #0066CC

z-index:

The z-index property specifies the stack order of an element. An element with greater stack order is always in front of an element with a lower stack order. z-index only works on positioned elements (position:absolute, position:relative, or position:fixed). An element with a negative value is displayed behind any with an undefined or positive z-index value in the same stacking context.

Some useful links about CSS are :

Internet Explorer Conditional Comments

last update : 17 Januray 2012

Many web designers use browser detection techniques to ensure that their sites display properly when viewed with specific browsers. Often Internet Explorer prior to version 9 is focused by developers because of bugs or lack of support of new css features. The most common way to detect Internet Explorer is to use client-side scripting to parse the user-agent string and extract the version number from the version token. If one is specifically interested in Internet Explorer, conditional comments might be a more effective alternative.

Conditional comments are a simple Internet-Explorer-only feature that Microsoft added to IE5 Windows and later. They provide an easy way to detect what IE browser a visitor is using to serve him different blocks of HTML.

There are two types of conditional comment: downlevel-hidden and downlevel-revealed. Downlevel-hidden comments hide HTML from non-IE browsers and from down-level IE browsers. The basic syntax of a downlevel-hidden conditional comment is :

<!--[if expression]> HTML <![endif]-->

expression can contain a number of different operators and values.

The downlevel-revealed conditional comment enables you to include content in browsers that do not recognize conditional comments. The basic syntax is :

<![if expression]> HTML <![endif]>

Conditional comments are usually used to load specific css or javascript files.

Conditional comments produce valid W3C code.

More informations about these topics :

MotionPortrait

MotionPortrait Inc is an japanese entertainment solution company that creates “Surprise and Impression” pursuing technology and creativity.

You can apply MotionPortrait as web sales promotion tools in various business scenes with its realistic expression, easy operation and low installation cost.  MotionPortrait provides its technology for various platforms such as mobile phones, the web and game consoles.

The most exciting applications for mobile phones (iOS, Android, …) are :

  • PhotoSpeak : 3D Talking Photo
  • 3D Animalizer : transforms you and your friends into 3D animals
  • uMovie : movies starring YOU
  • MillionFace : takes a single portrait photo and transforms it into over a million face variations in a 3D interactive movie