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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

FFMPEG and FLVTool2 Tip.


7 Posts   2741 Views


16 October 2009 at 4:03am Community Member, 63 Posts

I don't know how many people are actually using DOM for High Quality video conversion. Well I had some trouble getting my videos to a very high quality and getting the progress bar to work.

After installing FFMPEG I found that uploading any files other than FLV's the progress bar didn't work. FLVTOOL2 fixes this by inserting Metadata into your newly created flv.

on Cent OS yum install flvtool2, will take care of that.

Here is the code I now use.

in FLV.PHP search for createFLV()

private function createFLV()
$args = sprintf("-i %s -ar %d -ab %d -s 640x480 -r 30fps -b 3000kbps -g 100 -f flv - | flvtool2 -U stdin %s",

$output = self::ffmpeg($args);

This is the bulk of the FFMPEG command

$args = sprintf("-i %s -ar %d -ab %d -s 640x480 -r 30fps -b 3000kbps -g 100 -f flv - | flvtool2 -U stdin %s",

This also generates the progressive download, like youtube. I hope this saves someone some time.

Note this generates very high quality FLV's. The final size of the FLV will be just as large, if not larger than the original uploaded.


16 October 2009 at 6:18am 4085 Posts

Yeah, I've been meaning to play around with FLVTool. Not everyone has it, so it would involve another checkpoint to build the ffmpeg command based on whether or not flvtool is installed, but that's good to know it's producing higher quality video for you. I'm not sure what you mean about the progress bar, though. I've always gotten that with no problem.

I anxiously await the day when I'll be able to overhaul all these media features -- mostly to decouple them from the DOM so I can make a more robust management interface.


16 October 2009 at 7:52am (Last edited: 16 October 2009 7:55am), Community Member, 63 Posts

I'm not sure what was up with the progress bar, it may have had something to do with the FFMPEG command I was running.

I know for fact that FLVTOOL2 fixed it. The higher quality also comes from the different arguments I supplied to the ffmpeg command.

That is one powerful piece of code right there. I can't wait for you to make a more powerful management interface as well :p. If it's better than DOM I will be super stoked that's for sure.


This is something else I added to the Player(). Since the player would show a black background instead of a thumbnail. I changed that :)

public function playerThumb($width, $height){
$img = $this->getThumbnail()->CroppedImage($width, $height)->Link();
return Director::absoluteURL($img);

public function Player($width = null, $height = null)
if($width === null) $width = self::$video_width;
if($height === null) $height = self::$video_height;

"swfobject.embedSWF('%s','player-%s','%d','%d','9.0.0','expressInstall.swf',{file : '%s', image : '%s'},{allowscriptaccess : 'true', allowfullscreen : '%s'})",
$this->playerThumb($width, $height),

return "<div id='player-".self::$player_count."'>Loading...</div>";

I couldn't use VideoPopup() because I happen to have mootools on another item on that page, and mootool + jquery = Fail.


16 October 2009 at 8:18am 4085 Posts

Yeah, the whole video endeavor has been way more successful and popular than I anticipated. I really believed that the FFMPEG requirement would be enough to turn people away. Not many users know how to do that level of sysadmin to install FFMPEG. Then, I figured, even if everyone has it, what are the chances the same shell exec code is going to work on everyone's machine? Surprisingly, it's been more compatible than SWFUpload in that regard.

Yeah, there's a lot more we can do. Thumbnail selection, player selection, more control over conversion parameters (as you point out). It's tough to store those as static vars. Everyone wants something different. I also need to get away from JWPlayer. They started charging for commercial use.

MooTools and jQuery should get along fine. I believe I have all the $() references in a closure. But I guess I've never tried it.


16 October 2009 at 9:27am Community Member, 63 Posts

I've always had issues with MooTools & JQuery on the same page. Probably something I'm doing. FFMPEG is almost a must on any server these days.

That sucks about JWPlayer, but Flowplayer is nice. They are probably charging for Commercial use as well though.

Surprisingly, it's been more compatible than SWFUpload in that regard.

LOL @ that comment.


16 October 2009 at 9:46am 4085 Posts

I just launched a site that uses ToobPlayer instead of JW. Works well, looks good, and it's free!

Ultimately, I'd like the video features to be more like ImageGallery, where users can create and supply their own UI plugins.


6 November 2009 at 3:50am 4085 Posts

This is awesome stuff. I'll definitely be implementing this. Thanks, vstrazz.