def ext(self):
        """Return the file extension for this video, e.g. 'mp4'.

        The extension is that from the actual filename if known. Otherwise
        it is the lowercase canonical extension for the video's MIME type.
        'vid' is used if the MIME type is 'video/unknown'.
        """
        if self._filename:
            return os.path.splitext(self._filename)[1].lstrip('.')
        return {
            CT.ASF:        'asf',
            CT.AVI:        'avi',
            CT.MOV:        'mov',
            CT.MP4:        'mp4',
            CT.MPG:        'mpg',
            CT.MS_VIDEO:   'avi',
            CT.SWF:        'swf',
            CT.WMV:        'wmv',
            CT.X_MS_VIDEO: 'avi',
        }.get(self._mime_type, 'vid')