Problem
I am trying to find a way to extract an audio wav file from a mp4 video file that is uploaded by a web user using ffmpeg
using Django.
If I will find to extract audio, then where should I save it in my project?
- I tried it with "Django-ffmpeg", but didn't convert and was stuck in 'pending conversion' message.
Then I tried with:
import subprocess subprocess.call('ffmpeg -i filename.mp4 filename.wav')
Error
Script
def validate_file_extension(value): import os from django.core.exceptions import ValidationError ext = os.path.splitext(value.name)1 # [0] returns path+filename filename = os.path.splitext(value.name)1 # [0] returns path+filename valid_extensions = ['.mp4'] if not ext.lower() in valid_extensions: raise ValidationError(u'Unsupported file extension.') else: import subprocess subprocess.call('ffmpeg -i filename.mp4 filename.wav')