Search
Find Me
  • Real World Video Compression
    Real World Video Compression
    by Andy Beach

See how story tellers are learning to use new technology at

Bay Area Video Coalition

Powered by Squarespace
Tuesday
Jun292010

Details on iPhone 4 video

I know, I know, I need to finish posting about the iPad video (i had it half written and it got deleted in a tragic blog accident).  While I pull myself together to rewrite it, I thought I'd post some clips fro the iPhone 4 camera showing what its cameras can do.

 I've published 4 different clips - 2 from the rear camera which records 720p content and two from the front facing camera which does 480p content.  One clip from each is is direct sunlight, while the other is in shade. The details that stand out to me is the 720p camera records at 10.5 Mbps and the 480p records around 3.5 Mbps.  The video codec, of course, is H.264 (Apple's consumer codec of choice). Ironically, Final Cut Pro can not yet edit H.264 content very well, but iMovie for the iPhone has been released for editing short movies right on the phone.

All in all, for a phone video camera, it does a fairly good job, though the colors on the flowers in the sunlight seem a little over saturated (though only on the rear facing HD camera).  People are already taking advantage of that HD camera for more than just home movies - I found this link pointing to a short film shot and edited (in iMovie) on the iPhone 4 by Michael Koerbel.

Want to check the videos out for yourself?  Click here to download all four clips.

Here are the details from the MediaInfo:

Front Facing Camera Report (640x480)

General / Container Stream #1

Total Video Streams for this File.................1

Total Audio Streams for this File.................1

Video Codecs Used.................................AVC

Audio Codecs Used.................................AAC LC-PS

File Format.......................................MPEG-4

Play Time.........................................14s 326ms

Total File Size...................................6.24 MiB

Total Stream BitRate..............................3 656 Kbps

Encoded with......................................4.0

Encoding Library..................................Apple QuickTime

Video Stream #1

Codec (Human Name)................................AVC

Codec (FourCC)....................................avc1

Codec Profile.....................................Baseline@L3.0

Frame Width.......................................640 pixels

Frame Height......................................480 pixels

Frame Rate........................................29.970 fps

Total Frames......................................429

Display Aspect Ratio..............................4:3

Scan Type.........................................Progressive

Color Space.......................................YUV

Codec Settings (Summary)..........................1 Ref Frames

QF (like Gordian Knot)............................0.389

Codec Settings (CABAC)............................No

Codec Settings (Reference Frames).................1

Video Stream Length...............................14s 313ms

Video Stream BitRate..............................3 583 Kbps

Video Stream BitRate Mode.........................VBR

Bit Depth.........................................8 bits

Video Stream Size.................................6.11 MiB (98%)

Video Stream Title................................Core Media Video

Date of Original Encoding.........................UTC 2010-06-29 21:19:12

Color Primaries...................................BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

Transfer Characteristics..........................BT.709-5, BT.1361

Matrix Coefficients...............................BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

Audio Stream #1

Codec.............................................AAC

Codec (FourCC)....................................40

Audio Stream Length...............................14s 326ms

Audio Stream BitRate..............................64.0 Kbps

Audio Stream BitRate Mode.........................CBR

Number of Audio Channels..........................2

Audio Channel's Positions.........................Front: L R

Sampling Rate.....................................44.1 KHz

Audio Stream Size.................................112 KiB (2%)

Audio Stream Title................................Core Media Audio

Date of Original Encoding.........................UTC 2010-06-29 21:19:12

 

Rear Facing Camera Report (1280 x 720)

 

General / Container Stream #1

Total Video Streams for this File.................1

Total Audio Streams for this File.................1

Video Codecs Used.................................AVC

Audio Codecs Used.................................AAC LC-PS

File Format.......................................MPEG-4

Play Time.........................................17s 461ms

Total File Size...................................21.9 MiB

Total Stream BitRate..............................10.5 Mbps

Encoded with......................................4.0

Encoding Library..................................Apple QuickTime

Video Stream #1

Codec (Human Name)................................AVC

Codec (FourCC)....................................avc1

Codec Profile.....................................Baseline@L3.1

Frame Width.......................................1 280 pixels

Frame Height......................................720 pixels

Frame Rate........................................29.970 fps

Total Frames......................................523

Display Aspect Ratio..............................16:9

Scan Type.........................................Progressive

Color Space.......................................YUV

Codec Settings (Summary)..........................1 Ref Frames

QF (like Gordian Knot)............................0.379

Codec Settings (CABAC)............................No

