Changeset 179402fc8314937e41ca6f971dfd38847c2d2059

Show
Ignore:
Timestamp:
11/06/07 19:46:53 (1 year ago)
Author:
Jason Michalski <armooo@armooo.net>
git-committer:
Jason Michalski <armooo@armooo.net> 1194400013 +0000
git-parent:

[a5669db9ba0dff76736486bc75e679df460dca36]

git-author:
Jason Michalski <armooo@armooo.net> 1194400013 +0000
Message:

Added support for ffmpeg command templates
Moved dist config

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Config.py

    ra5669db r179402f  
    4141    return config.get(section, key) 
    4242 
     43def getFFMPEGTemplate(tsn): 
     44    if tsn and config.has_section('_tivo_' + tsn): 
     45        try: 
     46            return config.get('_tivo_' + tsn, 'ffmpeg_prams', raw = True) 
     47        except NoOptionError: 
     48            pass 
     49 
     50    try: 
     51        return config.get('Server', 'ffmpeg_prams', raw = True) 
     52    except NoOptionError: #default 
     53        return '-i %(in_file)s -vcodec mpeg2video -r 29.97 -b %(video_br)s -maxrate %(max_video_br)s -bufsize %(buff_size)s %(aspect_ratio)s -comment pyTivo.py -ac 2 -ab %(audio_br)s -ar 44100 -f vob -' 
     54 
    4355def getValidWidths(): 
    4456    return [1440, 720, 704, 544, 480, 352] 
     
    6476    if tsn and config.has_section('_tivo_' + tsn): 
    6577        try: 
    66             return config.get('_tivo_' + tsn, 'height_br') 
     78            height = int(config.get('_tivo_' + tsn, 'height_br')) 
     79            return nearest(height, getValidHeights()) 
    6780        except NoOptionError: 
    6881            pass 
  • plugins/video/transcode.py

    ra5669db r179402f  
    4545 
    4646def transcode(inFile, outFile, tsn=''): 
    47     audio_br = Config.getAudioBR(tsn) 
    48     video_br = Config.getVideoBR(tsn) 
    49  
    50     cmd = [ FFMPEG,  
    51             '-i', inFile,  
    52             '-vcodec', 'mpeg2video',  
    53             '-r', '29.97',  
    54             '-b', video_br, 
    55             '-maxrate', MAX_VIDEO_BR, 
    56             '-bufsize', BUFF_SIZE 
    57           ] + select_aspect(inFile, tsn) + [ 
    58             '-comment', 'pyTivo.py',  
    59             '-ac', '2',  
    60             '-ab', audio_br, 
    61             '-ar', '44100',  
    62             '-f', 'vob',  
    63             '-' ] 
    64  
    65     debug_write(['transcode: ffmpeg command is ', ''.join(cmd), '\n']) 
     47 
     48    settings = {} 
     49    settings['audio_br'] = Config.getAudioBR(tsn) 
     50    settings['video_br'] = Config.getVideoBR(tsn) 
     51    settings['in_file'] = inFile 
     52    settings['max_video_br'] = MAX_VIDEO_BR 
     53    settings['buff_size'] = BUFF_SIZE 
     54    settings['aspect_ratio'] = ' '.join(select_aspect(inFile, tsn)) 
     55 
     56    cmd_string = Config.getFFMPEGTemplate(tsn) % settings 
     57 
     58    cmd = [FFMPEG] + cmd_string.split() 
     59 
     60    debug_write(['transcode: ffmpeg command is ', ' '.join(cmd), '\n']) 
    6661    ffmpeg = subprocess.Popen(cmd, stdout=subprocess.PIPE) 
    6762    try: