Re: [flexcoders] FLV Thumbnail

2007-01-08 Thread Andrew D. Goodfellow

John,

I don't do it in AS. I always process the flv on the fly (with caching of
course) with an open source tool called ffmpeg (
http://sourceforge.net/projects/ffmpeg/) and load the thumbnail via url just
like an external image. It's tricky to get it working, but once you do it
works wonderfully.

-Andy

On 1/8/07, john_69_11 <[EMAIL PROTECTED]> wrote:


  I'm trying to generate an image thumbnail of an FLV and can't seem to
find any way to do it. Only thing that people seem to be doing is
creating a player for the flv, then pausing and stopping the stream -
I want to grab an image of the one of the flv frames. I found a piece
of code here:

http://www.flash-db.com/Tutorials/snapshot/snapshot.php?page=2

which i tried to implement with code like this in onFrameEnter:

//Here we will copy pixels data
pixels = new Array()
//Create a new BitmapData
snap = new BitmapData(_video.width, _video.height);
//Matrix to scale the new image
var myMatrix:Matrix = new Matrix();
myMatrix.scale(0.5, 0.5)
//Copy video image
snap.draw(_video, myMatrix);

var w:Number = snap.width, tmp
var h:Number = snap.height
var a:Number = 0
for(var b=0; b<=h; b++){
tmp = snap.getPixel32(a, b).toString(16)
trace(tmp)
pixels.push(tmp.substr(1))
}
a++
if(a>w){ //Finish capturing

//sendData(pixels, h, w)
//free memory
snap.dispose()

}

Now, it seems like the pixels are being captured, but I'm not certian
and I can't seem to display the captured image at all. I've tried
using an image object and a Bitmap set to the BitmapData (variable
snap) but it doesn't display. Anyone know of how to make this work,
or a better way?

Thanks,

John

 



[flexcoders] FLV Thumbnail

2007-01-08 Thread john_69_11
I'm trying to generate an image thumbnail of an FLV and can't seem to
find any way to do it.  Only thing that people seem to be doing is
creating a player for the flv, then pausing and stopping the stream -
I want to grab an image of the one of the flv frames.  I found a piece
of code here:

http://www.flash-db.com/Tutorials/snapshot/snapshot.php?page=2

which i tried to implement with code like this in onFrameEnter:

//Here we will copy pixels data
pixels = new Array()
//Create a new BitmapData
snap = new BitmapData(_video.width, _video.height);
//Matrix to scale the new image
var myMatrix:Matrix = new Matrix();
myMatrix.scale(0.5, 0.5)
//Copy video image
snap.draw(_video,  myMatrix);

var w:Number = snap.width, tmp
var h:Number = snap.height  
var a:Number = 0 
for(var b=0; b<=h; b++){
tmp = snap.getPixel32(a, b).toString(16)
trace(tmp)
pixels.push(tmp.substr(1))
}
a++
if(a>w){ //Finish capturing

//sendData(pixels, h, w)
//free memory
snap.dispose()

} 

Now, it seems like the pixels are being captured, but I'm not certian
and I can't seem to display the captured image at all.  I've tried
using an image object and a Bitmap set to the BitmapData (variable
snap) but it doesn't display.  Anyone know of how to make this work,
or a better way?

Thanks,

John