Codec Settings (Reference Frames).................1

Video Stream Length...............................17s 451ms

Video Stream BitRate..............................10.5 Mbps

Video Stream BitRate Mode.........................VBR

Bit Depth.........................................8 bits

Video Stream Size.................................21.8 MiB (99%)

Video Stream Title................................Core Media Video

Date of Original Encoding.........................UTC 2010-06-29 21:18:46

Color Primaries...................................BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

Transfer Characteristics..........................BT.709-5, BT.1361

Matrix Coefficients...............................BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

Audio Stream #1

Codec.............................................AAC

Codec (FourCC)....................................40

Audio Stream Length...............................17s 461ms

Audio Stream BitRate..............................64.0 Kbps

Audio Stream BitRate Mode.........................CBR

Number of Audio Channels..........................2

Audio Channel's Positions.........................Front: L R

Sampling Rate.....................................44.1 KHz

Audio Stream Size.................................136 KiB (1%)

Audio Stream Title................................Core Media Audio

Date of Original Encoding.........................UTC 2010-06-29 21:18:46



 

 

 



 

Monday
Jun142010

Encoding for the iPad pt 1

Before I get started, I'd like to give ArtBeats a big shout out and a thanks for providing me with the clips I used to test these settings.  Normally I drop their logo into the clips i'm encoding, but sense I didn't want that effecting my tests, I left it off for this round.  I encourage you to check out ArtBeats for all your stock footage needs.

I've now had an iPad for a few weeks, so i've had a chance to play a variety of videos back on it. It truly is a pleasure to watch video on and I could see that being especially popular on long road trips with the kids (or as I'll likely use it, watching movies in bed).   I've seen some guidelines for encoding for the iPad already (most recently from Ken Stone's site), but I wanted to tackle the problem myself to see what settings I felt worked best. I had a couple of goals with my testing:

1) Best General Settings for iPad - I wanted to figure out for myself what I thought the best encoding guidelines for the iPad should be.

2) How effective are advanced settings? Do the advanced settings for H.264 (that you can access through the x264 plugin and apps like HandBrake) improve the quality and not ruin the battery life (often time tools that improve the quality do it at a processor sacrifice).

3) Does HD source differ from SD source? I'm assuming HD might require slightly different settings than SD, but I want to see if that bears out.

Methodology


So with these goals in mind, I set out to encode a variety of resolutions and data rates from one of my test clips. I chose the hardest clip I had, as I figured if it looked even remotely decent with it, then it wold look great for anything else. In addition to my settings, I did encodes using both QuickTime 7 and QuickTime X's default settings for the iPhone and AppleTV as I figured both are getting used by people to encode for the iPad. I've pulled PNG frames from each encode for comparison and posted to Flickr (check the original images for true comparisons) and below is a table outlining the resolutions and data rates of each encode I tried.

Resolutions

I focused my tests around three primary resolutions - 960x540, 854x480, and 640x360. The iPad's screen resolution is 1024 x 768, so i could have thrown in a 1024 x 576 (the appropriate resolution for wide screen content at the iPads full width) however i figured this would be overkill plus its a bit of an oddball size, so i stuck with resolutions i'm familiar with. 540p is common as a "nearly" HD option that became quite popular when the Apple TV came out (this is the resolution it plays back for 30fps content). 360p is the cropped standard definition widescreen option and 480p is a nice in between option.

Data Rates

To choose data rates, I started with the 540p resolution and targets what i thought was a pretty high data rate (3.25 Mbps or 3250 Kbps) then reduced it by approximately 1/3 to get a lower end comparison. To determine the appropriate data rate for each additional resolution I divided my total picture pixel count by the data rate, then multiplied this value by the total pixel count of the other resolutions. Make sense? Well, here's quick excel formula to help explain it:

 

ExcelMatch.jpg

 

Why did I bother doing this?  I wanted to make sure I was devoting about the same amount of kilobits per second to the video at each resolution - in other words, i didnt want to have one resolution have too little or too much, because then it would be harder to tell how it was doing in comparison to the others.  Of course, I just used this as a rough guideline - I then rounded and reduced the rates where i thought appropriate - this was just to give me a range for each resolution that seemed an appropriate starting point.

For each resolution I was trying out, I also chose the auto setting in the QuickTime Export panel to see how much data the encoder thought was needed to do the clip justice — now I knew this would be a high number (like I said, this is an aggressive clip), but I wanted a sense of how much lower I was setting it.

 

EncodeTable.jpg

 

Results

