creating a jpg from flv movie

  • solomon_13000
  • Born
  • Born
  • No Avatar
  • Joined: Feb 19, 2007
  • Posts: 2
  • Status: Offline

Post February 23rd, 2007, 11:34 pm

I found this code an I tried it but it does not seem to work:


var connection_nc:NetConnection = new NetConnection();
connection_nc.connect(null);
var stream_ns:NetStream = new NetStream(connection_nc);
myVideo_mc.myVideo_video.attachVideo(stream_ns);

//select an external FLV to play
stream_ns.play("nutrigrain.flv");

//create an instance of the class
//pass the mc to reflect, the opacity of the reflection, the ratio of the gradient mask, and how often to update (milliseconds)
reflect = new Reflect(myVideo_mc, 50, 255, 5);

The Class:

import flash.display.BitmapData;

class Reflect {

private var version:String = "2.0";

private var mcBMP:BitmapData;

private var reflectionBMP:BitmapData;

private var updateInt:Number;



function Reflect(mc:MovieClip, alpha:Number, ratio:Number, updateTime:Number) {

//create a bmp obj out of it

mcBMP = new BitmapData(mc._width, mc._height, true, 0xFFFFFF);

mcBMP.draw(mc);

reflectionBMP = new BitmapData(mc._width, mc._height, true, 0xFFFFFF);

reflectionBMP.draw(mc);

mc.createEmptyMovieClip("reflection_mc", mc.getNextHighestDepth());

mc.reflection_mc.attachBitmap(mcBMP, 1);

mc.reflection_mc._yscale = -100;

mc.reflection_mc._y = mc._height;



//create the gradient mask

mc.createEmptyMovieClip("gradientMask_mc", mc.getNextHighestDepth());

var fillType:String = "linear";

var colors:Array = [0xFFFFFF, 0xFFFFFF];

var alphas:Array = [alpha, 0];

var ratios:Array = [0, ratio];

var matrix = {matrixType:"box", x:0, y:0, w:mc._width, h:mc._height/4, r90/180)*Math.PI};

var spreadMethod:String = "pad";

mc.gradientMask_mc.beginGradientFill(fillType, colors, alphas, ratios, matrix, spreadMethod);

mc.gradientMask_mc.moveTo(0, 0);

mc.gradientMask_mc.lineTo(0, mc._height/2);

mc.gradientMask_mc.lineTo(mc._width, mc._height/2);

mc.gradientMask_mc.lineTo(mc._width, 0);

mc.gradientMask_mc.lineTo(0, 0);

mc.gradientMask_mc.endFill();

mc.gradientMask_mc._y = mc._height/2;

mc.reflection_mc.cacheAsBitmap = true;

mc.gradientMask_mc.cacheAsBitmap = true;

mc.reflection_mc.setMask(mc.gradientMask_mc);

updateInt = setInterval(this, "update", updateTime, mc);


}

private function update(mc):Void{

mcBMP.draw(mc);

reflectionBMP.draw(mc);

mc.reflection_mc.attachBitmap(mcBMP, 1);

}

}

also the part I am confuse is:

myVideo_mc.myVideo_video.attachVideo(stream_ns);

Is myVideo_mc - FLVPlayback component. myVideo_video Represents?
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post February 23rd, 2007, 11:34 pm

  • graphixboy
  • Control + Z
  • Mastermind
  • User avatar
  • Joined: Jul 11, 2005
  • Posts: 1597
  • Loc: Minneapolis, MN
  • Status: Offline

Post February 24th, 2007, 4:57 pm

what exactly are you trying to do?

If all you need is an image file open your project in flash

Pick File -> Export Image... -> In the save as dialog select jpeg as the type.

Post February 26th, 2007, 12:38 am

myVideo_mc is a movieclip holder for your video.
myVideo_video is the video object which you must create.
see this post on how to do it
For the other part you need Flash 8 pro, to use the bitmap class.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”
  • nukacola
  • Beginner
  • Beginner
  • User avatar
  • Joined: Mar 16, 2006
  • Posts: 36
  • Status: Offline

Post March 12th, 2007, 5:15 am

flash to video encoder pro grabs every frame of the swf ot flv as an image.
  • bozboz
  • Novice
  • Novice
  • No Avatar
  • Joined: Mar 13, 2007
  • Posts: 31
  • Loc: Brighton
  • Status: Offline

Post March 13th, 2007, 6:14 am

How about if you are trying to use flvs loaded dynamically at runtime. Is there any way to grab the first frame of the flv to use as say a thumbnail, without loading the whole thing first?
  • nukacola
  • Beginner
  • Beginner
  • User avatar
  • Joined: Mar 16, 2006
  • Posts: 36
  • Status: Offline

Post March 13th, 2007, 7:15 am

bozboz wrote:
How about if you are trying to use flvs loaded dynamically at runtime. Is there any way to grab the first frame of the flv to use as say a thumbnail, without loading the whole thing first?


of course there is!
print screen :lol:
but without loading... i really dont know.. what are you trying to do?
  • nukacola
  • Beginner
  • Beginner
  • User avatar
  • Joined: Mar 16, 2006
  • Posts: 36
  • Status: Offline

Post March 13th, 2007, 7:28 am

make a scripted button for the flv.

if the flashmovie inside the file with a button - make this button for the first frame of the flv. and movie which will be loading - to the second frame.
first frame stop();
for the button on(release) {gotoAndPlay(2);}

if the file loading from the outside - for the button on(release) {onLoadMovie(link to movie)}
======
or onLoadMovie script. serach about this anywhere

i`m a real lamer in this....
  • bozboz
  • Novice
  • Novice
  • No Avatar
  • Joined: Mar 13, 2007
  • Posts: 31
  • Loc: Brighton
  • Status: Offline

Post March 13th, 2007, 8:16 am

no i think you missed what i was suggesting :)

I was looking for a way to create a thumbnail dynamically - automatically

so you wouldnt need to manually print screen and make a thumbnail for the button, just use the first frame of the flv clip as the button image

Im sure you can do it somehow
  • nukacola
  • Beginner
  • Beginner
  • User avatar
  • Joined: Mar 16, 2006
  • Posts: 36
  • Status: Offline

Post March 13th, 2007, 8:29 am

i`m a real lamer in coding
  • bozboz
  • Novice
  • Novice
  • No Avatar
  • Joined: Mar 13, 2007
  • Posts: 31
  • Loc: Brighton
  • Status: Offline

Post March 13th, 2007, 9:09 am

takes a while mate, stick with it

Post Information

  • Total Posts in this topic: 10 posts
  • Users browsing this forum: No registered users and 49 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.