How to combine multiple videos together:

1,176 views
Skip to first unread message

gunvant sahu

unread,
Apr 18, 2011, 4:23:46 PM4/18/11
to xuggle...@googlegroups.com



Hello All

I am looking for a solution in xuggler. Please have a look into this site

http://www.shervinemami.co.cc/openCV.html%22

I want to combine videos like this. Is this possible with xuggler?

Thanks in advance

Gunvant


DroidMunkey

unread,
Apr 18, 2011, 5:01:12 PM4/18/11
to xuggler-users
yes it is possible if you write the code to do it yourself. otherwise
you'd have to wait around for octopus http://www.xuggle.com/octopus/
if it ever gets released

http://www.shervinemami.co.cc/openCV.html this site says it drops the
audio streams from the videos- you could easily keep the audio from
one of the streams (if you wanna combine two audio streams into a
single one it gets trickier, but I'm sure you could find java
examples)

redoing the same crap they have would be fairly easy- you just read
both videos at the same time, combine the decoded image from each, and
then write the pictures out to a separate encoder with the width/
height adjusted.

exactly how you do it really depends on where you are getting the
videos/images from. (webcam, video stream or files)

--Robert

Gunnu

unread,
Apr 19, 2011, 4:04:39 AM4/19/11
to xuggler-users
Hello Robert,
Thanks for your reply. I need some clarification.

" yes it is possible if you write the code to do it yourself. " is
this meaning that there is no API in xuggler by which this
functionality is possible?

I will be getting videos as a file. So, will you please guide me how
to proceed further. Some code snippet will be very helpful.

Thanks


On Apr 19, 2:01 am, DroidMunkey <kinkymun...@gmail.com> wrote:
> yes it is possible if you write the code to do it yourself.  otherwise
> you'd have to wait around for octopus  http://www.xuggle.com/octopus/
> if it ever gets released
>
> http://www.shervinemami.co.cc/openCV.html this site says it drops the
> audio streams from the videos- you could easily keep the audio from
> one of the streams (if you wanna combine two audio streams into a
> single one it gets trickier, but I'm sure you could find java
> examples)
>
> redoing the same crap they have would be fairly easy- you just read
> both videos at the same time, combine the decoded image from each, and
> then write the pictures out to a separate encoder with the width/
> height adjusted.
>
> exactly how you do it really depends on where you are getting the
> videos/images from. (webcam, video stream or files)
>
> --Robert
>

DroidMunkey

unread,
Apr 19, 2011, 11:33:34 AM4/19/11
to xuggler-users
more like - they are working on one that would do everything for
you. the current APIs would let you do this- you just have to do all
the hard stuff like syncing the two streams yourself

right now- you have to open the two files- read them both in (which
will give you raw pictures) then combine the two pictures in java and
write them out to another file (so, two decoders and one encoder)

also you have to pay attention to the timestamps on each video frame
if you need to keep the two videos in sync (one could be 10 frames per
second, the other could be 30 fps - so 1 frame in the first video will
need to be shown for 3 frames in the other video) the easy way would
be to figure out which one had a higher FPS (higher time resolution)
and use that.

Read A (1)
Read B (1)
Read A (2)
Read B (2)
if (b2 timestamp > a2 timestamp) show b1 again otherwise show b2 and
read b3)
Read A (3)
if (this b > this a) show last b, otherwise show this B and increment

http://xuggle.googlecode.com/svn/trunk/java/xuggle-xuggler/src/com/xuggle/xuggler/demos/
checkout the demos for examples on reading files.

--Robert

Gunnu

unread,
Apr 29, 2011, 8:36:48 AM4/29/11
to xuggler-users
Thank you very much. You rock.......
I have followed the steps which you have told for combining videos and
got success to combine the videos from two files into one. :)

Now, I have to combine(mix) audios as well. Will you please guide me
to achieve this thing?
I have searched on the internet but unable to find an example or
something like this.
In the link(which i have given " http://www.shervinemami.co.cc/openCV.html
"), given example doesn't deal with the audios but i have to do that
thing as well.


Thanks
Gunnu


On Apr 19, 8:33 pm, DroidMunkey <kinkymun...@gmail.com> wrote:
> more like - they are working on one that would do everything for
> you.   the current APIs would let you do this- you just have to do all
> the hard stuff like syncing the two streams yourself
>
> right now- you have to open the two files- read them both in (which
> will give you raw pictures) then combine the two pictures in java and
> write them out to another file  (so, two decoders and one encoder)
>
> also you have to pay attention to the timestamps on each video frame
> if you need to keep the two videos in sync (one could be 10 frames per
> second, the other could be 30 fps - so 1 frame in the first video will
> need to be shown for 3 frames in the other video) the easy way would
> be to figure out which one had a higher FPS (higher time resolution)
> and use that.
>
> Read A (1)
> Read B (1)
> Read A (2)
> Read B (2)
> if (b2 timestamp > a2 timestamp) show b1 again otherwise show b2 and
> read b3)
> Read A (3)
> if (this b > this a) show last b, otherwise show this B and increment
>
> http://xuggle.googlecode.com/svn/trunk/java/xuggle-xuggler/src/com/xu...
Reply all
Reply to author
Forward
0 new messages