Changeset 089c57291222ea76b1dc0f1aad6c1145989be648
- Timestamp:
- 01/30/08 20:50:23 (10 months ago)
- git-parent:
- Files:
-
- config.py (modified) (1 diff)
- plugins/video/transcode.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
config.py
rb76b923 r089c572 169 169 else: 170 170 return '192k' 171 172 def getAudioCodec(tsn = None):173 #check for HD tivo and return compatible audio parameters174 if tsn and tsn[:3] in getHDtivos():175 return '-acodec ac3 -ar 48000'176 else:177 return '-acodec mp2 -ac 2 -ar 44100'178 171 179 172 def getVideoBR(tsn = None): plugins/video/transcode.py
r6299a29 r089c572 47 47 settings = {} 48 48 settings['audio_br'] = config.getAudioBR(tsn) 49 settings['audio_codec'] = config.getAudioCodec(tsn)49 settings['audio_codec'] = select_audiocodec(inFile, tsn) 50 50 settings['video_br'] = config.getVideoBR(tsn) 51 51 settings['max_video_br'] = config.getMaxVideoBR() … … 63 63 except: 64 64 kill(ffmpeg.pid) 65 65 66 def select_audiocodec(inFile, tsn = ''): 67 #check for HD tivo and return compatible audio parameters 68 type, width, height, fps, millisecs, kbps, akbps, acodec = video_info(inFile) 69 if tsn and tsn[:3] in config.getHDtivos(): 70 if acodec == 'liba52': 71 if (inFile[-4:]).lower() == '.mkv': 72 return '-acodec copy' 73 elif not akbps == None and \ 74 int(akbps) <= config.getMaxAudioBR(tsn): 75 return '-acodec copy' 76 else: 77 return '-acodec ac3 -ar 48000' 78 else: 79 return '-acodec ac3 -ar 48000' 80 else: 81 return '-acodec mp2 -ac 2 -ar 44100' 82 66 83 def select_aspect(inFile, tsn = ''): 67 84 TIVO_WIDTH = config.getTivoWidth(tsn) 68 85 TIVO_HEIGHT = config.getTivoHeight(tsn) 69 86 70 type, width, height, fps, millisecs, kbps, akbps = video_info(inFile)87 type, width, height, fps, millisecs, kbps, akbps, acodec = video_info(inFile) 71 88 72 89 debug_write(['tsn:', tsn, '\n']) … … 213 230 def tivo_compatable(inFile, tsn = ''): 214 231 supportedModes = [[720, 480], [704, 480], [544, 480], [480, 480], [352, 480]] 215 type, width, height, fps, millisecs, kbps, akbps = video_info(inFile)216 #print type, width, height, fps, millisecs, kbps, akbps 232 type, width, height, fps, millisecs, kbps, akbps, acodec = video_info(inFile) 233 #print type, width, height, fps, millisecs, kbps, akbps, acodec 217 234 218 235 if (inFile[-5:]).lower() == '.tivo': … … 261 278 262 279 if (inFile[-5:]).lower() == '.tivo': 263 info_cache[inFile] = (mtime, (True, True, True, True, True, True, True ))280 info_cache[inFile] = (mtime, (True, True, True, True, True, True, True, True)) 264 281 debug_write(['video_info: ', inFile, ' ends in .tivo.\n']) 265 return True, True, True, True, True, True, True 282 return True, True, True, True, True, True, True, True 266 283 267 284 cmd = [FFMPEG, '-i', inFile ] … … 276 293 if ffmpeg.poll() == None: 277 294 kill(ffmpeg.pid) 278 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None ))279 return None, None, None, None, None, None, None 295 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None)) 296 return None, None, None, None, None, None, None, None 280 297 281 298 output = ffmpeg.stderr.read() … … 287 304 codec = x.group(1) 288 305 else: 289 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None ))306 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None)) 290 307 debug_write(['video_info: failed at codec\n']) 291 return None, None, None, None, None, None, None 308 return None, None, None, None, None, None, None, None 292 309 293 310 rezre = re.compile(r'.*Video: .+, (\d+)x(\d+)[, ].*') … … 297 314 height = int(x.group(2)) 298 315 else: 299 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None ))316 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None)) 300 317 debug_write(['video_info: failed at width/height\n']) 301 return None, None, None, None, None, None, None 318 return None, None, None, None, None, None, None, None 302 319 303 320 rezre = re.compile(r'.*Video: .+, (.+) (?:fps|tb).*') … … 306 323 fps = x.group(1) 307 324 else: 308 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None ))325 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None)) 309 326 debug_write(['video_info: failed at fps\n']) 310 return None, None, None, None, None, None, None 327 return None, None, None, None, None, None, None, None 311 328 312 329 # Allow override only if it is mpeg2 and frame rate was doubled to 59.94 … … 351 368 debug_write(['video_info: failed at akbps\n']) 352 369 353 info_cache[inFile] = (mtime, (codec, width, height, fps, millisecs, kbps, akbps)) 354 debug_write(['video_info: Codec=', codec, ' width=', width, ' height=', height, ' fps=', fps, ' millisecs=', millisecs, ' kbps=', kbps, ' akbps=', akbps, '\n']) 355 return codec, width, height, fps, millisecs, kbps, akbps 370 #get audio codec of source for tivo compatibility test. 371 rezre = re.compile(r'.*Audio: ([^,]+),.*') 372 x = rezre.search(output) 373 if x: 374 acodec = x.group(1) 375 else: 376 acodec = None 377 debug_write(['video_info: failed at acodec\n']) 378 379 info_cache[inFile] = (mtime, (codec, width, height, fps, millisecs, kbps, akbps, acodec)) 380 debug_write(['video_info: Codec=', codec, ' width=', width, ' height=', height, ' fps=', fps, ' millisecs=', millisecs, ' kbps=', kbps, ' akbps=', akbps, ' acodec=', acodec, '\n']) 381 return codec, width, height, fps, millisecs, kbps, akbps, acodec 356 382 357 383 def supported_format(inFile):
