forked from 0x2620/pandora
fix remux
This commit is contained in:
parent
de818c4204
commit
4794c0f68a
2 changed files with 14 additions and 6 deletions
|
@ -733,19 +733,24 @@ def remux_stream(src, dst):
|
||||||
cmd = [
|
cmd = [
|
||||||
settings.FFMPEG,
|
settings.FFMPEG,
|
||||||
'-nostats', '-loglevel', 'error',
|
'-nostats', '-loglevel', 'error',
|
||||||
'-map_metadata', '-1', '-sn',
|
|
||||||
'-i', src,
|
'-i', src,
|
||||||
|
'-map_metadata', '-1', '-sn',
|
||||||
] + video + [
|
] + video + [
|
||||||
] + audio + [
|
] + audio + [
|
||||||
'-movflags', '+faststart',
|
'-movflags', '+faststart',
|
||||||
dst
|
dst
|
||||||
]
|
]
|
||||||
|
print(cmd)
|
||||||
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
p = subprocess.Popen(cmd, stdin=subprocess.PIPE,
|
||||||
stdout=open('/dev/null', 'w'),
|
stdout=subprocess.PIPE,
|
||||||
stderr=open('/dev/null', 'w'),
|
stderr=subprocess.STDOUT,
|
||||||
close_fds=True)
|
close_fds=True)
|
||||||
p.wait()
|
stdout, stderr = p.communicate()
|
||||||
return True, None
|
if stderr:
|
||||||
|
logger.error("failed to remux %s %s", cmd, stderr)
|
||||||
|
return False, stderr
|
||||||
|
else:
|
||||||
|
return True, None
|
||||||
|
|
||||||
|
|
||||||
def ffprobe(path, *args):
|
def ffprobe(path, *args):
|
||||||
|
|
|
@ -821,7 +821,10 @@ class Stream(models.Model):
|
||||||
done = True
|
done = True
|
||||||
elif self.file.can_remux():
|
elif self.file.can_remux():
|
||||||
ok, error = extract.remux_stream(media, target)
|
ok, error = extract.remux_stream(media, target)
|
||||||
done = True
|
if ok:
|
||||||
|
self.available = True
|
||||||
|
self.save()
|
||||||
|
done = True
|
||||||
if not done:
|
if not done:
|
||||||
ok, error = extract.stream(media, target, self.name(), info, flags=self.flags)
|
ok, error = extract.stream(media, target, self.name(), info, flags=self.flags)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue