Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » New Feature: Audio and Video

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Go to End
Author Topic: 23583 Views
  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    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!

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    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.

  • micahsheets
    Avatar
    Community Member
    164 Posts

    Re: New Feature: Audio and Video Link to this post

    Ah, my biggest problem was compiling an ffmpeg.so 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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    Wouldn't ->setUploadFolder() work?

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

  • micahsheets
    Avatar
    Community Member
    164 Posts

    Re: New Feature: Audio and Video Link to this post

    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) {
          $this->clearErrors();
          
          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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

    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.

  • UncleCheese
    Avatar
    4085 Posts

    Re: New Feature: Audio and Video Link to this post

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

    FLV::set_ffmpeg_root($path);

    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
    Avatar
    Community Member
    60 Posts

    Re: New Feature: Audio and Video Link to this post

    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/.cache.opt.webapps.shawn.academicservices.nsu-basic-dom.templates.Layout.VideoPage.ss 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.

    23583 Views
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.