Thursday, January 27, 2011

Problems Syncing on Android

I've been having issues with Gmail sync for a while. It seems like it may have started after the Gmail app was upgraded to allow for priority inbox but I'm not sure.

I had these sync options turned on when I started noticing a problem synchronizing my Gmail.

  • Backup Assistant
    • backup
  • Exchange ActiveSync
    • mail
    • contacts
    • calendar
  • Facebook for HTC Sense
    • live feed
    • contacts 
  • Google
    • Google Reader
    • Books
    • contacts
    • Gmail
    • Calendar
  • News
    • news
  • Stocks
    • stock info
  • Twitter -- turned off
    • live feed
    • contacts
  • Weather
    • weather
I was able to follow the instructions listed below to get sync to start working again but this morning it failed.

To give some background on possible environmental issues.  I keep my Wi-Fi always turned on and at the hospital where I work I use the public Wi-Fi which redirects users to an "I Agree" terms for service page to create an authentication cookie.  I walk in and out of this Wi-Fi zone and need to re-authenticate (or rather re-agree) before Internet services start working.  So I know that I have inconsistant web access throughout the day.

I'm able to receive Exchange emails throughout the day without a hitch.  However, I had my first meeting that wasn't synchronized on the phone.  On my Droid Incredible, it showed no meeting and on Outlook 2007 my meeting was from 1-2pm.

My boss has been having meeting issues on his Motorola Droid2 Global phone which only happened with recurring appointments and the phone seems to not  display appointments that are modified from the recurring series.  We were able to trick the Droid into displaying the appointments by making a minor change to the series and re-saving the meeting.

When I went to try that same trick to the occurance, I got this weird Outlook Error:
Cannot open this item. You changed one of the recurrences of this item, and this instance no longer exists. Close any open items and try again.
Anyway, I am now trying to see what happens if I just have Google and Exchange synchronization turned on.

Here is the article that I found that started me down the path of fixing my sync issue.

xda-developers - View Single Post - Gmail Sync not working: "1) menu -> settings -> accounts & sync

- click on a sync account and disable individual syncs: contacts, gmail, calendar
- repeat for all accounts

2) Same location as step 1
-disable auto-sync
- then disalbe background data.

3) menu -> settings -> applications
- click on gmail app
- clear cache
- clear data

4) same location as step 3
- click on gmail storage
- clear data

5) Restart phone

6) re-activate sync functions in backwards order of disabling them:
- enable background data.
- enable autosync
- enable individual sync items for each account

This fixed it for me and has stayed that way for some time now."

Thursday, January 13, 2011

Converting Movies for Playback on Android

I have been working with a script that I picked up when I had a Motorola Q and an HTC Ozone both with the Windows 5-6 versions.  Once I picked up a new Android Phone, the Droid Incredible (love it!) I knew that I needed to change the format of the video file to x264.  Someday maybe I can change the format to WebM :)

This script doesn't do much, it basically allows me to quickly type my scriptname with a space and the name of the video file that I want to convert with an optional second parameter allowing for changing the name of the video file.

The scripts work easily on Linux, however the important part is usable on Windows or Mac as long as you have mplayer and mencoder installed on your machine.  The ability to unencrypt dvd encryption can be provided by decss and may break the law in your country.  Specifically this script is used by me to convert file formats of videos where I own the copyright, videos of my kids.  It should not be used for content that you do not own unless it falls under fair use and Americans can't circumvent DVD encryption because of the Digital Millennium Copyright Act (DMCA) even if you have fair use rights.

That being said here is the mencoder format that seems to work well for me on my Android phone.  For this example I will be converting kids.avi to kids_x264.mp4 but you could start with any format of video as long as mplayer can play it.  Because the command line is quite long I will be arbitrarily seperating the command into multiple lines to make it more readable.  I will be using the Linux notation using the '\' to signify the end of a line that continues on the next line.

mencoder kids.avi -idx -vf scale -zoom -xy 480 \
      -oac faac -faacopts mpeg=4:object=2:raw:br=128 -of lavf \
      -lavfopts format=mp4 -ovc x264 -sws 9 \
      -x264encopts nocabac:level_idc=30:bframes=0:bitrate=512:threads=auto:turbo=1:global_header:threads=auto:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh \
      -o kids_x264.mp4


This is my Linux script for Android:

#!/bin/sh
# This is from http://ianpurton.com/viewing-ipod-h264-videos-on-a-pocket-pc-with-tcpmp/
# Trying to create an easy way to convert video files for my smartphone
# Jeff Rasmussen 
SCREEN=480
BITRATE=512
2PASS=/tmp/$__2pass.log
AID=128
#AID=0  
# Tried to create a smart script that would automatically change the AID variable for DVD conversion 
if [ "$1" != "dvd" ]
    then AID=0
    else AID=128
