This discussion is archived
1 Reply Latest reply: Jun 8, 2011 8:10 AM by captfoss RSS

FramePositioningControl and FrameGrabbingControl Problems

867162 Newbie
Currently Being Moderated
This is my first question in Oracle Forums and i hope anybody is here for help.

I'am new to JMF (and Media Processing too) and try to develop a custom MediaPlayer using JMF with FOBS(ver. 0.4.2). Swing as GUI toolkit.
The application is just for playing files, getting and displaying media information for each file (during playing) and doing some custom processing on the videos as needed.
Playing the file and displaying the basic video information part is ok but i had stuck in frame grabbing and frame positioning.

In the situation below, player is in started state and below code fragment run in an another worker thread
FrameGrabbingControl grabber = (FrameGrabbingControl)player.getControl("javax.media.control.FrameGrabbingControl");
Buffer imageBuffer = grabber.grabFrame();
The problem is grabFrame is always returning null but the player (aslo JMSStudio) can play the file. I tried with a couple of files, the files were played successfully but
grabFrame failed too.

and the other problem is here.
FramePositioningControl posser = (FramePositioningControl)player.getControl("javax.media.control.FramePositioningControl");
Time duration = player.getDuration();
//duration.getSeconds() prints 58.0000001
//and duration != Duration.DURATION_UNKNOWN
posser.mapTimeToFrame(duration); // returns 0 all the time.
as far as i learned as long as the player can play the file these controls should work!?
Since both controls fail i suspected that i may be doing sth wrong but could not find the cause of the failure.

Did i miss sth, or doing wrong?

Thanks in advance

----Partly Solved---
A little more investigation, it turned out that FOBS grabFrame () implementation has a bug returning always null.

Edited by: dsaran on Jun 8, 2011 4:58 AM
  • 1. Re: FramePositioningControl and FrameGrabbingControl Problems
    captfoss Pro
    Currently Being Moderated
    dsaran wrote:
    as far as i learned as long as the player can play the file these controls should work!?
    Since both controls fail i suspected that i may be doing sth wrong but could not find the cause of the failure.

    Did i miss sth, or doing wrong?
    There is no guarantee that just because the file is playable that you can use a FrameGrabbing control to grab frames from it. Same deal with the positioning control... they aren't guaranteed to work for all types of media.

    A more robust way of grabbing frames involves using a pass-through codec to give you access to the actual video stream.
    http://web.archive.org/web/20080316220310/http://java.sun.com/products/java-media/jmf/2.1.1/solutions/FrameAccess.html

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points