h265 nutzen

This commit is contained in:
Stefan Bethke 2017-04-12 17:14:24 +00:00
parent 3502c39827
commit d74bf803a1
2 changed files with 41 additions and 14 deletions

View file

@ -1,6 +1,6 @@
#!/usr/local/bin/python
# $Schlepperbande: src/tivomirror/tivomirror,v 1.68 2015/02/28 21:03:03 stb Exp $
# $Schlepperbande: src/tivomirror/tivomirror,v 1.69 2015/09/05 11:56:07 stb Exp $
#
# Stefans Script, um die Sendungen vom Tivo runterzuladen und in MPEG4
# zu transkodieren.
@ -43,32 +43,44 @@ ignoreepisodetitle = False
arset = dict()
includes = dict()
includes['Anthony Bourdain Parts Unknown'] = 1
includes['Better Call Saul'] = 1
includes['Brooklyn Nine-Nine'] = 1
includes['Castle'] = 1
#includes['Conan'] = 1
includes['Bull'] = 1
includes['College Football'] = 1
includes['Conan'] = 1
includes["Dirk Gently's Holistic Detective Agency"] = 1
includes['The Expanse'] = 1
includes['Family Guy'] = 1
includes['Full Frontal With Samantha Bee'] = 1
includes['Hot in Cleveland'] = 1
includes["How It's Made"] = 1
includes["How Do They Do It?"] = 1
includes["How We Got to Now With Steven Johnson"] = 1
includes['Inside Amy Schumer'] = 1
includes['Join or Die With Craig Ferguson'] = 1
includes['Last Week Tonight With John Oliver'] = 1
includes['Late Show With David Letterman'] = 1
includes['Louie'] = 1
includes['Mad Men'] = 1
includes['Modern Family'] = 1
includes['MythBusters'] = 1
includes['MythBusters: The Search'] = 1
includes['NCIS'] = 1
includes['NFL Football'] = 1
includes['NCIS: New Orleans'] = 1
#includes['NFL Football'] = 1
includes['Person of Interest'] = 1
includes['Saturday Night Live'] = 1
includes['Sesame Street'] = 1
includes["Somebody's Gotta Do It With Mike Rowe"] = 1
includes['StarTalk'] = 1
includes['The Big Bang Theory'] = 1
includes['The Good Wife'] = 1
includes['The Daily Show With Trevor Noah'] = 1
includes['The Late Show With Stephen Colbert'] = 1
#includes['The Late Late Show With James Corden'] = 1
includes['The Muppets'] = 1
includes['The X-Files'] = 1
#includes['The Tonight Show Starring Jimmy Fallon'] = 1
includes['2015 National Championship'] = 1
logger = logging.getLogger('tivomirror')
@ -118,6 +130,9 @@ def timeout(seconds=10, error_message=os.strerror(errno.ETIMEDOUT)):
def trimDescription(desc):
desc = desc.strip()
i = desc.rfind(". Copyright Tribune Media Services, Inc.");
if i > 0:
desc = desc[0:i]
i = desc.rfind(". * Copyright Rovi, Inc");
if i > 0:
desc = desc[0:i]
if len(desc) > 80:
@ -474,9 +489,8 @@ def mirror(toc, downloaddb, one=False):
def download_episode(toc, downloaddb, episode):
items = toc.dom.getElementsByTagName("Item")
for node in items:
item = TivoItem(node)
items = toc.getItems()
for item in items:
if item.title == episode or item.name == episode or item.episode == episode:
download_one(item, downloaddb)

View file

@ -6,7 +6,11 @@ import subprocess
import sys
format = 5
def transcode(src, tgt, fmt):
global format
transcode_opts = [ "ffmpeg" ];
#transcode_opts = [ "ffmpeg-devel" ];
#transcode_opts.extend(["-t", "240"]) # testing only
@ -17,9 +21,11 @@ def transcode(src, tgt, fmt):
transcode_opts.extend(["-y", "-deinterlace"])
#transcode_opts.extend(["-ac", "2", "-ab", "128k"])
transcode_opts.extend(["-c:a", "libfdk_aac", "-ab", "192k"])
if format == 5:
transcode_opts.extend(["-vcodec", "libx265", "-x265-params", "crf=28"])
#transcode_opts.extend(["-vcodec", "libx264"])
#transcode_opts.extend(["-tune", "film", "-profile", "main"])
else:
transcode_opts.extend(["-vcodec", "libx264"])
transcode_opts.extend(["-tune", "film", "-profile", "main"])
if fmt == "hd":
transcode_opts.extend(["-s", "1280x720"])
#transcode_opts.extend(["-b:v", "3000k"])
@ -59,6 +65,7 @@ def getInfo(src):
for l in err.split("\n"):
if l.find("Stream #") >=0:
w = l.split()
print w
if w[2] == "Audio:":
c.extend(["a"])
elif w[2] == "Video:":
@ -75,20 +82,26 @@ class Usage(Exception):
def main(argv=None):
global format
if argv is None:
argv = sys.argv
try:
try:
opts, args = getopt.getopt(argv[1:], "hi:", ["help"])
opts, args = getopt.getopt(argv[1:], "hi:45", ["help"])
except getopt.error, msg:
raise Usage(msg)
for (o, v) in opts:
print "%s" % (o)
if o == "-h":
print >>sys.stderr, "help text"
return 0
if o == "-i":
print getInfo(v)
return 0
if o == "-4":
format = 4
if o == "-5":
format = 5
if len(args) != 3:
raise Usage("wrong number of arguments")
transcode(args[1], args[2], args[0])