Thursday 20 December 2012

My Blog Stats

One nice feature of blogger is the stats page. It gives a nice summary of viewer activity.

Here's mine captured today.

USA > UK > Germany.

59% are windows users.
28% are marked as "linux" (whatever the heck that means).

and chrome > firefox.

Interesting.

Wednesday 19 December 2012

Python, PyQt, Qt and windows - legal issues

I write GPLv3 applications using python and pyqt4, and by association Qt.

I build binaries mainly for Debian based gnu/linux distributions. Consequently, I let the mighty apt take responsibility for a valid python and pyqt environment. Up until now, therefore, I am simply distributing my own code.

Recently, however, I have been playing with creating packages for windows. Using Pyinstaller I can build executables which pull all my python and qt dependencies and roll them into either a single folder, or even a single *.exe .

These give me cause for concern however, as these standalone executables contain several files I believe I am unlicensed to redistribute. Those files come from 2 sources.

  1. microsoft themselves.
    • Microsoft.VC90.CRT.manifest
    • msvcm90.dll
    • msvcp90.dll
    • msvcr90.dll
  2. and pyqt/qt stuff (see below for full list)

In conjunction with Wix I can go even further and create an *.msi package which helps for clean installation, removal and upgrading of my application. I believe most application developers using these very same tools on windows simply do exactly this and don't care about the legal and moral issues here. I, however, am not content to do this and believe I need to find a way to comply with the licensing terms of microsoft, qt and pyqt4.

I believe one possibility is to write a separate application in conjunction with the Wix installer to emulate apt and install those components separately.

I would welcome comments from anyone who has addressed this problem.

Here are the files produced by one particular (non-trivial) PyQt4 application of mine.
$ ls -lR rotagen/
rotagen/:
        71680 Jul  4  2010 bz2.pyd
      1019904 Oct 20  2010 LIBEAY32.dll
         1857 Nov  7  2007 Microsoft.VC90.CRT.manifest
       224768 Nov  6  2007 msvcm90.dll
       568832 Nov  7  2007 msvcp90.dll
       655872 Nov  7  2007 msvcr90.dll
       266752 Nov 11  2010 phonon4.dll
      1594880 Dec 24  2010 PyQt4.QtCore.pyd
      5670912 Dec 24  2010 PyQt4.QtGui.pyd
       468480 Dec 24  2010 PyQt4.QtNetwork.pyd
       304640 Dec 24  2010 PyQt4.QtWebKit.pyd
      2286080 Jul  4  2010 python27.dll
      2238464 Nov 11  2010 QtCore4.dll
      7943168 Nov 11  2010 QtGui4.dll
       891392 Nov 11  2010 QtNetwork4.dll
       674816 Nov 11  2010 QtOpenGL4.dll
       276480 Nov 11  2010 QtSvg4.dll
     10843136 Nov 11  2010 QtWebKit4.dll
       339456 Nov 11  2010 QtXml4.dll
      1009069 Dec 16 11:10 rotagen.exe
          730 Dec 16 11:10 rotagen.exe.manifest
        11776 Jul  4  2010 select.pyd
        66560 Dec 24  2010 sip.pyd
       209920 Oct 20  2010 SSLEAY32.dll
       688128 Jul  4  2010 unicodedata.pyd

    rotagen/include:
         21451 Dec  6  2009 pyconfig.h

    rotagen/qt4_plugins:
        
        rotagen/qt4_plugins/codecs:
         141824 Nov 11  2010 qcncodecs4.dll
         167936 Nov 11  2010 qjpcodecs4.dll
          77824 Nov 11  2010 qkrcodecs4.dll
         155136 Nov 11  2010 qtwcodecs4.dll

        rotagen/qt4_plugins/graphicssystems:
         14336 Nov 11  2010 qglgraphicssystem4.dll

        rotagen/qt4_plugins/iconengines:
         36864 Nov 11  2010 qsvgicon4.dll

        rotagen/qt4_plugins/imageformats:
          26624 Nov 11  2010 qgif4.dll
          28672 Nov 11  2010 qico4.dll
         196096 Nov 11  2010 qjpeg4.dll
         220672 Nov 11  2010 qmng4.dll
          22016 Nov 11  2010 qsvg4.dll
         284672 Nov 11  2010 qtiff4.dll

Batch Converting Video for Nexus7 with ffmpeg.

The title says it all, I have a folder of videos, and want to have them play on my Nexus 7 Android device.
In other words, I want to be able to do this:-

~$ cd Videos
~$ somescript *.avi|*.mov|*.mpeg

then go to bed and wake up with nexus 7 supported files.

Here is my version of that script.
#! /bin/bash

############################################################
# script to convert video files to nexus (android) devices #
############################################################

HELP="\n
This script will convert video files to the preferred format for android devices\n
It uses ffmpeg to do a 2 pass encoding.\n
See http://patdavila.wordpress.com/2010/03/10/re-encoding-mythtv-recordings-for-viewing-on-your-android-phone/\n
\n
EXAMPLES\n
convert quicktime movies\n
~$ ./android_video.sh video_file.mov\n
\n
convert mpgs\n
~$ ./android_video.sh video_file.mpg\n
\n
convert avis\n
~$ ./android_video.sh video_file.avi\n
\n
wildcard use is supported, and unique filenames for the output 
videos should ensue by simply prefixing .mp4\n
eg.\n
~$ ./android_video.sh *.avi\n
"

 
function show_help {
    echo -e $HELP
    exit 1
}


convert()
{
 SRC=$1
 DEST=$1.mp4
 
 ffmpeg -i $SRC -aspect 16:9 -s 800x480 -vcodec libx264 -b 480k -r 13 -acodec libfaac -ab 128k -sameq -pass 1 -f rawvideo -an -y /dev/null && \
 ffmpeg -i $SRC -aspect 16:9 -s 800x480 -vcodec libx264 -b 480k -r 13 -acodec libfaac -ab 128k -ac 2 -sameq -pass 2 $DEST
}

if [[ "$1" == "" ]]
 then
  show_help
fi

while [[ "$1" != "" ]]; do
 convert $1
 shift
done

exit 1