Entries : Category [ Digital TV and Video ]
Articles about HDTV, satellite television, video transcoding, and video processing
[Miscellaneous]  [Computers and Technology]  [Travel]  [Education]  [Hacks]  [Robotics]  [Science]  [Programming and Software]  [iPhone]  [Digital TV and Video]  [Intellectual Property & Copyright]  [Personal] 

07 March

The Computer and Robot Vision (CRV) 2007 will take place in Montreal this summer and the reviewing has just finished. Greg Mori and Richard Vaughn, the co-chairs, did a great job. The acceptance rate for orally presented papers was 25%. and the paper quality seems to be high. It will be combined with 3 other conferences: The Precarn Conference (Robotics, Intelliegnce Systems and ICT), Graphics Interface (Computer Graphics and HCI) and Artificial Intelligence. Tal Arbel from McGill is the general chair of the whole thing, working with Gary Gudbranson of Precarn. They have done a lot of work to make the entire combined project very appealing. The invited speakers for CRV are Michael Black (Brown U), Larry Matthies (JPL), and Martial Hebert (CMU) each of which is a real expert in an impressive domain that combines basic science with a cool appliction -- directly connecting to the human brain, controlling robotics on other planets and using vision in autonomous vehicles.

The entire package of 4 conferences will be a nice combination with a low registration cost, and Montreal in the summer tiem is really attractive. This combines a lot of cool science, amazing applications and some business networking. CRV is sponsored by the Canadian Image Processing and Pattern Recognition Society (CIPPRS) which is the Canadian branch of the International Pattern Recognition Society (I am the president, so I am not totally impartial, but all the above comments are still true).

By Gregory Dudek at | Leave a comment |    
15 October

Tricks and incantations for resizing for iPhone, Android and other things

These are shell incantations for transcoding video with ffmpeg, especially for the ipod or iphone. ffmpeg is one of several free open source video editing programs you can use. These recipes are here partly to make it easier for other people to find them, and partly for me to find them again.

The standard open-source programs for transforming video are ffmpeg and mencoder. Each is capable from reading video in many different files formats, and writing out video using many different video encoding options. Each is supported in some form on Mac OS X, Linux and probably Windows. Both use common source libraries. You can get ffmpeg at http://www.mplayerhq.hu/design7/dload.html in many forms, or else compiled for Win32 at http://sourceforge.net /project/showfiles.php? group_id=205275.

mencoder has more filters than ffmpeg for processing the video. ffmpeg supports more different input and output formats, including direct output to mp4 container files. mencoder support for non-avi files is new and questionable, so for use with Quicktime you need to post-process with mp4creator: that's too much hassle for me, but instructions can be found at: mplayerhq.

My preferred solution is simply to use ffmpeg.

Basic command for iphone-compatible video
ffmpeg -i input-file -f mp4 -vcodec mpeg4 -maxrate 1000 -b 700
-bufsize 4096 -g 300 -acodec aac -ab 192 -s 480x320 output-file

iphone (better setting than above)
ffmpeg -i "$INFILE" -f mp4 -vcodec mpeg4 -maxrate 1000 -b 700 -qmin 3 -qmax 5
-bufsize 4096 -g 300 -acodec aac -ab 192 -s 480x320 -aspect 4:3 "$OUTFILE"

This should be fine with any ipod-like device, but it is customized for the iPhone screen size. The -s 480x320 refers to the size of the iPhone screen; customization for the video iPod would use the same incantation, but with a screen size of 320x240 to produce slightly smaller files. On the other hand, showing the video on TV would benefit from the larger size, or even 640x480. The Apple TV uses as much as 1280x720. (It is never worth using a larger size than your input footage, however, which is often limited to 640x480 for NTSC.) Thus, for the ipod video is might be:

ipod video
ffmpeg -i "$INFILE" -f mp4 -vcodec mpeg4 -maxrate 1000 -b 700 -qmin 3 -qmax 5
-bufsize 4096 -g 300 -acodec aac -ab 192 -s 320x240 -aspect 4:3 "$OUTFILE"
Other more exotic settings are the following:

sample separate image frames to jpeg images
ffmpeg -i "$INFILE" -y -ss 5 -an -sameq -f image2 -r 1/4 frame%03d.jpg

remove logo(from) from commercial video with lavc mpeg4 codec, avi container
mencoder -vf "delogo=545:401:100:45" -ovc lavc -lavcopts vcodec=mpeg4:acodec=libfaac 002.mpg -o 002.avi

Contrast enhancement (not recommended, can confuse compression)
mencoder -ovc lavc -lavcopts vcodec=mpeg4:acodec=libfaac -vf pp=autolevels:f 002.mpg -o 002.avi

WARNING: note that the -i inputfile flag needs to come early otherwise the resize (resizing/rescaling) flag -s will not have any effect. This is incredibly stupid, yes. At one point I found it didn't work and it took me a long time to figure out the problem that caused my resize to fail.

