Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'feature/video' of into fea…

  • Loading branch information...
commit 7b5815ef55212e86c7e6c3f652e9af45cbeee32c 2 parents 016e3cd + 3e6597f
@nmfm authored
2  docs/index.rst
@@ -4,7 +4,7 @@ Welcome to django-filer's documentation!
``django-filer`` is a file management application for django. It handles uploading
-and organizing files and images in contrib.admin.
+and organizing files, images and videos in contrib.admin.
.. figure:: _static/directory_view_1_screenshot.png
:scale: 50 %
42 docs/installation.rst
@@ -23,6 +23,7 @@ Dependencies
* `PIL`_ 1.1.7 (with JPEG and ZLIB support) I recommend using `Pillow`_ instead.
* `django-staticfiles`_ or ``django.contrib.staticfiles`` with `Django`_ 1.3 is
+* `ffmpeg`_ (recommended for video conversions)
Since the `PIL`_ package on `pypi`_ can be notoriously hard to install on some
platforms it is not listed in the package dependencies in ```` and won't
@@ -100,6 +101,46 @@ To crop an image and respect the subject location::
{% load thumbnails %}
{% thumbnail obj.img 200x300 crop upscale subject_location=obj.img.subject_location %}
+video conversion with ffmpeg
+If installed ffmpeg is used for conversion of uploaded videos in multiple
+formats, resizing of video dimensions and capture of poster image from the
+The list of accepted video formats for upload is set in the setting bellow.
+When using ffmpeg this list should match the formats available for conversion.
+ FILER_SOURCE_VIDEO_FORMATS = ('mp4', 'avi', 'wmv', 'mov', 'mpg')
+With ffmpeg available, when a file is upload it is converted to the formats in
+the output formats list.
+ FILER_VIDEO_FORMATS = ('flv', 'mp4','webm')
+By default the videos are converted maintaining the original video dimensions.
+For each video, in the admin interface it is possible to choose different
+dimensions, but if all videos should be resized to given dimensions, the
+setting bellow can be used.
+Parameters regarding the conversion quality can be adjusted in the setting
+FFMPEG_CMD, and parameters for the capture of the poster image can be adjusted
+in the setting GRABIMG_CMD.
+Cron setup for video conversion
+Converting a video is a time consuming operation that cannot be done during
+the upload of the file. When the video is uploaded it gets the conversion
+status "new". A Django management command is provided for running the
+conversion of all videos with "new" status.
+ ./ convert_video
+This command should typically be setup in a cron job so that in regular
+intervals all newly uploaded videos get converted.
.. _django-filer:
@@ -114,3 +155,4 @@ To crop an image and respect the subject location::
.. _Pillow:
.. _pip:
.. _South:
+.. _ffmpeg:
24 docs/usage.rst
@@ -67,18 +67,36 @@ templates
{% load thumbnails %}
{% thumbnail company.logo 250x250 crop %}
+A template tag is also provided to display videos with the multiple available
+ {% load filer_video_tags %}
+ {% filer_video video_obj %}
+This will generate the html5 video tag with links to the multiple video formats
+and fallback to flash if the flash format is available, and link to the poster
+image. The filer_video tag can accept optional dimensions parameter for the
+display window (otherwise uses the video dimensions).
+ {% filer_video video_obj 640x480 %}
+Note: if ffmpeg is not available for converting the videos, the dimensions of
+the uploaded video are not extracted from the file and so they need to be set
+in the tag.
The default widget provides a popup file selector that also directly supports
-uploading new images.
+uploading new images and new videos.
.. figure:: _static/default_admin_file_widget.png
:alt: FileField widget in admin
-* Clicking on the magnifying glass will display the file selction popup.
+* Clicking on the magnifying glass will display the file selection popup.
-* The red X will de-select the currently selected file (usefull if the field
+* The red X will de-select the currently selected file (useful if the field
can be ``null``).
9 filer/admin/
@@ -21,9 +21,14 @@ class VideoAdmin(FileAdmin):
'classes': ('collapse',),
(_('Conversion'), {
- 'fields': ('conversion_status', 'original_height','original_width','height','width',
+ 'fields': ('conversion_status', 'height','width',
'classes': ('collapse',),
- readonly_fields = ('original_height','original_width')
+ def render_change_form(self, request, context, *args, **kwargs):
+ video = Video.objects.get(pk=context['object_id'])
+ context['adminform'].form.fields['width'].help_text = _('Uploaded video width %s px') % video.original_width
+ context['adminform'].form.fields['height'].help_text = _('Uploaded video height %s px') % video.original_height
+ return super(VideoAdmin, self).render_change_form(request, context, args, kwargs)
17 filer/fields/
@@ -0,0 +1,17 @@
+#-*- coding: utf-8 -*-
+from filer.fields.file import AdminFileWidget, AdminFileFormField, \
+ FilerFileField
+from filer.models import Video
+class AdminVideoWidget(AdminFileWidget):
+ pass
+class AdminVideoFormField(AdminFileFormField):
+ widget = AdminVideoWidget
+class FilerVideoField(FilerFileField):
+ default_form_class = AdminVideoFormField
+ default_model_class = Video
Please sign in to comment.
Something went wrong with that request. Please try again.