From 6e2bdccfe6655be1c4887386a36a0ecc2eb3a519 Mon Sep 17 00:00:00 2001 From: Jason Michalski Date: Sat, 3 Nov 2007 03:10:27 +0000 Subject: [PATCH] Per tivo audio video bitrates --- Config.py | 16 ++++++++++++++-- plugins/video/transcode.py | 9 +++++---- pyTivo.conf | 11 +++++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Config.py b/Config.py index da17e50..3309597 100644 --- a/Config.py +++ b/Config.py @@ -76,13 +76,25 @@ def getTivoWidth(): except NoOptionError: #default return 544 -def getAudioBR(): +def getAudioBR(tsn = None): + if tsn and config.has_section('_tivo_' + tsn): + try: + return config.get('_tivo_' + tsn, 'audio_br') + except NoOptionError: + pass + try: return config.get('Server', 'audio_br') except NoOptionError: #default to 192 return '192K' -def getVideoBR(): +def getVideoBR(tsn = None): + if tsn and config.has_section('_tivo_' + tsn): + try: + return config.get('_tivo_' + tsn, 'video_br') + except NoOptionError: + pass + try: return config.get('Server', 'video_br') except NoOptionError: #default to 4096K diff --git a/plugins/video/transcode.py b/plugins/video/transcode.py index 07e2c3f..a58dfd9 100644 --- a/plugins/video/transcode.py +++ b/plugins/video/transcode.py @@ -7,8 +7,6 @@ info_cache = lrucache.LRUCache(1000) debug = Config.getDebug() TIVO_WIDTH = Config.getTivoWidth() TIVO_HEIGHT = Config.getTivoHeight() -AUDIO_BR = Config.getAudioBR() -VIDEO_BR = Config.getVideoBR() MAX_VIDEO_BR = Config.getMaxVideoBR() BUFF_SIZE = Config.getBuffSize() @@ -48,17 +46,20 @@ def output_video(inFile, outFile, tsn=''): transcode(inFile, outFile, tsn) def transcode(inFile, outFile, tsn=''): + audio_br = Config.getAudioBR(tsn) + video_br = Config.getVideoBR(tsn) + cmd = [ FFMPEG, '-i', inFile, '-vcodec', 'mpeg2video', '-r', '29.97', - '-b', VIDEO_BR, + '-b', video_br, '-maxrate', MAX_VIDEO_BR, '-bufsize', BUFF_SIZE ] + select_aspect(inFile, tsn) + [ '-comment', 'pyTivo.py', '-ac', '2', - '-ab', AUDIO_BR, + '-ab', audio_br, '-ar', '44100', '-f', 'vob', '-' ] diff --git a/pyTivo.conf b/pyTivo.conf index c22384e..5c52bd6 100644 --- a/pyTivo.conf +++ b/pyTivo.conf @@ -5,8 +5,8 @@ port=9032 #Full path to ffmpeg including filename #For windows: ffmpeg=c:\Program Files\pyTivo\plugins\video\ffmpeg_mp2.exe #For linux: ffmpeg=/usr/bin/ffmpeg -ffmpeg=c:\Program Files\pyTivo\plugins\video\ffmpeg_mp2.exe -#ffmpeg=/usr/bin/ffmpeg +#ffmpeg=c:\Program Files\pyTivo\plugins\video\ffmpeg_mp2.exe +ffmpeg=/usr/bin/ffmpeg #This will make a large debug.txt file in you base directory. It only debugs #transcode.py right now. @@ -30,11 +30,14 @@ ffmpeg=c:\Program Files\pyTivo\plugins\video\ffmpeg_mp2.exe ##Per tivo options # section named _tivo_TSN with the tsn in all caps -#[_tivo_2400000DEADBEEF] +[_tivo_00000DEADBEEF] #If you want to use 16:9 or 4:3 on this tivo #aspect169=true +#audio_br=320K +#video_br=12Mi + [MyMovies] #Type can be either 'video' or 'music' type=video @@ -42,7 +45,7 @@ type=video #Path is the full path to your files (No trailing slash needed) #For windows: path=c:\videos #For linux: path=/media -path=/media/media/video +path=/home/armooo/Videos ##You can have more than one share -- 2.11.4.GIT