bytedeco/javacv

Merge two videos files side by side horizontally

Open

#2,286 opened on Sep 25, 2024

View on GitHub
 (2 comments) (0 reactions) (0 assignees)Java (1,583 forks)batch import
help wantedquestion

Repository metrics

Stars
 (6,985 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

I have two webm files a.webm and b.webm having same dimensions and framerate. Purpose is to merge both videos side by side horizontally and get MP4 as output. For the same, I took reference code given in https://github.com/bytedeco/javacv/issues/955 post. But that did not work. I am not able to understand how the below code snippet working: while ((frame2 = grabber.grab()) != null) { if (frame2.image != null) { a++; } if (frame2.samples != null) { b++; } filter.push(0, frame2); filter.push(1, frame2); Frame frame3; while ((frame3 = filter.pull()) != null) { if (frame3.image != null) { c++; assertEquals(640, frame3.imageWidth); assertEquals(200, frame3.imageHeight); assertEquals(3, frame3.imageChannels); } if (frame3.samples != null) { d++; assertEquals(2, frame3.audioChannels); assertEquals(1, frame3.samples.length); assertTrue(frame3.samples[0] instanceof ByteBuffer); assertEquals(frame2.samples.length, frame3.samples.length); assertEquals(frame2.samples[0].limit(), frame3.samples[0].limit()); } } }

Please assist for the same.

Contributor guide