fi 
if [ -e "$2PASS" ]
then
echo "Found a First pass log ($2PASS)"
echo -n "Do you want to start first pass over? (y/[n]): "
read overwrite
if [ $overwrite == "y" ]; then
echo "Removing Previous First Pass"
rm "$2PASS.0"
mv "$2PASS" "$2PASS.0"
fi
fi
#
# Crop Detect and Pass 1
#
mencoder "$1" -vf scale,cropdetect -zoom -xy "$SCREEN" \
-oac faac -faacopts mpeg=4:object=2:raw:br=128 -of lavf \
-lavfopts format=mp4 -ovc x264 -sws 9 \
-x264encopts nocabac:level_idc=30:bframes=0:bitrate="$BITRATE":threads=auto:turbo=1:global_header:threads=auto:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh \
pass=1 -passlogfile "$2PASS" -o /dev/null > /tmp/$__cropdetect.log

CROP="$( awk '/-vf/{moo=$19} END{sub(").","", moo); print moo}' /tmp/$__cropdetect.log )"
echo $CROP > $__cropresult.log

if [ "$2" ]; then
echo "Custom Filename"
# Actually encode
echo mencoder "$1" -aid "$AID" -idx -vf scale,"$CROP" -zoom -xy "$SCREEN" \
     -oac faac -faacopts mpeg=4:object=2:raw:br=128 -of lavf \
     -lavfopts format=mp4 -ovc x264 -sws 9 \
     -x264encopts nocabac:level_idc=30:bframes=0:bitrate="$BITRATE":threads=auto:turbo=1:global_header:threads=auto:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh \
     -passlogfile "$2PASS" -o "$2_x264.mp4"
# Use the default filename to produce video
else
mencoder "$1" -idx -vf scale,"$CROP" -zoom -xy "$SCREEN" \
     -oac faac -faacopts mpeg=4:object=2:raw:br=128 -of lavf \
     -lavfopts format=mp4 -ovc x264 -sws 9 \
     -x264encopts nocabac:level_idc=30:bframes=0:bitrate="$BITRATE":threads=auto:turbo=1:global_header:threads=auto:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh \
     -passlogfile "$2PASS" -o "$1_x264.mp4"
fi

This is my Linux script for Windows Phone:
 #!/bin/sh
# This is from http://ianpurton.com/viewing-ipod-h264-videos-on-a-pocket-pc-with-tcpmp/
# Trying to create an easy way to convert video files for my smartphone
# Jeff Rasmussen
SCREEN=320
BITRATE=500
#BITRATE=687
2PASS=/tmp/$1_2pass.log
AID=128
#AID=0
if [ "$1" != "dvd" ]
    then AID=0
    else AID=128
fi
if [ -e "$2PASS" ]
then
echo "Found a First pass log ($2PASS)"
echo -n "Do you want to start first pass over? (y/[n]): "
read overwrite
if [ $overwrite == "y" ]; then
echo "Removing Previous First Pass"
rm $2PASS.0
mv $2PASS $2PASS.log.0
fi
fi
#
# Crop Detect
#
mencoder "$1" -oac mp3lame -ovc xvid -vf scale,cropdetect -zoom -xy "$SCREEN" -xvidencopts pass=1 -passlogfile $2PASS -o /dev/null > /tmp/cropdetect

CROP="$( awk '/-vf/{moo=$19} END{sub(").","", moo); print moo}' /tmp/$1_cropdetect.log )"
echo $CROP > $1_cropresult.txt

if [ "$2" ]; then
echo "Custom Filename"
# Actually encode
mencoder "$1" -aid "$AID" -mc 0 -oac mp3lame -lameopts abr:br=92 -idx -vf scale,"$CROP" -zoom -xy "$SCREEN" -ovc xvid -xvidencopts  autoaspect:chroma_opt:vhq=4:bvhq=1:quant_type=mpeg:qpel:turbo:max_bframes=2:threads=2:pass=2:bitrate="$BITRATE" -passlogfile $2PASS -o "$2_xvid.avi"
# Use the default filename to produce video
else
mencoder "$1" -aid "$AID" -mc 0 -oac mp3lame -lameopts abr:br=92 -idx -vf scale,"$CROP" -zoom -xy "$SCREEN" -ovc xvid -xvidencopts autoaspect:chroma_opt:vhq=4:bvhq=1:quant_type=mpeg:qpel:turbo:max_bframes=2:threads=2:pass=2:bitrate="$BITRATE" -passlogfile $2PASS -o "$1_xvid.avi"
fi

Attempting to Enable WebGL on Ubuntu

I wanted to preview Google's new body browser on my Ubuntu workstation.  I am using Ubuntu meerkat with an ATI x1300 graphics card using the open source driver (I believe -- glxinfo | grep render shows direct rendering using Mesa DRI).

First I installed the Chrome beta channel.  When I ran /opt/google/chrome/chrome --enable-webgl and went to the body browser website above and found this error in the command window.
libEGL.so: cannot open shared object file: No such file or directory
So I installed libegl1-mesa to make sure that I had the driver installed.  I still had the same problem and when I ran 'locate libEGL' it found /usr/lib/libEGL.so.1 and /usr/lib/libEGL.so.1.0 but no libEGL.so  All I did was create a symbolic link 'ln -s  /usr/lib/libEGL.so.1 /usr/lib/libEGL.so

When I restarted chrome with the --enable-webgl parameter and went to the website I got a different error.
libEGL warning: unable to load st_GL.so
On the page it looked like Chrome froze waiting to load the textures and content.

Let me know if anyone gets this to work further.