Vp9 fixes (#438)

* Fix fo ffprobe appending pipe
* Fix media remains pending when only encoding to webm
This commit is contained in:
DecaTec 2022-06-01 12:42:35 +02:00 committed by GitHub
parent 0f182c2b15
commit 3e7b106482
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 5 deletions

View File

@ -443,7 +443,8 @@ def media_file_info(input_file):
input_file, input_file,
] ]
stdout = run_command(cmd).get("out") stdout = run_command(cmd).get("out")
stream_size = sum([int(line) for line in stdout.split("\n") if line != ""]) # ffprobe appends a pipe at the end of the output, thus we have to remove it
stream_size = sum([int(line.replace("|", "")) for line in stdout.split("\n") if line != ""])
audio_bitrate = round((stream_size * 8 / 1024.0) / audio_duration, 2) audio_bitrate = round((stream_size * 8 / 1024.0) / audio_duration, 2)
ret.update( ret.update(

View File

@ -637,15 +637,16 @@ class Media(models.Model):
def set_encoding_status(self): def set_encoding_status(self):
"""Set encoding_status for videos """Set encoding_status for videos
Set success if at least one mp4 exists Set success if at least one mp4 or webm exists
""" """
mp4_statuses = set(encoding.status for encoding in self.encodings.filter(profile__extension="mp4", chunk=False)) mp4_statuses = set(encoding.status for encoding in self.encodings.filter(profile__extension="mp4", chunk=False))
webm_statuses = set(encoding.status for encoding in self.encodings.filter(profile__extension="webm", chunk=False))
if not mp4_statuses: if not mp4_statuses and not webm_statuses:
encoding_status = "pending" encoding_status = "pending"
elif "success" in mp4_statuses: elif "success" in mp4_statuses or "success" in webm_statuses:
encoding_status = "success" encoding_status = "success"
elif "running" in mp4_statuses: elif "running" in mp4_statuses or "running" in webm_statuses:
encoding_status = "running" encoding_status = "running"
else: else:
encoding_status = "fail" encoding_status = "fail"