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 thumbnails issue


Go to End


4 Posts   1274 Views

Avatar
Arun_India

Community Member, 18 Posts

4 January 2012 at 7:35pm

Edited: 05/01/2012 6:55pm

Hi UncleCheese,

I am having problem with video thumbnails.Currently i have default_video image.
I did not see any video thumbnails files within the directory video_thumbnails in asset folder also i checked FLV::echo_ffmpeg_test(); and the results shows
FFMPEG is installed on your server and working properly. Code: 1

My Videos works fine.

My code is=======>
1)Video .php
<?php
class Video extends DataObject
{
static $db = array ('Title' => 'Varchar(100)','Description' => 'Text');
static $has_one = array ('VideoPage1' => 'VideoPage','Video' => 'FLV');
}

2)VideoPage.php
<?php
class VideoPage extends SectionPage {

static $has_many = array ('Videos' => 'Video');
static $has_one = array ('Filepath' => 'Filename');

public static $icon = 'mysite/images/treeicons/video';

public static $db = array(
);

//public static $has_one = array();

public function canCreate($member = null) {
if(!$member || !(is_a($member, 'Member')) || is_numeric($member)) $member = Member::currentUser();

if($member && Permission::checkMember($member, "ADMIN")) return true;

// DEPRECATED 2.3: use canCreate() instead
$results = $this->extend('alternateCanCreate', $member);
if($results && is_array($results)) if(!min($results)) return false;

// decorated permission checks
$results = $this->extend('canCreate', $member);
if($results && is_array($results)) if(!min($results)) return false;

return $this->stat('can_create') != false || Director::isDev();
}

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;
}

function Thumbnail() {
$Image = $this->Image();
if ( $Image ) {
return $Image->CMSThumbnail();
} else {
return null;
}
}

}
class VideoPage_Controller extends SectionPage_Controller {

public static $allowed_actions = array (
);

public function init() {
parent::init();
}
}

3)VideoPage.ss

<% if IncludeLeftPanel %>
<% include LeftPanel %>
<% end_if %>
<div id="Content" class="typography <% if IncludeLeftPanel %>wLeft<% end_if %><% if IncludeRightPanel %>wRight<% end_if %>">
<% if ClassName=="HomePage" %>
<% control sectionPages %>
<% if Children %>
<div class="$URLSegment contentBox sectionSummary round shadow">
<a href="$Link"><img class="icon" alt="$Title Icon" src='$icon.URL'/></a>
<div class="description">
<a href="$Link"><h3>$Tagline</h3></a>
<p>$Blurb</p>
<a href="$Link"><img class="headshot" alt="$Title Headshot" src='$headshot.URL'/></a>
</div>
</div>
<% end_if %>
<% end_control %>
<% end_if %>
<% if ComingSoon %>
<% include ComingSoon %>
<% else_if Content %>
<% if NoContentBox %>
$Content
<% else %>
<div id="ContentInner" class="round shadow">

<link rel="stylesheet" type="text/css" href="Player/style.css">
<center>
<!--<div id="mediaplayer">H2connect Video Player </div>-->
<video id="mediaplayer"></video>
</center>
<div align="center">
<script type="text/javascript" src="Player/jwplayer.js"></script>
</div>
<!--$Content-->
<ul>
<% control Videos %>
<li style="display:inline-block; *float:left;text-align:center;">
Title:<h3>$Title</h3>

<div style="margin: 3px auto; width:70px;text-align:center;padding:10px; border:0px solid #f7f7f7;">
</div>

<% control Video %>
<div id="mediaplayer"></div>
<script type="text/javascript">
jwplayer('mediaplayer').setup({
flashplayer: '/Player/player.swf',
file: '$FLVLink',
image: '$image'
});
</script>
<script type="text/javascript">
function Play(videoUrl)
{
var playlist = jwplayer('mediaplayer').getPlaylist();
var newItem = videoUrl;
playlist.push(newItem);
jwplayer('mediaplayer').load(newItem);
}
</script>
<div>
<a href="#" onclick="Play('$FLVLink')">
<% control VideoThumbnail %>
$CroppedImage(50,50)
<% end_control %> </a>
</div>

