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've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

video not showing in the pages


Go to End


33 Posts   8307 Views

Avatar
Rishi

Community Member, 97 Posts

26 January 2010 at 11:40pm

thank you UncleCheese
you are a genius,i am new in this work so have created lots of mistake,but you helped me a lot,thank you once again,
Now my flv videos are working fine .
I have one more problem though it is not related to any module but hope you can help me in finding a solution,
In my server ffmpeg is working fine and even i can convert and take thumbnail using ffmpeg but in core php code not in silverstripe.
I tried to find the path of ffmpeg using linux command
which ffmpeg (which gives the location )
it gives me this path
/usr/bin/ffmpeg

so i have written
FLV::set_ffmpeg_root('/usr/bin/'); in my _config.php file
but it is neither converting the avi file into flv nor creating thumbnail.
i have also tried
FLV::set_ffmpeg_root('/usr/bin/ffmpeg'); in my _config.php file

but no success,

i have created the log file for ffmpeg and when I open it ,i got this written there
[2010-01-26 10:29:03] /usr/bin/ffmpeg -i /home/equestri/public_html/silverstripe/assets/Uploads/2.avi -ar 22050 -ab 32 -f flv /home/equestri/public_html/silverstripe/assets/Uploads/2.flv
[2010-01-26 10:29:03] sh: /ffmpeg: No such file or directory

[2010-01-26 10:29:03] /usr/bin/ffmpeg -y -i /home/equestri/public_html/silverstripe/assets/Uploads/2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg /home/equestri/public_html/silverstripe/assets/video_thumbnails/2.jpg
[2010-01-26 10:29:03] sh: /ffmpeg: No such file or directory

[2010-01-26 10:29:03] /usr/bin/ffmpeg -i /home/equestri/public_html/silverstripe/assets/Uploads/2.avi -ar 22050 -ab 32 -f flv /home/equestri/public_html/silverstripe/assets/Uploads/2.flv
[2010-01-26 10:29:03] sh: /ffmpeg: No such file or directory

[2010-01-26 10:29:03] /usr/bin/ffmpeg -y -i /home/equestri/public_html/silverstripe/assets/Uploads/2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg /home/equestri/public_html/silverstripe/assets/video_thumbnails/2.jpg
[2010-01-26 10:29:03] sh: /ffmpeg: No such file or directory

any idea of how to solve this problem...

One more small help,
I am uploading a avi file with name as 123.avi but when it is converting it is taking as 2.avi and also trying to create 2.flv,is that the normal procedure or i am again doing some silly mistake?

Thank you once again for your valuable time and help.

Avatar
Rishi

Community Member, 97 Posts

27 January 2010 at 6:18pm

Edited: 27/01/2010 10:10pm

helo UncleCheese
hope you can help me in this,though the video and flv is working fine in my local system in windows but when i am uploading it in my linux server it is not working i tried to find the ffmpeg using linux command
which ffmpeg and got the path as /usr/bin/ffmpeg
then i have written this code in _config.php

FLV::set_ffmpeg_root("/usr/bin/");

i have also tried with this coded

FLV::set_ffmpeg_root("/usr/bin");
or
FLV::set_ffmpeg_root("/usr/bin/ffmpeg");

but nothing is working

where as i have set the path in my windows system in wamp and its working like a charm

thank you in advance

Avatar
bebabeba

Community Member, 193 Posts

2 March 2010 at 11:57pm

Hi!
I need something like your work..so I tried your solution but nothing heppen..I have this error when I try to create Video page:

Fatal error: Class 'FileDataObjectManager' not found in E:\silverstripe\mysite\code\VideoPage.php on line 12

So I try rewrite tour class in this way..but nothing

class VideoPage extends Page
{
static $has_many = array (
'Videos' => 'Video'
);

public function getCMSFields()
{
$fields = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this,
'Videos',
'Video',
'Video',
array('Title' => 'Title', 'Description' => 'Description'),
new FieldSet(
new TextField('Title'),
new TextareaField('Description')
)
);
$fields->addFieldToTab("Root.Content.Videos",$manager);
return $fields;
}
}

class VideoPage_Controller extends Page_Controller
{

}

Avatar
UncleCheese

Forum Moderator, 4102 Posts

3 March 2010 at 3:08am

Ummm.. Have you installed the DataObjectManager module?

Avatar
Rishi

Community Member, 97 Posts

5 March 2010 at 10:46pm

Hello bebabeba
I am giving you the step i have followed to make video working for my site.Its working on cento(LINUX) server where i have ffmpeg working as well as a linux server which do not have ffmpeg,in the second server only flv video are working(it does not convert video).

First step:
install swfupload and dataobject_manager
Second step:
create the below two pages inside mysite/code
Video.php
<?php

class Video extends DataObject
{
static $db = array (
'Title' => 'Varchar(100)',
'Description' => 'Text'
);

static $has_one = array (
// Make sure this comes first
'VideoPage' => 'VideoPage',
/**
* This relationship could be as simple as 'Video' => 'File' provided
* FileDataObjectManager::$upgrade_video is true (defaults to true).
* However, if we know the page will only contain videos, we can simplify things by
* using a direct relationship to FLV. This will give us the benefit of not having
* to worry about the allowed_file_types setting.
*
* To make this an audio resource, set the relationship to the MP3 class, e.g.
* 'AudioFile' => 'MP3'. Audio files are also subject to automatic upgrades, however,
* based on FileDataObjectManager::$upgrade_audio. (true by default).
*
*/
'Video' => 'FLV'
);

}
?>

VideoPage.php

<?php
/**
* Before getting started, be sure to test your FFMPEG installtion by adding:
* FLV::echo_ffmpeg_test();
* to your _config.php!
*
*/

class VideoPage extends Page
{
static $has_many = array (
'Videos' => 'Video'
);

public function getCMSFields()
{
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Videos", new FileDataObjectManager(
$this,
'Videos',
'Video',
'Video',
array('Title' => 'Title', 'Description' => 'Description'),
new FieldSet(
new TextField('Title'),
new TextareaField('Description')
)
));
return $fields;
}
}

class VideoPage_Controller extends Page_Controller
{

}

?>

now make dev/build

create a template page named as VideoPage.ss and place the page inside your theme/Layout

<% control Videos %>
<div class="link">
<div class="description">
<h3>$Title</h3>
<p>$Description</p>
</div>
<div class="resource">
<% control Video %>

$VideoPopup(200x200 , 400x400)

<% end_control %>
</div>
</div>
<% end_control %>

to set the width and length of video you can add the below code in _config.php inside mysite
FLV::$video_width = 300;
FLV::$video_height=200;

this code works fine for me,hope this help you

Avatar
UncleCheese

Forum Moderator, 4102 Posts

6 March 2010 at 3:29am

+1 for the community stepping in and offering support! Thanks, Rishi!

Avatar
Rishi

Community Member, 97 Posts

11 March 2010 at 5:56am

UC what ever i i know about silverstripe is because of you.you have helped me a lot.i feel glad if i can help fellow user of silverstripe

Avatar
mahir

Community Member, 11 Posts

20 April 2010 at 3:02pm

Thank you guys that really helped me