If you want to play with these, a quick guide to the key (somewhat obscure) ffmpeg parameters are as follows:

`-title string'

Set the title.

`-b bitrate'

Set the video bitrate in bit/s (default = 200 kb/s).

`-ss position'
Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported.

-r fps
Set to frame rate

`-s size'
Set frame size. The format is `wxh' (ffserver default = 160x128, ffmpeg 
default = same as source). A few of the many allowed appreciations are:
`-maxrate bitrate'
Set max video bitrate (in bit/s).
`-minrate bitrate'
Set min video bitrate (in bit/s).
`-ar freq'
Set the audio sampling frequency (default = 44100 Hz).
`-ab bitrate'
Set the audio bitrate in bit/s (default = 64k).
`-ac channels'
Set the number of audio channels (default = 1).
Disable audio recording.
`-acodec codec'
Force audio codec to codec. Use the copy special value to specify
that the raw codec data must be copied as is.

By Gregory Dudek at | Read (8) or Leave a comment |    
24 October

Free TV will be gone by 2020. Technical flaws with HD over the air, combined with new laws, assure this.

For some time I had been dismayed at how the USA has mandated the termination of regular analog TV as of 2009, but was relieved that Canada had not done the same thing. I just learned that the CRTC in Canada has mandated that as of 2011 no further analog (regular) television will be broadcast in Canada either. In addition, the situation for HDTV over the air, no matter where you live, is much worse than I had realized.

Canada decided (a few years back) to use the ATSC digital TV system, used only by the USA and a couple of other countries, as opposed the the DVB-T standard that was adopted world-wide (including all of Europe). As a result, ATSC devices are going to be more expensive than DVB-T, less compatible with assorted devices, and slower to come to market. Oh, and ATSC doesn't even work as well as DVB-T; nobody really knows yet how to make it work well with mobile devices.

Oh, and more frustrating yet, if you want to receive a full selection of digital TV broadcasts over the air (which is the only non-subscription choice), then in many (most?) you need a complicated set of one or more outdoor antennas, which may have to be to be directed using a rotor! Among other things, that precludes rapidly switching channels (I guess broadcasters love that). Ugh! Antennas on the roof! Wires, cables!

This just amounts to a not-so-slow and ugly death for over-the-air television. How many people are really going to mount an outdoor antenna, or a set of antennas. With rotors! What about those whose home or apartment faces the wrong way? Broadcast TV, and hence free TV, will be gone by 2020 as a result of this move. As the number of viewers shrink, so will the available programming, and prices will go up. That's a death spiral for sure.

Instead, we'll have televison you have to pay for, and for which there is steady feedback to the broadcasters regarding who watched what, and for how long (as already exists with most cable TV devices).

Background information

While standard definition remains the dominant viewing choice the world over, HDTV is already making gradual and progressive inroads. When color TV was introduced, it was developed to be backwards compatible and it gradually forced out black and white TV by being more appealing. In contrast, within the United States, Canada, and several other countries legislative action has been taken to force analog television off the air and replace it with terrestrial HDTV broadcasts. Satellite or cable broadcasting can remain with non-HDTV formats.

The primary reason for this is that digital broadcasting makes more efficient use of the available bandwidth, so if analog broadcasting is replaced by digital, the spectrum space is made available for other uses such as cellular phones or additional channels. More cynical explanations include the fact that forced adoption of digital technology closes the what the rights holding industries called the "analog hole", meaning the ability of home viewers to record or event distribute programming they received.

In the North America at least, digital television occupies largely the same portion of the electromagnetic spectrum as traditional analog television. Due to its digital nature, if the packets making up a program are too badly degraded, no signal whatsoever will be viewable. As a result, in locations with poor reception digital television may not function whereas analog television might still deliver a degraded signal.

On final concern about HDTV broadcasting in Canada, in particular: it doesn't accomodate disabled people properly. For years, there have been legistative requirements re. closed captioning of regular broadcast TV to assist those who are hard of hearing (or vision, since closed caption narratives can be transformed into audio fairly easily -- know any older people?). Quoting from Joe Clark's long article on this subject: "There is no requirement that Canadian HD devices receive, decode, or display captioning. Of course the U.S. has a requirement and we usually get the same equipment, and of course captioning is included in the ATSC specification, but there is no legislative guarantee that caption-capable high-definition equipment actually make it into Canadian homes." (... or that broadcasters insert captions into HD content.)

Well, good riddance. Maybe we'll read books instead.

By Gregory Dudek at | Read (2) or Leave a comment |    
Rate item 83: Rating: 29.1/10 (8 votes cast)
25 April

I recently had a look at the new Canon Powershot SD890 IS digital camera. It is part of Canon's ELPH line, and also known as the IXUS SD890.

It has one impressive feature: a 5x optical zoom. This is a higher zoom factor than any prior camera in the ELPH line, which I favor due to their small size and generally good quality. It has image stabilization as well, which is nice, but isn't really that significant in practice, I find (see below). I also use them for some sensing projects, and they can be partially computer controlled, which is a benefit.

The SD890, however, seems to suffer from a noisy CCD. In comparison with the slightly older SD900 (superseded by the SD950), I found the 890 to be disappointing. A series of comparisons photos is provided below.
In all the image pairs, the results from the SD890 are given on the left side, the SD900 on the right.

I often take pictures of documents, using my camera as a hand-help
quickie scanner, a selected such a scene as a good test. Shown below
is a photo of a paper document. No flash was used (in general, a flash produces far too much glare in such cases anyhow). Notice how blurred
the image from the sd890 (on the left) is, but worse yet, observe the color speckles on the white surface. I this is a case of "Bayer noise".

SD890 looks much worse than the older SD900
Paper document, significant zoom, major color artifacts from SD890 (on left).

Here is my son's face in a not-well-lit room. Notice the awful color
variations due to thermal noise on the CCD array (on the left). I almost wrapped the SD890 up and returned it to the box then and there, when I saw this.

SD890 looks much worse than the older SD900
SD890: left. SD900: right. Dim scene, blotchy colors.

Here is a case where the SD890 shines. A well-lit scene that I zoomed in on to an extreme degree, and then digitally zoomed as well. With the SD890 you can almost read the writing on the cables, which are just a blur for the SD900.

SD890 lets us really zoom in.
Great zoom with the SD890. Image stabilization probably was a helpful factor here.

The SD890 does seems to do nicely with respect to color balance and
sharpness. It's a tie between the two cameras, who knows which set of colors is correct? Here's a whole image, shrunken to fit.

Full scene, good color from sd890

How about a couple more examples, before we conclude?

Now I zoomed in (to the same scene shown) above as much as possible, and adjusted both images so the
physical object was the same size. That means the image on the
left is digitally zoomed less, because it was optically magnified more
before being recorded.
The sd890 wins here. This was taken standing on the balcony holding both cameras at once, yet I don't see
much benefit from the image stabilization.

Zoomed content

Here both images have been resized by the same factor to see the actual pixel
quality. What do you think?

Both images zoomed the same amount

And finally, one more try at writing on white paper, this time under daylight illumination. I even tried manually adjusting the color balance for the SD890. We're pretty brutally digitally zoomed into both images here.

Writing on white paper under daylight illumination.

All in all, it's a very mixed performance. It's not clear from these tests that the SD890 is really worth getting, since the noise problems are so severe.

By Gregory Dudek at | Leave a comment |    
30 October

I recently used MythTV to record some video acquired by an HDHomeRun box from Silicon Dust. The video files recorded by MythTV cannot be played, in many cases, by other video players, not even the superb VLC. This seems to be a results of dropped video frames (which in my case might be because I made the recording over a wireless network). Other people have also reported the same problem. Dropped frames are likely with video that comes over the air (ATSC) or satellite as well.

One partial solution is to re-encode the video using the open-source ffmeg program. Unfortunately, when you do this although the video becomes playable it is likely to lose audio sync. You can see the video and hear the audio, but the audio is no longer properly synchronized with the picture, due to the occasional dropped frame.

Well, it turns you this can be fixed using extra flags to ffmpeg. Specially, the -async flag can fix the problem. My preferred solution, for extra robustness, is to use:

-async 4 -vsync 5

Thus, you can transcode the video (assuming it was named 3442_20101030195200.mpg, with the command:

ffmpeg -i 3442_20101030195200.mpeg -sameq
-async 4 -vsync 5 3442_20101030195200.mp4

I hope this helps somebody. I saw several pleas on the net for solutions to this problem.

By Gregory Dudek at | Leave a comment |    
04 March

The Canadian transition to digital TV is coming. The often repeated statistic is that around the start of 2011 almost one million people depended exclusively on analog TV over the air. Whatever the real number, it discounts people who still use over-the-air reception somehow despite access to cable or satellite, for example to get local news, or in the bedroom of a relative living in the same house.

When I wrote my book on digital media a few years ago, it looked like the USA was rushing the transition while Canada was taking a careful, gradual and less painful approach. Instead, the US transition was accompanied by a subsidy program to allow at least access to low-end services to everybody.n while chaotic and confusing fir some, things were handled pretty well with a lot of government participation. In contrast, the Canadian transition seems to be positioned to be a fiasco with little awareness by the public, no government publicity and no subsidy program to aid those who can't afford a big new LCD screen.

Even the media companies don't seem very keen. While there will be bandwidth for more channels, the Canadian content rules and other issues may prevent this from being much of a boon to broadcasters. At least electronics stores stand to do well.

By Gregory Dudek at | Leave a comment |    
[1]   2   Next