예제 #1
0
def select_videostr(inFile, tsn, mime=""):
    vInfo = video_info(inFile)
    if tivo_compatible_video(vInfo, tsn, mime)[0]:
        video_str = int(vInfo["kbps"])
        if vInfo["aKbps"]:
            video_str -= int(vInfo["aKbps"])
        video_str *= 1000
    else:
        video_str = config.strtod(config.getVideoBR(tsn))
        if config.isHDtivo(tsn) and vInfo["kbps"]:
            video_str = max(video_str, int(vInfo["kbps"]) * 1000)
        video_str = int(min(config.strtod(config.getMaxVideoBR(tsn)) * 0.95, video_str))
    return video_str
예제 #2
0
def select_videostr(inFile, tsn, mime=''):
    vInfo = video_info(inFile)
    if tivo_compatible_video(vInfo, tsn, mime)[0]:
        video_str = int(vInfo['kbps'])
        if vInfo['aKbps']:
            video_str -= int(vInfo['aKbps'])
        video_str *= 1000
    else:
        video_str = config.strtod(config.getVideoBR(tsn))
        if config.isHDtivo(tsn) and vInfo['kbps']:
            video_str = max(video_str, int(vInfo['kbps']) * 1000)
        video_str = int(
            min(config.strtod(config.getMaxVideoBR(tsn)) * 0.95, video_str))
    return video_str
예제 #3
0
파일: transcode.py 프로젝트: Gimpson/pytivo
def select_videostr(inFile, tsn):
    vInfo = video_info(inFile)
    if tivo_compatible_video(vInfo, tsn)[0]:
        video_str = int(vInfo["kbps"])
        if vInfo["aKbps"]:
            video_str -= int(vInfo["aKbps"])
        video_str *= 1000
    else:
        video_str = config.strtod(config.getVideoBR(tsn))
        if config.isHDtivo(tsn):
            if vInfo["kbps"] != None and config.getVideoPCT(tsn) > 0:
                video_percent = int(vInfo["kbps"]) * 10 * config.getVideoPCT(tsn)
                video_str = max(video_str, video_percent)
        video_str = int(min(config.strtod(config.getMaxVideoBR(tsn)) * 0.95, video_str))
    return video_str
예제 #4
0
파일: video.py 프로젝트: armooo/pytivo
    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))
예제 #5
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))
예제 #6
0
def select_videostr(inFile, tsn):
    vInfo = video_info(inFile)
    if tivo_compatible_video(vInfo, tsn)[0]:
        video_str = int(vInfo['kbps'])
        if vInfo['aKbps']:
            video_str -= int(vInfo['aKbps'])
        video_str *= 1000
    else:
        video_str = config.strtod(config.getVideoBR(tsn))
        if config.isHDtivo(tsn):
            if vInfo['kbps'] != None and config.getVideoPCT(tsn) > 0:
                video_percent = (int(vInfo['kbps']) * 10 *
                                 config.getVideoPCT(tsn))
                video_str = max(video_str, video_percent)
        video_str = int(
            min(config.strtod(config.getMaxVideoBR(tsn)) * 0.95, video_str))
    return video_str
예제 #7
0
def select_videobr(tsn):
    return '-b '+config.getVideoBR(tsn)