Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported video format or file #31

Open
OtchereDev opened this issue Jul 11, 2021 · 3 comments
Open

Unsupported video format or file #31

OtchereDev opened this issue Jul 11, 2021 · 3 comments

Comments

@OtchereDev
Copy link

Hello i am trying to upload a video to cloudinary but i keep getting this error
Traceback (most recent call last): File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner response = get_response(request) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/contrib/admin/options.py", line 614, in wrapper return self.admin_site.admin_view(view)(*args, **kwargs) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view response = view_func(request, *args, **kwargs) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func response = view_func(request, *args, **kwargs) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/contrib/admin/sites.py", line 233, in inner return view(request, *args, **kwargs) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1656, in change_view return self.changeform_view(request, object_id, form_url, extra_context) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/utils/decorators.py", line 43, in _wrapper return bound_method(*args, **kwargs) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/utils/decorators.py", line 130, in _wrapped_view response = view_func(request, *args, **kwargs) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1534, in changeform_view return self._changeform_view(request, object_id, form_url, extra_context) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1580, in _changeform_view self.save_model(request, new_object, form, not add) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/contrib/admin/options.py", line 1093, in save_model obj.save() File "/home/otchere-dev/Desktop/Programming/Django/incompleted projects/udemy_clone/courses/models.py", line 113, in save return super().save(*args, **kwargs) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/db/models/base.py", line 753, in save self.save_base(using=using, force_insert=force_insert, File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/db/models/base.py", line 790, in save_base updated = self._save_table( File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/db/models/base.py", line 869, in _save_table values = [(f, None, (getattr(self, f.attname) if raw else f.pre_save(self, False))) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/db/models/base.py", line 869, in <listcomp> values = [(f, None, (getattr(self, f.attname) if raw else f.pre_save(self, False))) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/db/models/fields/files.py", line 307, in pre_save file.save(file.name, file.file, save=False) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/db/models/fields/files.py", line 87, in save self.name = self.storage.save(name, content, max_length=self.field.max_length) File "/home/otchere-dev/.local/lib/python3.8/site-packages/django/core/files/storage.py", line 52, in save return self._save(name, content) File "/home/otchere-dev/.local/lib/python3.8/site-packages/cloudinary_storage/storage.py", line 68, in _save response = self._upload(name, content) File "/home/otchere-dev/.local/lib/python3.8/site-packages/cloudinary_storage/storage.py", line 62, in _upload return cloudinary.uploader.upload(content, **options) File "/home/otchere-dev/.local/lib/python3.8/site-packages/cloudinary/uploader.py", line 46, in upload return call_cacheable_api("upload", params, file=file, **options) File "/home/otchere-dev/.local/lib/python3.8/site-packages/cloudinary/uploader.py", line 394, in call_cacheable_api result = call_api(action, params, http_headers, return_error, unsigned, file, timeout, **options) File "/home/otchere-dev/.local/lib/python3.8/site-packages/cloudinary/uploader.py", line 477, in call_api raise Error(result["error"]["message"]) cloudinary.exceptions.Error: Unsupported video format or file

Below is the model
class Episode(models.Model): title=models.CharField(max_length=225) file=models.FileField(upload_to='courses',validators=[validate_video],storage=VideoMediaCloudinaryStorage()) length=models.DecimalField(max_digits=100,decimal_places=2)

Screenshot from 2021-07-11 19-36-20

When i try uploading the same video as a rawfile it works but i can play it in the browser and also image uploading aslo works perfectly.

Please any help would be really be appreciated. Thank you

@klis87
Copy link
Owner

klis87 commented Jul 22, 2021

Does it happen only for a specific file or for any video file?
Does it work for you for https://github.com/klis87/django-cloudinary-storage/blob/master/tests/dummy-files/dummy-video.mp4 ?

@OtchereDev
Copy link
Author

Any video file please

@klis87
Copy link
Owner

klis87 commented Jul 22, 2021

It is very hard to help you without any additional info. I can see Unsupported video format or file error, but you say it is for any file. It would be very weird if that was the case, otherwise many people would complain about it.

There is only 1 thing which I noticed, you use FileField while in docs you can see ImageField should be used, maybe thats the culprit? See https://github.com/klis87/django-cloudinary-storage#usage-with-video-files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants