Once I was born in my head the question of how the video would look if you look at it from the side. That is, if you put all the video frames in a stack one by one, then cut this pile into parts along the time axis, thereby obtaining frames for a new video:
But on the Internet I did not find the answer. Finally, got the hands to do this experiment.
')
The width of the new video in this case is equal to the number of frames of the original, and the number of frames of the new video is the width of the original. I figured it was better to limit myself to a small video format (640x360) and a segment of 640 frames, so that the final video was not tedious in time and sufficient for observing the effect. Exported frames from VirtualDub to png, sketched a program for Node.js (which came first in hand), processed, gathered new frames back into the video. And that's what happened.
Source video:
Side view:
The result was more interesting than I expected. I thought fewer recognizable parts would be. I looked several times to see each scene, then decided to look "from above".
View from above:
The top view turned out to be square, shorter (360 frames) and less fun. Considering the experience gained, I tried to pick up a scene that would have looked more interesting - with full-length characters moving smoothly relative to the camera or a close-up face.
Source video:
Side view:
Here is the code, if anyone is interested
var FRAME_WIDTH = 640; var FRAME_HEIGHT = 360; var FRAMES_COUNT = 640; var fs = require('fs'); var PNG = require('node-png').PNG; functionmakeFileName(i, prefix) { prefix = prefix || "src2/"; return prefix + ("000" + i).substr(-4) + ".png"; } functionaddStripe(dstFrame, dstFrameIdx, srcFrameIdx, callback) { fs.createReadStream(makeFileName(srcFrameIdx)).pipe(new PNG({filterType: 4})).on("parsed", function () { for (var p = 0; p < FRAME_HEIGHT; p++) { var srcIdx = (FRAME_WIDTH * p + (FRAME_WIDTH - dstFrameIdx - 1)) << 2; var dstIdx = (FRAMES_COUNT * p + srcFrameIdx) << 2; dstFrame.data[dstIdx] = this.data[srcIdx]; dstFrame.data[dstIdx + 1] = this.data[srcIdx + 1]; dstFrame.data[dstIdx + 2] = this.data[srcIdx + 2]; dstFrame.data[dstIdx + 3] = this.data[srcIdx + 3]; } if (++srcFrameIdx < FRAMES_COUNT) { addStripe(dstFrame, dstFrameIdx, srcFrameIdx, callback); } else { dstFrame.pack().pipe(fs.createWriteStream(makeFileName(dstFrameIdx, "dst2/"))).on("finish", callback); } }); } functioncreateFrame(dstFrameIdx) { addStripe(new PNG({ width: FRAMES_COUNT, height: FRAME_HEIGHT }), dstFrameIdx, 0, function () { console.log("done " + dstFrameIdx); if (++dstFrameIdx < FRAME_WIDTH) { createFrame(dstFrameIdx); } }); } createFrame(+process.argv[2]);
I did not try and did not think about optimization, I wanted to get at least some kind of result. After processing the first frames, I realized that there was not a lot of waiting (10-15 minutes), if I started several processes at once, and calmed down.
YouTube seems to spoil the quality of the video a bit, so I attach the original files just in case. By the way, the video "from another direction" is compressed worse with the same codec settings.
If someone has already done something similar or met, or have other ideas for an unusual presentation of a video or sound, share in the comments. Thanks for attention :)