Changeset a567b71819c8005b304615b039ff22c5447c7a3e
- Timestamp:
- 02/09/08 19:00:07 (1 year ago)
- git-parent:
[d4def89a0aa71b415b52c96b310cbe0802aecc00], [6b0c52dd637213034d4c3edb7b4b8d286510ba46]
- Files:
-
- config.py (modified) (1 diff)
- plugins/video/transcode.py (modified) (10 diffs)
- pyTivo.conf.dist (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
config.py
rd4def89 ra567b71 99 99 return config.get('Server', 'ffmpeg_prams', raw=True) 100 100 except NoOptionError: #default 101 return '-vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py %(audio_codec)s -ab %(audio_br)s -copyts -f vob -'101 return '-vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py -ab %(audio_br)s %(audio_fr)s %(audio_codec)s -f vob -' 102 102 103 103 def isHDtivo(tsn): # tsn's of High Definition Tivo's plugins/video/transcode.py
r8edc3cb r6b0c52d 47 47 settings['audio_br'] = config.getAudioBR(tsn) 48 48 settings['audio_codec'] = select_audiocodec(inFile, tsn) 49 settings['audio_fr'] = select_audiofr(inFile) 49 50 settings['video_br'] = config.getVideoBR(tsn) 50 51 settings['max_video_br'] = config.getMaxVideoBR() … … 65 66 def select_audiocodec(inFile, tsn = ''): 66 67 # Default, compatible with all TiVo's 67 codec = '-acodec mp2 -ac 2 -ar 44100'68 type, width, height, fps, millisecs, kbps, akbps, acodec = video_info(inFile)68 codec = '-acodec mp2 -ac 2' 69 type, width, height, fps, millisecs, kbps, akbps, acodec, afreq = video_info(inFile) 69 70 if akbps == None and acodec in ('liba52', 'mp2'): 70 71 cmd_string = '-y -vcodec mpeg2video -r 29.97 -b 1000k -acodec copy -t 00:00:01 -f vob -' 71 72 if video_check(inFile, cmd_string): 72 type, width, height, fps, millisecs, kbps, akbps, acodec = video_info(videotest)73 type, width, height, fps, millisecs, kbps, akbps, acodec, afreq = video_info(videotest) 73 74 if config.isHDtivo(tsn): 74 75 # Is HD Tivo, use ac3 75 codec = '-acodec ac3 -ar 48000'76 codec = '-acodec ac3' 76 77 if acodec == 'liba52' and not akbps == None and \ 77 78 int(akbps) <= config.getMaxAudioBR(tsn): … … 84 85 return codec 85 86 87 def select_audiofr(inFile): 88 freq = '-ar 48000' #default 89 type, width, height, fps, millisecs, kbps, akbps, acodec, afreq = video_info(inFile) 90 if not afreq == None and afreq in ('44100', '48000'): 91 # compatible frequency 92 freq = '-ar ' + afreq 93 return freq 94 86 95 def select_aspect(inFile, tsn = ''): 87 96 TIVO_WIDTH = config.getTivoWidth(tsn) 88 97 TIVO_HEIGHT = config.getTivoHeight(tsn) 89 98 90 type, width, height, fps, millisecs, kbps, akbps, acodec = video_info(inFile)99 type, width, height, fps, millisecs, kbps, akbps, acodec, afreq = video_info(inFile) 91 100 92 101 debug_write(['tsn:', tsn, '\n']) … … 233 242 def tivo_compatable(inFile, tsn = ''): 234 243 supportedModes = [[720, 480], [704, 480], [544, 480], [480, 480], [352, 480]] 235 type, width, height, fps, millisecs, kbps, akbps, acodec = video_info(inFile)244 type, width, height, fps, millisecs, kbps, akbps, acodec, afreq = video_info(inFile) 236 245 #print type, width, height, fps, millisecs, kbps, akbps, acodec 237 246 … … 282 291 283 292 if (inFile[-5:]).lower() == '.tivo': 284 info_cache[inFile] = (mtime, (True, True, True, True, True, True, True, True ))293 info_cache[inFile] = (mtime, (True, True, True, True, True, True, True, True, True)) 285 294 debug_write(['video_info: ', inFile, ' ends in .tivo.\n']) 286 return True, True, True, True, True, True, True, True 295 return True, True, True, True, True, True, True, True, True 287 296 288 297 cmd = [FFMPEG, '-i', inFile ] … … 297 306 if ffmpeg.poll() == None: 298 307 kill(ffmpeg.pid) 299 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None ))300 return None, None, None, None, None, None, None, None 308 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None, None)) 309 return None, None, None, None, None, None, None, None, None 301 310 302 311 output = ffmpeg.stderr.read() … … 308 317 codec = x.group(1) 309 318 else: 310 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None ))319 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None, None)) 311 320 debug_write(['video_info: failed at codec\n']) 312 return None, None, None, None, None, None, None, None 321 return None, None, None, None, None, None, None, None, None 313 322 314 323 rezre = re.compile(r'.*Video: .+, (\d+)x(\d+)[, ].*') … … 318 327 height = int(x.group(2)) 319 328 else: 320 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None ))329 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None, None)) 321 330 debug_write(['video_info: failed at width/height\n']) 322 return None, None, None, None, None, None, None, None 331 return None, None, None, None, None, None, None, None, None 323 332 324 333 rezre = re.compile(r'.*Video: .+, (.+) (?:fps|tb).*') … … 327 336 fps = x.group(1) 328 337 else: 329 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None ))338 info_cache[inFile] = (mtime, (None, None, None, None, None, None, None, None, None)) 330 339 debug_write(['video_info: failed at fps\n']) 331 return None, None, None, None, None, None, None, None 340 return None, None, None, None, None, None, None, None, None 332 341 333 342 # Allow override only if it is mpeg2 and frame rate was doubled to 59.94 … … 381 390 debug_write(['video_info: failed at acodec\n']) 382 391 383 info_cache[inFile] = (mtime, (codec, width, height, fps, millisecs, kbps, akbps, acodec)) 384 debug_write(['video_info: Codec=', codec, ' width=', width, ' height=', height, ' fps=', fps, ' millisecs=', millisecs, ' kbps=', kbps, ' akbps=', akbps, ' acodec=', acodec, '\n']) 385 return codec, width, height, fps, millisecs, kbps, akbps, acodec 392 #get audio frequency of source for tivo compatibility test. 393 rezre = re.compile(r'.*Audio: .+, (.+) (?:Hz).*') 394 x = rezre.search(output) 395 if x: 396 afreq = x.group(1) 397 else: 398 afreq = None 399 debug_write(['video_info: failed at afreq\n']) 400 401 info_cache[inFile] = (mtime, (codec, width, height, fps, millisecs, kbps, akbps, acodec, afreq)) 402 debug_write(['video_info: Codec=', codec, ' width=', width, ' height=', height, ' fps=', fps, ' millisecs=', millisecs, ' kbps=', kbps, ' akbps=', akbps, ' acodec=', acodec, ' afreq=', afreq, '\n']) 403 return codec, width, height, fps, millisecs, kbps, akbps, acodec, afreq 386 404 387 405 def video_check(inFile, cmd_string): pyTivo.conf.dist
r8edc3cb r6b0c52d 43 43 #width=1280 44 44 #height=720 45 #ffmpeg_prams=-vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py %(audio_codec)s -ab %(audio_br)s -copyts -f vob -45 #ffmpeg_prams=-vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py -ab %(audio_br)s %(audio_fr)s %(audio_codec)s -f vob - 46 46 47 47 # Per tivo options … … 56 56 #audio_br=320K 57 57 #video_br=12Mi 58 #ffmpeg_prams=-vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py %(audio_codec)s -ab %(audio_br)s -copyts -f vob -58 #ffmpeg_prams=-vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py -ab %(audio_br)s %(audio_fr)s %(audio_codec)s -f vob - 59 59 60 60 [MyMovies]
