I've spent several weeks of my free time trying to figure out this issue or search for it to no avail and I'm not sure if it is a Python or Django issue and was wondering if anyone could guide me in the right direction.
I understand uploading video files and querying them, but I am inexperienced in using FFMPEG with Django (specifically converting video to FLV). How do I call the command in Django view to convert the video and how do I do that action in between when the submit button is clicked and when it is saved the video to database.
Thank you for any help! I haven't been able to find any articles/literature on this and its killing me!
You can use subprocess python module to call ffmpeg once the file is uploaded.
import subprocess
subprocess.call('ffmpeg -i video.mp4 video.flv') # check the ffmpeg command line :)
ffmpeg is quite cpu intensive. You should be careful of this point on a real world web app. The subprocess call will block the app until the conversion is done (it may be long in some cases). celery can be a solution for running it as an non-blocking asynchronous task.
There are several apps for video management. I've never used one of them but I think you should have a look to django-multimedia. It seems to be what you are looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With