Compare commits
No commits in common. "7e8f3c4e507905a76f6dda32b7ceefcf1bad185b" and "31b98d070752592faf8a833c3525850a8a42aa24" have entirely different histories.
7e8f3c4e50
...
31b98d0707
2 changed files with 11 additions and 31 deletions
|
|
@ -308,7 +308,6 @@ def stream(video, target, profile, info, audio_track=0, flags={}):
|
||||||
cmds = []
|
cmds = []
|
||||||
|
|
||||||
base = [settings.FFMPEG,
|
base = [settings.FFMPEG,
|
||||||
'-hide_banner',
|
|
||||||
'-nostats', '-loglevel', 'error',
|
'-nostats', '-loglevel', 'error',
|
||||||
'-y', '-i', video, '-threads', '4', '-map_metadata', '-1', '-sn']
|
'-y', '-i', video, '-threads', '4', '-map_metadata', '-1', '-sn']
|
||||||
|
|
||||||
|
|
@ -414,9 +413,7 @@ def frame(video, frame, position, height=128, redo=False, info=None):
|
||||||
|
|
||||||
def ffmpeg_frame_cmd(video, frame, position, height=128):
|
def ffmpeg_frame_cmd(video, frame, position, height=128):
|
||||||
cmd = [
|
cmd = [
|
||||||
settings.FFMPEG,
|
settings.FFMPEG, '-y',
|
||||||
'-hide_banner',
|
|
||||||
'-y',
|
|
||||||
'-ss', str(position),
|
'-ss', str(position),
|
||||||
'-i', video,
|
'-i', video,
|
||||||
'-an', '-frames:v', '1',
|
'-an', '-frames:v', '1',
|
||||||
|
|
@ -699,7 +696,6 @@ def chop(video, start, end, subtitles=None, dest=None, encode=False):
|
||||||
]
|
]
|
||||||
cmd = [
|
cmd = [
|
||||||
settings.FFMPEG,
|
settings.FFMPEG,
|
||||||
'-hide_banner',
|
|
||||||
'-y',
|
'-y',
|
||||||
'-i', video,
|
'-i', video,
|
||||||
'-ss', '%.3f' % start,
|
'-ss', '%.3f' % start,
|
||||||
|
|
@ -725,11 +721,7 @@ def chop(video, start, end, subtitles=None, dest=None, encode=False):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def has_faststart(path):
|
def has_faststart(path):
|
||||||
cmd = [
|
cmd = [settings.FFPROBE, '-v', 'trace', '-i', path]
|
||||||
settings.FFPROBE,
|
|
||||||
'-hide_banner',
|
|
||||||
'-v', 'trace', '-i', path
|
|
||||||
]
|
|
||||||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.STDOUT,
|
stderr=subprocess.STDOUT,
|
||||||
|
|
@ -754,7 +746,6 @@ def remux_stream(src, dst):
|
||||||
video = []
|
video = []
|
||||||
cmd = [
|
cmd = [
|
||||||
settings.FFMPEG,
|
settings.FFMPEG,
|
||||||
'-hide_banner',
|
|
||||||
'-nostats', '-loglevel', 'error',
|
'-nostats', '-loglevel', 'error',
|
||||||
'-i', src,
|
'-i', src,
|
||||||
'-map_metadata', '-1', '-sn',
|
'-map_metadata', '-1', '-sn',
|
||||||
|
|
@ -777,11 +768,7 @@ def remux_stream(src, dst):
|
||||||
|
|
||||||
|
|
||||||
def ffprobe(path, *args):
|
def ffprobe(path, *args):
|
||||||
cmd = [
|
cmd = [settings.FFPROBE, '-loglevel', 'error', '-print_format', 'json', '-i', path] + list(args)
|
||||||
settings.FFPROBE,
|
|
||||||
'-hide_banner',
|
|
||||||
'-loglevel', 'error', '-print_format', 'json', '-i', path
|
|
||||||
] + list(args)
|
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
return json.loads(stdout.decode())
|
return json.loads(stdout.decode())
|
||||||
|
|
@ -829,11 +816,7 @@ def extract_subtitles(path, language=None):
|
||||||
extra = ['-map', '0:%s' % track[0]['index']]
|
extra = ['-map', '0:%s' % track[0]['index']]
|
||||||
else:
|
else:
|
||||||
raise Exception("unknown language: %s" % language)
|
raise Exception("unknown language: %s" % language)
|
||||||
cmd = [
|
cmd = ['ffmpeg', '-loglevel', 'error', '-i', path] + extra + ['-f', 'srt', '-']
|
||||||
settings.FFMPEG,
|
|
||||||
'-hide_banner',
|
|
||||||
'-loglevel', 'error', '-i', path
|
|
||||||
] + extra + ['-f', 'srt', '-']
|
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
return ox.srt.loads(stdout.decode())
|
return ox.srt.loads(stdout.decode())
|
||||||
|
|
|
||||||
|
|
@ -150,17 +150,14 @@ def extract_clip(public_id, in_, out, resolution, format, track=None):
|
||||||
def clear_cache(days=60):
|
def clear_cache(days=60):
|
||||||
import subprocess
|
import subprocess
|
||||||
path = os.path.join(settings.MEDIA_ROOT, 'media')
|
path = os.path.join(settings.MEDIA_ROOT, 'media')
|
||||||
if os.path.exists(path):
|
cmd = ['find', path, '-iregex', '.*/frames/.*', '-atime', '+%s' % days, '-type', 'f', '-exec', 'rm', '{}', ';']
|
||||||
cmd = ['find', path, '-iregex', '.*/frames/.*', '-atime', '+%s' % days, '-type', 'f', '-exec', 'rm', '{}', ';']
|
subprocess.check_output(cmd)
|
||||||
subprocess.check_output(cmd)
|
path = os.path.join(settings.MEDIA_ROOT, 'items')
|
||||||
if os.path.exists(path):
|
cmd = ['find', path, '-iregex', '.*/cache/.*', '-atime', '+%s' % days, '-type', 'f', '-exec', 'rm', '{}', ';']
|
||||||
path = os.path.join(settings.MEDIA_ROOT, 'items')
|
subprocess.check_output(cmd)
|
||||||
cmd = ['find', path, '-iregex', '.*/cache/.*', '-atime', '+%s' % days, '-type', 'f', '-exec', 'rm', '{}', ';']
|
|
||||||
subprocess.check_output(cmd)
|
|
||||||
path = settings.MEDIA_ROOT
|
path = settings.MEDIA_ROOT
|
||||||
if os.path.exists(path):
|
cmd = ['find', path, '-type', 'd', '-size', '0', '-prune', '-exec', 'rmdir', '{}', ';']
|
||||||
cmd = ['find', path, '-type', 'd', '-size', '0', '-prune', '-exec', 'rmdir', '{}', ';']
|
subprocess.check_output(cmd)
|
||||||
subprocess.check_output(cmd)
|
|
||||||
|
|
||||||
|
|
||||||
@app.task(ignore_results=True, queue='default')
|
@app.task(ignore_results=True, queue='default')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue