audio only

This commit is contained in:
j 2011-02-23 12:55:40 +01:00
parent a6a685f532
commit d72cd7a5e6
2 changed files with 30 additions and 24 deletions

View file

@ -29,9 +29,10 @@ def encode(filename, prefix, profile):
return None return None
oshash = info['oshash'] oshash = info['oshash']
frames = [] frames = []
cache = os.path.join(prefix, os.path.join(*utils.hash_prefix(oshash)))
if info['video']:
for pos in utils.video_frame_positions(info['duration']): for pos in utils.video_frame_positions(info['duration']):
frame_name = '%s.png' % pos frame_name = '%s.png' % pos
cache = os.path.join(prefix, os.path.join(*utils.hash_prefix(oshash)))
frame_f = os.path.join(cache, frame_name) frame_f = os.path.join(cache, frame_name)
if not os.path.exists(frame_f): if not os.path.exists(frame_f):
print frame_f print frame_f

View file

@ -58,7 +58,9 @@ def video(video, target, profile, info):
if not os.path.exists(fdir): if not os.path.exists(fdir):
os.makedirs(fdir) os.makedirs(fdir)
if info['video']:
dar = AspectRatio(info['video'][0]['display_aspect_ratio']) dar = AspectRatio(info['video'][0]['display_aspect_ratio'])
''' '''
look into look into
lag lag
@ -68,7 +70,6 @@ def video(video, target, profile, info):
token_partitions=4 token_partitions=4
level / speedlevel level / speedlevel
bt? bt?
''' '''
profile, format = profile.split('.') profile, format = profile.split('.')
@ -109,6 +110,7 @@ def video(video, target, profile, info):
audiochannels = 1 audiochannels = 1
bpp = 0.17 bpp = 0.17
if info['video']:
fps = AspectRatio(info['video'][0]['framerate']) fps = AspectRatio(info['video'][0]['framerate'])
width = int(dar * height) width = int(dar * height)
@ -120,6 +122,15 @@ def video(video, target, profile, info):
if abs(width/height - dar) < 0.02: if abs(width/height - dar) < 0.02:
aspect = '%s:%s' % (width, height) aspect = '%s:%s' % (width, height)
video_settings = [
'-vb', '%dk'%bitrate, '-g', '%d' % int(fps*2),
'-s', '%dx%d'%(width, height),
'-aspect', aspect,
'-vf', 'yadif',
]
else:
video_settings = ['-vn']
if info['audio']: if info['audio']:
audio_settings = ['-ar', str(audiorate), '-aq', str(audioquality)] audio_settings = ['-ar', str(audiorate), '-aq', str(audioquality)]
if audiochannels and 'channels' in info['audio'][0] and info['audio'][0]['channels'] > audiochannels: if audiochannels and 'channels' in info['audio'][0] and info['audio'][0]['channels'] > audiochannels:
@ -130,12 +141,6 @@ def video(video, target, profile, info):
else: else:
audio_settings = ['-an'] audio_settings = ['-an']
video_settings = [
'-vb', '%dk'%bitrate, '-g', '%d' % int(fps*2),
'-s', '%dx%d'%(width, height),
'-aspect', aspect,
'-vf', 'yadif',
]
cmd = ['ffmpeg', '-y', '-threads', '2', '-i', video] \ cmd = ['ffmpeg', '-y', '-threads', '2', '-i', video] \
+ audio_settings \ + audio_settings \
+ video_settings \ + video_settings \