Answer the question
In order to leave comments, you need to log in
How to trigger "generation" of other video formats in django-videokit?
Decided to use the django-videokit ( git )
battery for a small Python/Django project . And in general, it almost worked for me. But it is not clear why the creation (conversion) of the source video to other formats does not occur. Django-videokit should launch the ffmpeg utility through Celery and “cook” video files of the required formats ( .mp4 , .ogg and .webm ). Links to these files will appear in the corresponding fields VideoSpecField
.
In models.py, everything is almost like in the documentation:
from videokit.models import VideoField, VideoSpecField
from my_project import settings
class tbVideoItems(models.Model):
szVideoName = VideoField(
upload_to = settings.PATH_FOR_VIDEO,
null = True,
blank = True,
width_field = 'iVideoWidth',
height_field = 'iVideoHeight',
rotation_field = 'fVideoRotation',
mimetype_field = 'szVideoMimetype',
duration_field = 'iVideoDuration',
thumbnail_field = 'imgVideoThumbnail'
)
iVideoWidth = models.IntegerField(null = True, blank = True)
iVideoHeight = models.IntegerField(null = True, blank = True)
fVideoRotation = models.FloatField(null = True, blank = True)
szVideoMimetype = models.CharField(max_length = 32, null = True, blank = True)
iVideoDuration = models.IntegerField(null = True, blank = True)
imgVideoThumbnail = models.ImageField(null = True, blank = True)
szVideoName_ogg = VideoSpecField(source = 'szVideoName', format = 'ogg')
szVideoName_webm = VideoSpecField(source = 'szVideoName', format = 'webm')
class Meta:
verbose_name = u"Видео-ролик"
verbose_name_plural = u"Видео-ролики"
ordering = ['szVideoName']
VideoSpecField
( szVideoName_mp4 , szVideoName_ogg and szVideoName_webm ) remain empty. We need to start generating. To do this, in views.py
(for example) we write. something like:# ...
qVideos = tbVideoItems.objects.all()
for i in qVideos:
if i.szVideoName_ogg == "":
i.szVideoName_ogg.generate()
# ...
# ...
views.py
, you can see that szVideoName_ogg has a value. When viewing field values (via the admin panel or via print i.szVideoName_ogg
), the values change. For example: $ ls -l
-rw------- 1 web web 69537154 фев 27 17:05 Futurama-S7E07.mp4
-rw-r--r-- 1 web web 13053 фев 27 17:05 Futurama-S7E07.mp4.thumb.jpg
task.py
a description of creating a process for converting and creating a file:process = subprocess.Popen(
['ffmpeg', '-i', source_file, '-y'] + options + [temp_file])
requirements.txt
example it is indicated, among other things also redis==2.10.5 In codecelery.py<code> примера тоже сипользуют Redis... Мне не понятно как и кто тогда управляет очередями.
Answer the question
In order to leave comments, you need to log in
when launched under *nix, video files “sucked in” via szVideoName do not have read status and, accordingly, cannot be given to the client by the web server
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question