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:
In your
template
: Change{{ video.file }}
to{{ video.file.url }}
. See what it prints out.Your current
output_file_path = os.path.join(settings.MEDIA_ROOT, output_file_name)
will be something likemedia/<filename>.mp4
. The one you commented out will give outputmedia/videos/videos/<filename>.mp4
. I am not sure what yoursubprocess
function would do withoutput_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"