Example #1
0
def select_audiocodec(inFile, tsn = ''):
    # Default, compatible with all TiVo's
    codec = 'ac3'
    if config.getAudioCodec(tsn) == None:
        type, width, height, fps, millisecs, kbps, akbps, acodec, afreq, vpar =  video_info(inFile)
        if acodec in ('ac3', 'liba52', 'mp2'):
            if akbps == None:
                cmd_string = '-y -vcodec mpeg2video -r 29.97 -b 1000k -acodec copy -t 00:00:01 -f vob -'
                if video_check(inFile, cmd_string):
                    type, width, height, fps, millisecs, kbps, akbps, acodec, afreq, vpar =  video_info(videotest)
            if not akbps == None and int(akbps) <= config.getMaxAudioBR(tsn):
                # compatible codec and bitrate, do not reencode audio
                codec = 'copy'
    else:
        codec = config.getAudioCodec(tsn)
    return '-acodec '+codec
Example #2
0
    def __est_size(self, full_path, tsn = ''):
        # Size is estimated by taking audio and video bit rate adding 2%

        if transcode.tivo_compatable(full_path, tsn):
            # Is TiVo-compatible mpeg2
            return int(os.stat(full_path).st_size)
        else:
            # Must be re-encoded
            if config.getAudioCodec(tsn) == None:
                audioBPS = config.getMaxAudioBR(tsn)*1000
            else:
                audioBPS = config.strtod(config.getAudioBR(tsn))
            videoBPS = config.strtod(config.getVideoBR(tsn))
            bitrate =  audioBPS + videoBPS
            return int((self.__duration(full_path) / 1000) *
                       (bitrate * 1.02 / 8))
Example #3
0
    def __est_size(self, full_path, tsn=''):
        # Size is estimated by taking audio and video bit rate adding 2%

        if transcode.tivo_compatable(full_path, tsn):
            # Is TiVo-compatible mpeg2
            return int(os.stat(full_path).st_size)
        else:
            # Must be re-encoded
            if config.getAudioCodec(tsn) == None:
                audioBPS = config.getMaxAudioBR(tsn) * 1000
            else:
                audioBPS = config.strtod(config.getAudioBR(tsn))
            videoBPS = config.strtod(config.getVideoBR(tsn))
            bitrate = audioBPS + videoBPS
            return int(
                (self.__duration(full_path) / 1000) * (bitrate * 1.02 / 8))