<% end_control %>
Description:<h3>$Description</h3>
</li>
<% end_control %>
</ul>
<% if ClassName=="Page" %>
<div>$Form</div>
<% else_if Fields %>
<div>$Form</div>
<% end_if %>

<% if ClassName == RegistrationPage %>
<% if RegistrationForm %>
<% control RegistrationForm %><% include MultiFormProgressList %><% end_control %>
<div>$RegistrationForm</div>
<% end_if %>
<% end_if %>

<div>$PageComments</div>
</div>
<% end_if %>
<% end_if %>
</div>
<% if IncludeRightPanel %>
<% include RightPanel %>
<% end_if %>
<% if IncludeOurPicks %>
<% include OurPicks %>
<% end_if %>

And my ffmpeg_log.txt shows like ...

[2012-01-02 16:18:10] ffmpeg -y -i C:\inetpub\wwwroot/assets/Wellness/video2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg C:\inetpub\wwwroot/assets/video_thumbnails/video2.jpg
[2012-01-02 16:18:10] 'ffmpeg' is not recognized as an internal or external command,
operable program or batch file.

[2012-01-02 16:18:11] ffmpeg -y -i C:\inetpub\wwwroot/assets/Wellness/video2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg C:\inetpub\wwwroot/assets/video_thumbnails/video2.jpg
[2012-01-02 16:18:11] 'ffmpeg' is not recognized as an internal or external command,
operable program or batch file.

[2012-01-02 16:18:17] ffmpeg -y -i C:\inetpub\wwwroot/assets/Uploads/video2.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg C:\inetpub\wwwroot/assets/video_thumbnails/.jpg
[2012-01-02 16:18:17] 'ffmpeg' is not recognized as an internal or external command,
operable program or batch file.

I am stuck with thumbnail video...
Pls find me a solution...

Regards
Arun

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 January 2012 at 3:34am

Edited: 05/01/2012 3:37am

echo_ffmpeg_test(); is not 100% accurate, and as you can see from the logs, it's not executing. Either FFMPEG is not installed, or you need to use set_ffmpeg_root() (I think??) to specify an absolute path to the executable, e.g. /user/bin/ffmpeg

Would you mind editing your message to reduce the number of log entries? It will be cumbersome for readers to go through 100,000 lines of text!

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

Avatar
Arun_India

Community Member, 18 Posts

5 January 2012 at 10:43pm

Edited: 05/01/2012 10:46pm

Hi, Uncle Cheese

I set the absolute path in dataobject_manager\code\flv\ FLV.php page.(private static $ffmpeg_root = "c:/inetpub/wwwroot/";)

Still i am facing the same problem with video thumbnail.
Currently i am working in windows server in IIS with sql server 2008 as database....

And in my ffmpeg_log.txt shows like the same error.

[2012-01-05 13:53:05] ffmpeg -y -i C:\inetpub\wwwroot/assets/Uploads/JIWOK-ANIMV3.flv -an -s 640x480 -ss 10 -an -r 1 -vframes 1 -y -vcodec mjpeg -f mjpeg C:\inetpub\wwwroot/assets/video_thumbnails/.jpg
[2012-01-05 13:53:06] 'ffmpeg' is not recognized as an internal or external command,
operable program or batch file.

========================================

Can i add an option in video page for uploading image..?

========================================
Pls help me to solve these problems...

Regards
Arun

Avatar
Arun_India

Community Member, 18 Posts

11 January 2012 at 1:10am

Edited: 11/01/2012 1:18am

Hi Uncle Cheese,

Still i am facing the same problem with video thumbnail.

Sometimes the error is ===>

[User Error] Uncaught Exception: Cannot move assets/video_thumbnails/.jpg to assets/.jpg - assets/video_thumbnails/.jpg doesn't exist
GET /wellness/videos/
==================
But while checking in the folder(assets/video_thumbnails),there is no jpeg files and also in database ([File]) the Filename field and Name is saving with jpg only( assets/video_thumbnails/.jpg).
Tilte is save with ID(flv_thumb_6796)

When i remove
<% control VideoThumbnail %>
$CroppedImage(80,80)
<% end_control %>

these code from Videopage.ss file, that error is cleared and also the default video image is not listing.

Pls help me to solve these problems...

Regards
Arun