Transcoding
Transcoding of video files uploaded by users into Plumi is currently handled by Transcode Star, a Python package which creates a video transcoding framework and network service which has been integrated into Plone, which converts video files using ffmpeg and ffmpeg2theora.
Transcode Star, in addition to creating an H.264/AAC mp4 file (for use in the Flowplayer Flash video player, and/or for use by the new new video tag in HTML5) and an Ogg Theora/Vorbis file (for use by the new video tag) also creates a jpeg thumbnail from uploaded video files, for use inside Plumi. As of Plumi 4.1, it also creates a low-resolution/bitrate version of the video file, which can be activated by users with low bandwidth connections. These default settings can be altered.
Note: use of the HTML5 video tag is not currently the default playback method in Plumi, as not all browsers are compatible with this tag, and a better way of defaulting to Flowplayer needs to be implemented. However it is available as a link "Watch/Download Ogg Theora Version" which will play back a theora file in a new browser window if HTML5/Ogg is present, or download the file if it is not. If you wish to use the video tag, please contact the Plumi developer community here if you need some help.
In this chapter we look at configuring Transcode Star and changing the transcoding profiles (output video files). If you wish to run multiple Transcode Daemon processes on the same server please consult the documentation on changing the PID file at the bottom of this chapter.
Configure Transcode Star in the Control Panel
You will need to configure Transcode Star with your site details. If you have changed the port numbers you need to change the Transcode Settings to reflect this also.
Visit the Transocde Settings page in the plone control panel here (swap www.mysite.com for your URL):
http://www.mysite.com/@@transcode-controlpanel
Transcoding Profiles
If you wish to change the output of ffmpeg (the transcoding engine), for example to output a different codec, or use different settings, you can set up the transcoding profiles.
You must set up these profiles prior to running the buildout.
You can edit the profiles for transcoded video files by making changes to the buildout configuration file in the directory where you installed Plumi:
$ nano site.cfg
Go down to the transcode-profiles. You can see that by default an .mp4 H.264/AAC, a low resolution .mp4 H.264/AAC and an .ogg Theora/Vorbis file are created, as well as a jpeg thumbnail.
transcode-profiles = [ { 'id' : 'jpeg', 'cmd' : 'scripts/getThumb %s %s', 'supported_mime_types': ${transcodedaemon:default_supported_mimetypes}, 'output_mime_type': 'image/jpeg', 'output_extension': 'jpg' }, { 'id' : 'mp4', 'cmd' : 'scripts/transcodeMp4 %s %s', 'supported_mime_types': ${transcodedaemon:default_supported_mimetypes}, 'output_mime_type': 'video/mp4', 'output_extension': 'mp4' }, { 'id' : 'ogg', 'cmd' : 'scripts/transcodeTheora %s %s', 'supported_mime_types': ${transcodedaemon:default_supported_mimetypes}, 'output_mime_type': 'video/ogg', 'output_extension': 'ogv' }, { 'id' : 'low', 'cmd' : 'scripts/transcodelow \"%s\" \"%s\"', 'supported_mime_types': ${site:default_supported_mimetypes}, 'output_mime_type': 'video/mp4', 'output_extension': 'mp4' } ]
For example, the ffmpeg command to create the .mp4 file can be found in scripts/transcodeMp4:
#!/bin/sh PATH=.:./bin:$PATH ffmpeg -y -i "" -s 640x480 -threads 0 -r 25 -ar 44100 -vcodec libx264 -crf 22 -vpre medium -acodec libfaac -ab 64k -f mp4 "" qt-faststart "" ".fst" mv ".fst" ""
To edit the settings of the .mp4 file, you change the parameters. For example, to change the video framesize or resolution, change e.g.
640x480
to this:
320x240
Other parameters for the .mp4, .ogg and .jpg can be altered in a similar fashion. New profiles can also be added.
It may be useful to reference the documentation for ffmpeg and ffmpeg2theora.
Transcoding and FTP
Videos uploaded through ftp don't get picked up by the transcode daemon currently. A workaround to this issue is described in this ticket