Video Encoding for Dummies

I have a set of .wmv files, about 12 totaling about 8 hours, that were made with Microsoft Windows Media Encoder in “Capture Screen” mode. This uses a proprietary Microsoft codec called MSS2. It’s optimized for screen capture and does a really good job with compression and displays in high quality on Windows Media Player. The problem is, nothing else in the world can read them. At least very few things. If you read on, this is my story of how I got it to work.

My goal is to make these .flv files so they can be displayed in a Flash player on a web page. I want to display them 800×600 and have the quality fairly decent, but not too big either. Can’t be larger than 100 MB per hour.

First I struggled with ffmpegx built for Mac. I downloaded a pre-compiled nifty little package. It was free, based on the open source command line ffmpeg, which is great most of the time. ffmpegx can do conversions, it’s a nifty little GUI front for the command line. It was neat, because I could play with the options in the GUI, and it would show me the command it used, which taught me how to use the command line version! But, it could not read my .wmv files made with the MSS2 codec.

Note: When I started this journey, all I knew is that I had .wmv files. I didn’t realize that .wmv is nothing more than a container representing a whole slew of video codecs from Microsoft. When I ran ffmpeg on the command line, here’s what it did that made me realize it was made with the MSS2 codec:

s1mait-dkoop:PST dkoopman$ ffmpeg -i per.wmv -b 500k -r 12 -ar 22050 -ab 48k -vol 8192 -f flv per.flv
FFmpeg version SVN-r22094, Copyright (c) 2000-2010 the FFmpeg developers
  built on Feb 27 2010 10:06:19 with gcc 4.2.1 (Apple Inc. build 5659)
  configuration: --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64 --enable-libfaac --enable-libfaad --enable-libx264 --enable-gpl --enable-nonfree
  libavutil     50. 9. 0 / 50. 9. 0
  libavcodec    52.55. 0 / 52.55. 0
  libavformat   52.54. 0 / 52.54. 0
  libavdevice   52. 2. 0 / 52. 2. 0
  libswscale     0.10. 0 /  0.10. 0
[asf @ 0x10100b000]max_analyze_duration reached
Input #0, asf, from 'per.wmv':
  Metadata:
    title           : Perf
    author          : DaveK
    copyright       : 2010
    comment         : 
    WMFSDKVersion   : 11.0.5721.5265
    WMFSDKNeeded    : 0.0.0.0000
    IsVBR           : 0
  Duration: 00:11:39.63, start: 3.000000, bitrate: 91 kb/s
    Stream #0.0(eng): Audio: wmav2, 44100 Hz, 1 channels, s16, 32 kb/s
    Stream #0.1(eng): Video: MSS2 / 0x3253534D, 803x600, 250 kb/s, 1k tbr, 1k tbn, 1k tbc
swScaler: Unknown format is not supported as input pixel format
Cannot get resampling context

Notice the line three up from the bottom: Stream #0.1(eng): Video: MSS2 / 0x3253534D, 803×600, 250 kb/s, 1k tbr, 1k tbn, 1k tbc

Searching on MSS2, I found this page http://www.mplayerhq.hu/DOCS/codecs-status.html that confirmed that MSS2 is Windows Media Screen Codec. Made me realize that Windows Media Encoder uses a special codec for screen capture.

mencode
Next up, I tried mencoder from mplayer, thinking it has the codec listed on it’s codecs-status page, it’ll probably work. Here’s the output from that:

s1mait-dkoop:PST dkoopman$ mencoder per.wmv -ofps 12 -oac mp3lame -ovc lavc -lavcopts vcodec=mpeg4 -o per.avi
MEncoder SVN-r30531-snapshot-4.2.1 (C) 2000-2010 MPlayer Team
success: format: 0  data: 0x0 - 0x7a028c
ASF file format detected.
[asfheader] Audio stream found, -aid 1
[asfheader] Video stream found, -vid 2
VIDEO:  [MSS2]  803x600  24bpp  1000.000 fps  250.0 kbps (30.5 kbyte/s)
[V] filefmt:6  fourcc:0x3253534D  size:803x600  fps:1000.000  ftime:=0.0010
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 1 ch, s16le, 32.0 kbit/4.54% (ratio: 4006->88200)
Selected audio codec: [ffwmav2] afm: ffmpeg (DivX audio v2 (FFmpeg))
==========================================================================
Opening video filter: [expand osd=1]
Expand: -1 x -1, -1 ; -1, osd: 1, aspect: 0.000000, round: 1
==========================================================================
Requested video codec family [wmsdmod] (vfm=dmo) not available.
Enable it at compilation.
Requested video codec family [wms10dmod] (vfm=dmo) not available.
Enable it at compilation.
Cannot find codec matching selected -vo and video format 0x3253534D.
==========================================================================

Notice: wmsdmod and wms10dmod are on the page http://www.mplayerhq.hu/DOCS/codecs-status.html listed as .dll. I could not for the life of me figure out how to enable this as compile time. It’s not an option in ./configure –help and can’t find it online with Google searches.

Flip4Mac
I installed Flip4Mac WMV Studio Pro, purchased for $99, because I read online I needed this to decode .wmv files. I figured that’s Microsoft for you, but it was worth it to me to spend some cash to be able to complete this task. Even after installation, I still cannot read these .wmv files encoded with MSS2. I can now view other .wmv files with QuickTime Pro, though.