After watching all the clips, I more or less settled on 480p at 1900kbps as the setting i thought did the best job of balancing quality.  Sure, I could throw more bits at it per second, but the quality/file size trade off seemed to really settle right about here. And while I liked the way the 360p clips looked,  I thought with this content, the 480p held up just slightly better.  Next, I encoded a range of HD clips to this setting just to see how it held up to a variety of types of video content (screenshots here).  With the exception of a few super high motion clips, it held up fine.  I used the same settings I outlined in my recent post (more or less) for the recent x264 post, but here's a link to the screens in case you need reminding.  If you want to try these out for yourself, hop over to MyComet's website to get the latest x264 QuickTime plugin, follow my instructions here for how to set up, then use these settings:

 

But Wait, There's More!

But all of this really only answers question number one for me - I still wasn't sure if the advanced settings really made that big a difference, or if SD and HD content deserved separate settings.  So, I have more testing to do - tune in later this week for comparisons of HD and SD content encoded with these settings, plus some side by side comparisons to the default H.264 encoder (as well as some more conversation about the default settings from both QuickTime 7 and QuickTime X).

Thursday
Jun102010

What Video Codec does iPhone's FaceTime use?

When Apple announced the new iPhone 4 this week, one of the coller features announced was the front facing camera and the new FaceTime feature.  Of course, its early days for thinking about video chat on the go, but as someone who travels quite a bit for work, I really like the idea of having access to a quick video conferencing type option on the go.

 

Of course, the video geek in me immediately wondered about the video specs behind this.  Steve announced it shared H.264 with iChat, amonst other things, but i wondered what else was invovled.  I found this list over at Apple Insider:

 

  • H.264 and AAC, its ISO/MPEG video and audio codecs (just like iChat).
  • SIP (Session Initiation Protocol), the open IETF signaling protocol for VoIP used by iChat AV.
  • STUN (Session Traversal Utilities for NAT), an IETF standard for dealing with lots of different kinds of NAT. 
  • TURN (Traversal Using Relay NAT), an IETF standard for allowing a client behind NAT to receive incoming requests like a server.
  • ICE (Interactive Connectivity Establishment) an IETF standard which helps set up connections through NAT firewalls. 
  • RTP (Real-time Transport Protocol), an iETF standard for delivering media streams in VoIP.
  • SRTP (Secure RTP) an IETF standard designed to provide encryption, message authentication and integrity for the data streams.
  • H.264 and AAC, its ISO/MPEG video and audio codecs (just like iChat).SIP (Session Initiation Protocol), the open IETF signaling protocol for VoIP used by iChat AV.STUN (Session Traversal Utilities for NAT), an IETF standard for dealing with lots of different kinds of NAT. TURN (Traversal Using Relay NAT), an IETF standard for allowing a client behind NAT to receive incoming requests like a server.ICE (Interactive Connectivity Establishment) an IETF standard which helps set up connections through NAT firewalls. RTP (Real-time Transport Protocol), an iETF standard for delivering media streams in VoIP.SRTP (Secure RTP) an IETF standard designed to provide encryption, message authentication and integrity for the data streams.

These specs would lead me to believe this is can be adopted into a wide range of products, which is good.  the usefulness of this product goes down dramatically if i can only do video calls to other iphone 4's on wifi (which was what was suggested in the keynote).  Skype is nervously eyeing this and I for one hope they adopt it, as this is what i've used for most of my video calls to date.

 

 

 

Thursday
Jun102010

Food for thought 

I ran across this quote and it has stuck with me:

“You know the difference between a rich genius and a broke genius?” asked Clayton P. Knowles, Jr. Esq. as he peered over his half-moon readers, ” … a broke genius is two years ahead of his time, a rich genius is six months ahead of his time.”

I feel like I've been at both those junctions before - the trick is figuring out which idea is only 6 months ahead...

Wednesday
Jun022010

Image Comparisons of x264 to H.264

In my previous post about x264 I'd promised some side by side comparisons and hadn't delivered as yet (sorry, I've been busy).  Well, while i'm here at BAVC, encoded some content for one of the groups (Power Poetry) of their trailer.  We compared that to the H.264 version they had just done and the results were quite different.  The basic video settings were the same in each (data rate and key frames were set to automatic) but in the x264 side, I used the same advanced settings from the previous post.

 

click the image for full size

click image for full size

 

click image for full size

When I get some free time, i'll post a few more tests and some actual movies, but I thought i'd share these to show there is definitely some benefit to testing out the x264 plugin.