Skip to content Skip to sidebar Skip to footer

Encoded Video's Path Gets Changed In Database After Encoding With Ffmpeg And Celery And Works As Normal Without Celery

I have this code to transcode video and it works well without celery. With celery, the path of the file in the database shows a different path and the video cannot be played in the

Solution 1:

You can debug by using print(video.file) to see if the output is <filename>.mp4 or videos/videos/<filename>.mp4. I am skeptical that it will only printout the file name and not the url path, which is what you need.

Some suggestions:

  1. In your template: Change {{ video.file }} to {{ video.file.url }}. See what it prints out.

  2. Your current output_file_path = os.path.join(settings.MEDIA_ROOT, output_file_name) will be something like media/<filename>.mp4. The one you commented out will give output media/videos/videos/<filename>.mp4. I am not sure what your subprocessfunction would do with output_file_path, but you can see if it has any problems in there.


Post a Comment for "Encoded Video's Path Gets Changed In Database After Encoding With Ffmpeg And Celery And Works As Normal Without Celery"