I remember this question from... february I think, what's changed since
then?

On Tue, Jul 14, 2015 at 3:29 PM, Robin Lery <[email protected]> wrote:

> I would like to convert video into mp4 using ffmpeg and celery for the
> asynchronous task. When user uploads a video, it will be for the
> original_video and save it. After that I want celery to convert it into a
> different version for the mp4_720 field. However I am confused on how to
> apply that logic using celery.
>
> app.models.py:
>
>     class Video(models.Model):
>         title = models.CharField(max_length=75)
>         pubdate = models.DateTimeField(default=timezone.now)
>         original_video = models.FileField(upload_to=get_upload_file_name)
>         mp4_720 = models.FileField(upload_to=get_upload_file_name,
> blank=True, null=True)
>         converted = models.BooleanField(default=False)
>
> app.views.py:
>
>     def upload_video(request):
>         if request.POST:
>             form = VideoForm(request.POST, request.FILES)
>             if form.is_valid():
>                 video = form.save(commit=False)
>                 video.save()
>
>                 // Celery to convert the video
>                 convert_video.delay(video)
>
>                 return HttpResponseRedirect('/')
>         else:
>             form = VideoForm()
>         return render(request, 'upload_video.html', {
>             'form':form
>         })
>
> app.tasks.py:
>
>     @app.task
>     def convert_video(video):
>
>         // Convert the original video into required format and save it in
> the mp4_720 field using the following command:
>         //subprocess.call('ffmpeg -i (path of the original_video) (video
> for mp4_720)')
>
>         // Change the converted boolean field to True
>
>         // Save
>
> Basically my question is how to save the converted video in mp4_720. Your
> help and guidance will be very much appreciated. Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CA%2B4-nGrKucaFSi7oZoOcHtOXdSsnPEac2_LXLZ2TccRCaWUhzA%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CA%2B4-nGrKucaFSi7oZoOcHtOXdSsnPEac2_LXLZ2TccRCaWUhzA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CALn3ei3nZcbL5REM75Q1DVgoQud5oUMf%3Dhv3qLxuzJT1EiJ4wg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to