Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » ffmpeg

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2 3 4
Go to End
Author Topic: 2507 Views
  • dacar
    Avatar
    Community Member
    168 Posts

    Re: ffmpeg Link to this post

    Hi Uncle Cheese,

    here is the code. btw images, mp3 and flv are uploaded correctly. mpeg is saved as FILE to db.

    PageRessource.php:

    <?php
    class PageResource extends DataObject
    {
       static $db = array (
          'Name' => 'Text',
          'Beschreibung' => 'Text'
       );

       static $has_one = array (
          'Attachment' => 'File', //@UncleCheese: could this be the problem?
          'Page' => 'Page'
       );

       public function getCMSFields_forPopup()
       {
          return new FieldSet(
             new TextField('Name'),
             new TextareaField('Beschreibung'),
             new FileIFrameField('Attachment')
          );
       }
    }
    ?>

    Page.php

    <?php
    class Page extends SiteTree {

       public static $db = array(
          'RedirectToChild'       => 'Int',
          'Headline'             => 'Text',
          'Copytext'             => 'HTMLText',
          'BannerLinkExtern'       => 'Text',
          'BannerLinkInternID'    => 'Text',
          'BannerEinblenden'       => 'Boolean',
          'BannerText'          => 'Text',
          'KopfbildAufStartseite' => 'Boolean',
          'SliderCopytext'       => 'Text'
       );

       public static $has_one = array(
          'MoodImage' => 'Page_MoodImage',
          'BannerImage' => 'Page_BannerImage',
          'BannerLinkIntern' => 'SiteTree'
       );
       
       static $has_many = array (
          'PageResources' => 'PageResource'
       );
       
       function getCMSFields() {
       $array = array(
          '1' => 'Hauptnavigationspunkt anzeigen',
          '2' => 'Direkt 1. Navigationspunkt der 2. Ebene anzeigen',
          '3' => 'Direkt 1. Navigationspunkt der 3. Ebene anzeigen'
       );
       
       
          $fields = parent::getCMSFields();
          $fields->addFieldToTab('Root.Content.Main', new DropdownField(
             'RedirectToChild',
             'Content zeigen aus',
             $array));
          // Kopfbild
          $fields->addFieldToTab('Root.Content.Kopfbild', new CheckboxField('KopfbildAufStartseite', 'Bild im Slider auf der Startseite anzeigen?'));
          $fields->addFieldToTab('Root.Content.Kopfbild', new TextareaField('SliderCopytext', 'Text f&uuml;r Slider:'));
          $fields->addFieldToTab("Root.Content.Kopfbild", new ImageField(
             "MoodImage",
             "Bitte w&auml;hlen Sie ein Kopfbild (491*267)",
             null,
             null,
             null,
             "Kopfbilder/"
             )
          );
          // Banner
          $fields->addFieldToTab('Root.Content.Bannerbild', new ImageField(
             'BannerImage',
             'Bitte w&auml;hlen Sie ein Bild (260*120)',
             null,
             null,
             null,
             'Bannerbilder/'
             )
          );
          $fields->addFieldToTab('Root.Content.Banner', new TextField('Headline'));
          $fields->addFieldToTab('Root.Content.Banner', new TextareaField('Copytext'));
          // TreeDropdownField: $name, $title, $sourceObject, $keyField, $labelField, $showSearch
          
          $verlinkung = new TreeDropdownField('BannerLinkInternID', 'Bitte eine interne Verlinkung w&auml;hlen', 'SiteTree', 'ID', 'Title', true);
          // $verlinkung->objectForKey('ID');
          // $verlinkung->objectForKey($BannerLinkInternID);
          $fields->addFieldToTab('Root.Content.Banner', $verlinkung);
          
          $fields->addFieldToTab('Root.Content.Banner', new TextField('BannerLinkExtern'));
          $fields->addFieldToTab('Root.Content.Banner', new CheckboxField('BannerEinblenden'));

          $manager = new FileDataObjectManager(
             $this, // Controller
             'PageResources', // Source name
             'PageResource', // Source class
             'Attachment', // File name on DataObject
             array(
                'Name' => 'Name',
                'Beschreibung' => 'Beschreibung',
             ), // Headings
             'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
             // Filter clause
             // Sort clause
             // Join clause
          );
    $fields->addFieldToTab("Root.Content.Dateien",$manager);
          
          return $fields;
       }

    }

    Thanks for your time, Carsten.

  • UncleCheese
    Avatar
    4085 Posts

    Re: ffmpeg Link to this post

    I've tried this a number of different ways, but I can't seem to replicate the problem you're having. Here's the code I'm using:

    FileDOMTestPage.php

    <?php

    class FileDOMTestPage extends Page {

       static $has_many = array (
          'Resources' => 'Resource'
       );
       
       public function getCMSFields() {
          $f = parent::getCMSFields();
          $f->addFieldToTab("Root.Content.Resources", new FileDataObjectManager(
             $this
          ));
          return $f;
       }
    }

    class FileDOMTestPage_Controller extends Page_Controller {}

    Resource.php

    <?php

    class Resource extends DataObject {

       static $db = array (
          'Title' => 'Varchar',
          'Description' => 'Text'
       );
       
       static $has_one = array (
          'Attachment' => 'FLV',
          'FileDOMTestPage' => 'FileDOMTestPage'
       );
       
       public function getCMSFields() {
          return new FieldSet (
             new TextField('Title'),
             new TextareaField('Description'),
             new FileUploadField('Attachment')
          );
       }

    }

    The file gets uploaded, thumbnailed, encoded, and saved with the "FLV" class. You can test it on the demo site..

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

  • GRiiDWeb
    Avatar
    Community Member
    60 Posts

    Re: ffmpeg Link to this post

    Hi Uncle Cheese,
    I've emailed you previously and you have always managed to help.
    I have a similar situation that videos are not converted to FLV, I don't think it's ever worked.
    ffMpeg is installed and working on the server. I have the DOM, swfupload and image gallery installed unchanged from your originals and I've added -
    ; Maximum size of POST data that PHP will accept.
    post_max_size = 99M

    ; Maximum allowed size for uploaded files.
    upload_max_filesize = 99M

    for the file sizes. Generally I have small 5 meg videos, usually avi and they never convert to FLV.
    Are there some additional settings which can be changed to get the conversion or can I add other files types to the DOM (however, would they play in JW Player?)

    Many thanks
    P.

  • UncleCheese
    Avatar
    4085 Posts

    Re: ffmpeg Link to this post

    Check the log in /dataobject_manager/code/flv/ffmpeg_log.txt. It should be logging all of the FFMPEG commands. Run a few at the command line and you can see if there are any errors.

    ---------------
    Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

  • GRiiDWeb
    Avatar
    Community Member
    60 Posts

    Re: ffmpeg Link to this post

    Hi,
    This is what the log says -

    [2010-11-25 09:47:41] ffmpeg -i /home/griided/public_html/assets/Uploads/Erin-at-the-fridge2.AVI -ar 22050 -ab 32 -f flv /home/griided/public_html/assets/Uploads/Erin-at-the-fridge2.flv
    [2010-11-25 09:47:41] sh: ffmpeg: command not found

    [2010-11-25 09:47:41] ffmpeg -y -i /home/griided/public_html/assets/Uploads/Erin-at-the-fridge2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg /home/griided/public_html/assets/video_thumbnails/erin-at-the-fridge2.jpg
    [2010-11-25 09:47:41] sh: ffmpeg: command not found

    [2010-11-25 09:47:41] ffmpeg -i /home/griided/public_html/assets/Uploads/Erin-at-the-fridge2.AVI -ar 22050 -ab 32 -f flv /home/griided/public_html/assets/Uploads/Erin-at-the-fridge2.flv
    [2010-11-25 09:47:41] sh: ffmpeg: command not found

    [2010-11-25 09:47:41] ffmpeg -y -i /home/griided/public_html/assets/Uploads/Erin-at-the-fridge2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg /home/griided/public_html/assets/video_thumbnails/erin-at-the-fridge2.jpg
    [2010-11-25 09:47:41] sh: ffmpeg: command not found

    [2010-11-25 09:52:31] ffmpeg
    [2010-11-25 09:52:31] sh: ffmpeg: command not found

    Is there something the server provider needs to do?

    Thanks again
    P

  • GRiiDWeb
    Avatar
    Community Member
    60 Posts

    Re: ffmpeg Link to this post

    Hang on!
    I've just run the test again and it says ffMpeg is not installed, but it was there yesterday.

    Sorry to be messing you around, I have emailed my service provider to see what the heck is going on.

    P.

  • GRiiDWeb
    Avatar
    Community Member
    60 Posts

    Re: ffmpeg Link to this post

    Hi,
    Ok, they have sorted the php.ini folder and confirmed ffMpeg installed ok, however, it still doesn't work. I'm still getting the 'command not found' in the log.
    Any ideas will be gratefully received.

    Many thanks

    P.

  • UncleCheese
    Avatar
    4085 Posts

    Re: ffmpeg Link to this post

    If you're getting command not found, then it isn't installed. You shouldn't have to do anything in your php.ini. FFMPEG is a package you install on a Linux server.

    ---------------
    Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

    2507 Views
Page: 1 2 3 4
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.