mass video cutting with OpenCV? [closed]
I want to render a mp4 video in python, which is "patchworked" through multiple mp4 videos (same format specs cause its from my cam). So I have as an input e.g. 10-100 vids with length of 4-60 sec and want to cut multiple parts (~500-2000 cuts) out of them all and render it as one 5-10min video. Visualy or auditiv it can be understand like something from Xenakis work
Pseudocode
//input
v1 = readvid(path1)
v2 = readvid(path2)
....
//create
v = new video(mp4, size, bitrate, ...)
//basic Algorithm
position = 0
for (i=1:100)
toAddVid = chooseRandomVidFromList()
startframeOfInput = int randomNumber()*10000
durationOfInputInFrames = int randomNumber()*1000
v.add(toAddVid = v1, positionOfVideo = position, startframeOfInput, durationOfInputInFrames)
position += durationOfInputInFrames
end;
//output
v.render()
So I need a video-read-methode, a video-create-methode, a video-append/cut-methode and a video-render-methode.
Which are some extras, but are not a must-have
Blending/transperency:
v.append(v1, positionOfVideo = 50, startframeOfInput = 1000, durationOfInputInFrames = 200, transparency = 0.5)
v.append(v2, positionOfVideo = 50, startframeOfInput = 1000, durationOfInputInFrames = 100, transparency = 0.5)
//so the output video has as the 50th frame the frame of v1 and v2 each with 50% transperency to the 150th and from 150th to 250th only the framse of v2
also extra: variable speed of the input video:
v.append(v1, positionOfVideo = 0, startframeOfInput = 1000, durationOfInputInFrames =4, speed=2 )
//so he render at the beginning of the output vid the frame 1000, 1002, 1004, 1006 instead 1000, 1001, 1002, 1003
I found now that OpenCV support something of this. I'm new with OpenCV and it will take a while, so please excuse me for my pseudocode. I'm not sure if OpenCV is the right tool for my problem, because OpenCV focusses on images and with so many cuts and videos it could be maybe to much to handle, so I want ask you, if this is the right tool, or if something could be better.
Also I want to ask you, if it would be better to use OpenCV with c++. I like to code with python more, because for the quick tetsting in the shell (I have just octave knowledge with some self coded image processing algorithm, no plain python), but maybe I could archive my goal just with c++ speed,
definitely the wrong library for your task !
use ffmpeg, gstreamer, vlc or such. opencv is a computer-vision library, not a video editing one !