Autodetect format when transcoding files
This commit is contained in:
parent
3e62f8b361
commit
7f42c1ad44
4 changed files with 24 additions and 3 deletions
|
|
@ -855,8 +855,7 @@ class Upload(models.Model):
|
|||
if not input:
|
||||
return
|
||||
|
||||
input_format = utils.MIMETYPE_TO_EXTENSION[self.mimetype]
|
||||
audio = pydub.AudioSegment.from_file(input, format=input_format)
|
||||
audio = pydub.AudioSegment.from_file(input)
|
||||
return audio
|
||||
|
||||
def save(self, **kwargs):
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ def get_actor_from_request(request):
|
|||
return actor
|
||||
|
||||
|
||||
def transcode_file(input, output, input_format, output_format, **kwargs):
|
||||
def transcode_file(input, output, input_format=None, output_format="mp3", **kwargs):
|
||||
with input.open("rb"):
|
||||
audio = pydub.AudioSegment.from_file(input, format=input_format)
|
||||
return transcode_audio(audio, output, output_format, **kwargs)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue