0

I need to playback video programmatically forward and backward, by having a slider that sets the playback speed and direction; with about 150-400 fps. Visually, it would be like:

[-10x][-8x][-4x][-2x][1/8x][1/4x][1/2x][1x][2x][4x][6x][8x][10x]

And slowly transitioning between these.

What I've tried:

  1. JavaFX Media player:

    • 24fps video, forward: works fine for normal playback
    • 24fps video, backward: I tried to use the seek() method, but it lags and won't let me set the milliseconds, as it converts the value to seconds later and looses the actual value.
  2. vlcj player:

    • 24fps video, forward: work fine for 1x to 10x playback rate, and of course I see frames changing at /2x, /4x etc.
    • 24fps video, backward: I tried to use the setTime() method, which seems to be working fine, by pausing the video and decreasing 1ms from current time, every 1ms. But it is laggy of course. Even for 50ms, and 100ms.
    • 400fps video, forward: lags dramatically on all speeds from 1x to 10x; but works great on /2x and lower rate.
    • 400fps video, backward: could not get it working same way by decreasing 1ms, but it worked smooth by decreasing 20ms every 20ms. Unfortunately, no slow motion could be achieved, it plays very fast.
  3. Usual VLC Media Player:

    • 400fps video, forward: the video still lags at 1x, and plays smooth at 1/2x and below. Inside the player below the seek bar, I could see a loading progress bar, which as I suppose, does not manage to playback at 1x the 400 fps video, as it needs to process too many frames. And most probable, to get it working this way, a powerful machine would be needed (but it seems to be a waste of power).

Now I could only think of the following solutions:

  1. Have 2 videos prepared forward and backward, put them above each other, always do forward playback, and keep them synchronised as following:

    backwardVideo.time = backwardVideo.totalLength - forwardVideo.time;

    And when playing forward, I would show only the forward going video; then when playing backward, I would hide the forward video from top layer, and leave the backward video visible which would look like its playing backward. Then I am left with solving the fast playback of a high fps video, so that it does not lag at higher rates.

  2. Do it by processing frames from files with a buffer depending on fps and computer power. That would be like mjpeg player, which would load all photos from a folder.

    As suggested here: I strongly recommend you to save frames to files.

    So, for a 90sec video with 300fps, its only 27000 photos (which is not that of a big deal for a powerful pc with a fast disk read speed).

  3. Have a video encoded that does not subtract the frame differences, and use the frames with a buffer to playback them (it should be very slow as suggested here as well)

Notes:

  • I will be using a PC with: i7 6th Gen, GTX980 4Gb video card, 16gb ram.
  • The video would be about 90 seconds long, with a resolution of about 2k.
  • I would prefer a solution for java, but if there is a great solution in any other technology, then I'm all for it.

So, what do you think is the best way to playback smoothly forward and backward a high fps video?

Community
  • 1
  • 1
Filip Luchianenco
  • 6,912
  • 9
  • 41
  • 63
  • Does it actually have to show all the 400 frames in a second, or just some of the frames considering most monitor setups won't refresh faster than 60 fps? – john16384 Mar 24 '17 at 16:32
  • it was more for the slow motion. Now we got to the conclusion that it can be 24fps, but the actual content to be 5x slower; so in order to have a slow motion, we would play 24fps, and a normal speed would be 120fps etc. which is lower than we thought before. – Filip Luchianenco Mar 26 '17 at 01:37

0 Answers0