Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

New Feature: Audio and Video

Go to End

150 Posts   31711 Views


Forum Moderator, 4102 Posts

23 May 2009 at 8:48am

I'm executing the scripts from within PHP. That's what's causing a lot of the problems. I wasn't aware of a PHP extension for ffmpeg. That might solve a lot of our problems!


Forum Moderator, 4102 Posts

23 May 2009 at 8:56am

Interesting. Just had a look. Seems very powerful, but I don't see any way of re-encoding videos from within the extension. Looks like it's just for peeking into video files to get their meta-data. I'll look more closely at it later.


Community Member, 165 Posts

23 May 2009 at 12:55pm

Ah, my biggest problem was compiling an file using ffmpeg and ffmpeg-php, but it seems that I don't need all that. We just need to fix the script execution and I can use a normal ffmpeg installation. Ill work on that myself as well.

Another question I have is how to change the upload directory of an imagefield. Since we want to control the thumbnails generated for the uploaded videos for our company site I added an imagefield that allows me to upload my own thumbnails. This works nice except I would really like to have the thumbnails upload to a child folder of my Media folder where the videos get uploaded. (I modified some code to let me upload the videos to a particular folder but I guess that is because it uses the swfupload for the video itself.

I have seen other people with hacks to the core code that let them change the default upload dir for imagegfield but I am trying to find a solution that won't require me to modify core code.

I thought that making my own ImageField subclass I might be able to set protected $folderName to what I want it to be but that doesn't work at leas the way I am doing it. Honestly Im not sure how to do this. All I know is that a FileField object has a protected $folderName and a setFolderName function but I can't get it to work.

The constructor for ImageField has a parameter for the $folderName but it seems that it doesn't work an many people wish it did. At least I cannot get it to work in 2.3.1.


Forum Moderator, 4102 Posts

23 May 2009 at 3:15pm

Wouldn't ->setUploadFolder() work?

You can also set ->allowUploadFolderSelection(); in FileDataObjectManager.


Community Member, 165 Posts

27 May 2009 at 5:00am

Edited: 27/05/2009 5:36am

Uncle Cheese,

I do use setUploadFolder to set the folder where the video and audio files are uploaded. That works fine. What I am trying to do now is set the upload folder for my custom thumbnails so they don't get put in Uploads but a sub folder of my Media directory where the audio and video files live. I have a custom MediaFile DataObject that has an ImageField. It is the ImageField I am trying to change the upload folder for. By default the upload directory for all FileField objects is the "Uploads" folder and it does not seem possible to change that. Even though FileField has a property for setting the upload folder the, in Upload.php the ability to change the folder seems to be disabled.

function load($tmpFile, $folderPath = false) {

if(!$folderPath) $folderPath = self::$uploads_folder;

I may not understand what is going on here, but it seems to be that since the $folderPath = false is not letting me set the $folderPath.


Forum Moderator, 4102 Posts

27 May 2009 at 4:03pm

Just updated the way FFMPEG is executed. This way is supposed to be a lot more reliable. Haven't had a chance to test, though. Those of you who have FFMPEG can check out the latest SVN and try it out. Remember to check the result of "FLV::echo_ffmpeg_test()" first.


Forum Moderator, 4102 Posts

28 May 2009 at 4:48am

Edited: 28/05/2009 4:50am

A number of improvements to this today that got it working successfully on Andrew's server. You can now set in your _config.php:


Seems like there were some issues calling the ffmpeg alias globally, and specifying the exact path of the executable file was necessary. If you do not do this, it will just run the command "ffmpeg" from the sapphire directory. Depending on how ffmpeg is set up, that may or may not work. On both of my servers it not necessary to set the ffmpeg root, but those of you who are having trouble probably want to give it a try, e.g. FLV::set_ffmpeg_root('/usr/local/bin/');

Shawn Parr

Community Member, 60 Posts

3 June 2009 at 2:07am

Hey UC, et al,

I've been playing around with this, and so far it is great, having one issue, and have a few questions:

Issue: I don't seem to be able to set the player size for the video in the template file. In my page template I have something like:

<% control Attachment %>$Player(<% control Parent %>$VidWidth, $VidHeight<% end_control %>)<% end_control %>

Which pops up an error in SS:

Parse error: syntax error, unexpected T_STRING, expecting ')' in /tmp/silverstripe-cache-opt-webapps-shawn-academicservices/ on line 384

I have also tried just using $Attachment.Player(400,300), which just prints what is in parenthesis on the page. This is with an SVN export from yesterday.

My questions:

1. Is it possible to support other audio formats with the audio upgrades? i.e. AAC (m4a), AIFF, or WAV? I know the last two are not ideal. And is this a limitation in the player you are using, or something that can be tweaked in the module?

2. In my testing if I upload a video file that isn't supported by the flash player (I tried an F4V file), the page errors out. Is there some way to have it degrade more gracefully? I.e. if the correct type is uploaded do the fancy player, otherwise fall back to just doing a normal link? Or is this a sign that something is wrong with my setup? Currently I'm creating separate page types that just accept upgradeable files, but I'd like to consolidate down to less pages in the future.

The FFMPEG integration is excellent though. My servers are Ubuntu linux, and an apt-get install ffmpeg was all that was needed to make the magic happen.