Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FLV to JPEG conversion

Ramya Rajan
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need to convert a FLV ( Flash Video ) file to a JPEG file by capturing its first frame. I have gone through the FLV format specification and was able to grab the video data of the first frame. But falied when tried to load the byte array into an Image object. Code snippet and Error is shown below. Please help me.
Image pic = Toolkit.getDefaultToolkit().createImage( dataimage ); // dataimage is an array of bytes
MediaTracker tracker = new MediaTracker(new Frame());
tracker.addImage( pic, 0 );
try { tracker.waitForID(0); }
catch (InterruptedException e) { e.printStackTrace(); }

if (tracker.statusID(0, true) != MediaTracker.COMPLETE)
throw new AWTException("Could not load: " + tracker.statusID(0, true));

Error: java.awt.AWTException: Could not load: 4
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic