mkersten
mkersten

Reputation: 714

Comparing multiple frames in a video

I would like to view a few frames at the same time in a video, say frame k, k+1, k+2,..., k+7 such that they are shown on the screen next to each other (or as a matrix). Then stepping forward/backward one frame at the time.

Is there an open-source, free player (with specific extension) to realise this

regars, Martin

Upvotes: 0

Views: 664

Answers (2)

Mick
Mick

Reputation: 25491

In addition to the approach suggest by Rotem, which has the advantage you can then play it in any player, you can also use a frame accurate online player and stream the video to two players at the same time.

In other words, you can open two browser windows side by send and stream the same video going from frame to frame as required on each.

There are several online players which will allow you do this including popular 3rd party ones like BitMovin, FlowPlayer, TheoPlayer etc. Most of these will have free demo accounts you can use to see if the approach is right for you. See an example shown below using BitMovin:

enter image description here

It is also possible to leverage the open source video.js for this - see this article on frame accuracy playback for subtitles as an example: https://cleriotsimon.com/posts/videojs-frame-accurate-subtitles/

Upvotes: 0

Rotem
Rotem

Reputation: 32114

You can use FFmpeg for encoding the desired result as a video file.

FFmpeg is "A complete, cross-platform solution to record, convert and stream audio and video", and it's free.
Download the static linked version, to be used as command line tool.

For demonstrating the solution, use FFmpeg for creating a test patter video.
The following command creates 5 seconds 160x120 uncompressed AVI video file at 10fps (the test pattern in.avi includes a frame counter):

ffmpeg -y -r 10 -f lavfi -i testsrc=duration=50:size=160x120:rate=1 -c:v rawvideo -pix_fmt bgr24 in.avi

The following command, stacks frame k, k+1, k+2,..., k+7 in two rows:

ffmpeg -y -ss 00:00:00.000 -i in.avi -ss 00:00:00.100 -i in.avi -ss 00:00:00.200 -i in.avi -ss 00:00:00.300 -i in.avi -ss 00:00:00.400 -i in.avi -ss 00:00:00.500 -i in.avi -ss 00:00:00.600 -i in.avi -ss 00:00:00.700 -i in.avi -filter_complex "[0:v][1:v][2:v][3:v]hstack=inputs=4[top];[4:v][5:v][6:v][7:v]hstack=inputs=4[bottom];[top][bottom]vstack=inputs=2[v]" -map "[v]" -c:v rawvideo -pix_fmt bgr24 out.avi

The -ss 00:00:00.100, -ss 00:00:00.200... increased by 100msec, the duration of single frame.
Adjust the times according to the frame rate of your input video.

-c:v rawvideo -pix_fmt bgr24 out.avi creates uncompressed AVI video file.
I selected uncompressed video, for avoiding re-encoding artifacts (the price is a very large file).

You can step forward/backward in any video player.
I know it's not the solution you were searching for, but I hope it fits...

Output sample frame:
enter image description here

Upvotes: 1

Related Questions