ON2’s Flix Standard for Mac
I purchased this for $39 I think, because I discovered on this journey that ON2 is the one that invented the VP6 video that’s the defacto standard for Flash video on the web today. I’m thinking, get the “convert to flv” tool from the ones that invented flv, right!? Wrong. Well, it does a good job converting other files to flv, but it can’t read my .wmv files encoded with MSS2.

Windows Movie Maker
Have to be on a PC for this. Didn’t really want to, but I’m starting to crack. I’m starting to realize that no matter how bad I want to crack this nut on my Mac, it probably isn’t going to happen. On my PC, I can import my .wmv files encoded with MSS2 into Windows Movie Maker, then I can “Save Movie” and it saves as a .wmv file encoded with WMV3.

Ok, now how do I make a flv file out of it? Well, I already purchased ON2’s Flix Standard, and it can read the .wmv files encoded with WMV3. But, so can ffmpeg and mencoder, which are free! Ug, I’m irritated that I spent money when I didn’t need to.

Here’s the thing, though. Windows Movie Maker is a pain to use, it’s crashes on big files, and takes a long time to encode. And my process sucks. I have to download to PC, do conversion with Movie Make, transfer to Mac to finish the job. Yuck.

Movavi Video Converter for Mac
Didn’t buy this one, just downloaded the trial. Same problem, can read the .wmv files encoded with MSS2.

Movavi Video Converter for Windows
Located at http://www.movavi.com/videoconverter/ this program does the trick. I can read the .wmv files encoded with MSS2 and convert them straight to .flv with the H264 system. H264 is supposed to be the next best thing compared to VP6. For my case, it fit the bill perfectly. For example, one set of about 6 files over 3 hours of video came to about 140 MB total, and the quality was good. By good I mean can read the text on the screen, not grainy or blurry. These screen captures are moving from one web page to another with narration, not super animation.

Yes, I have to do this on my PC, but it works, one tool to do the conversion. This is what I needed to get through it.

DaveK.

How many people already have IPv6 connectivity?

We need to give a lot of thanks to Eric Vyncke for this fine innovation….

 

Put a 1-pixel image on your web site that lives on an IPv4/IPv6 dual stack host. This 1-pixel image is actually a PHP script that uses a special trick to figure out if the client has IPv6, whether it’s coming from a teredo tunnel, v4 or v6 preferred, and correlates it with OS and Browser.

 

It’ll be very interesting to see how the tides change as we near the feared IPv4 depletion date, which as of today is predicted to be Sept 2011.

 

You can put the 1-pixel image on your site and let your site’s traffic help feed the data.

 

Here are Eric’s stats:
http://www.vyncke.org/countv6/stats.php

 

Here are my stats:
http://ipv6poc.com/countv6/stats.php

 

I put these 1-pixel images at the footer of my blog pages:

<img src="http://ipv6poc.com/countv6/image4.php" width="1" height="1" border="none">
<img src="http://www.vyncke.org/countv6/image4.php" width="1" height="1" border="none">

 

If you want your site to feed this experiment, just drop the above two images just before the </body> tag on your site.

 

If your site gets more than 25,000 page hits a day, please reach out before putting these images on your site.

 

Oh, and you can get the source code for this here: http://sourceforge.net/projects/countv6/

 

To answer the question, here are the percentages of people that visit Eric’s site that have v6 over the last 2 years:

 

 

Interesting that it’s above 10%. It was on an upward trend till about Oct 2009, then took a sudden dive.

 

DaveK.

Putting a Facebook share link on your site

Putting this up as an example of how to do a share link. It’s a share link to http://goshinkarate.com/intro_offer.html (my kids take Karate here – Great program!)

 

Share

 

The code for this is:

<a name="fb_share" type="button" share_url="http://goshinkarate.com/intro_offer.html" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

 

You can put this code on your site and let your visitors share the Goshin Karate introductory special with their friends!

 

Amendment….

 

Let’s see what the Go Daddy Social Visibility product ad looks like:

 

Share

 

<a name="fb_share" type="button" share_url="http://www.godaddy.com/business/social-networking.aspx" href="http://www.facebook.com/sharer.php">Share</a><script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

BP Events bp-events invites broken, workaround

bp-events version 1.1 on top of buddypress 1.1.3 isn’t working for invites, it’s broken. After hours and hours of combing the web looking for a solution, I couldn’t find one. I figured out a workaround.

There were several other places online that I found other complain about this same problem. As far as I can tell, nobody has published any solution or workaround. Until now. I have a workaround – more like a hack, but it works!

I don’t know the WordPress/BuddyPress framework, but I’m pretty skilled at PHP, and can debug by following the HTTP request, and walk through the codebase. I used tcpflow to watch the HTTP requests and responses, and walked the codebase by dropping print lines in appropriate places to see how the request traversed the code.

Here’s what I found out. When bp-events gets to the “Send Invites” section, when you check a checkbox of a friend, it invokes an AJAX call, via JavaScript, to wp-load.php. Well, what it sends to the server is action=groups_invite_user, friend_id=. Everything else is hogwash. There is nothing in the request to tell you what event it’s for!

Ok, so the reason for this is that bp-events uses the same api as bp groups. It borrows from bp groups to draw your “Select Friends” widget. I have not found the real root cause. What it’s supposed to do is send an action=events_invite_user and should also send the event_id, I speculate. I haven’t been able to figure out how to craft an HTTP request to wp-load.php that will perform the intended behavior. I do, however, have a workaround that fixes the problem. Keep reading if you want a workaround hack that fixes this problem.

Read more