Grab two parts inside a video (not trimming) and save it

I have a video of 2000 x 200 pixels in resolution I need to grab two parts inside that video (cut into the image, not trimming).

I need to grab a piece of 500 x 200 pixels from coordinates (0,0) and another 500 x 200 pixels from coordinates (1000,0), then merge them side by side into a new 1000 x pixels video file.

I need video + sound and keep settings the same as source (framerate, encoding…)

is that possible ?

if your final outcome is just for displaying these two sections i would use:

vidGrabber.getTexture().drawSubsection(<#float x#>, <#float y#>, <#float w#>, <#float h#>, <#float sx#>, <#float sy#>)

but if you need a new video file as a result that can get saved on the disk i would make an ofFBO, use drawSubsection to draw your two selections side by side inside the ofFBO and use one of the multiple video or image recording addons/methods.
ofxSyphon + syphon recorder

thanks for the answer.
yes i ended up thinking about the FBO solution so i will dig into it.
Meanwhile, i thought about another solution which is damn efficient : using ffmpeg
it is also non destructive as i don’t re-encode the video for saving it.

not an openFrameworks solution, but for the record :

ffmpeg -i -filter_complex "[0]crop=500:200:0:0[l];[0]crop=500:200:1000:0[r];[l][r]hstack"
1 Like