Search within Lanny's blog:


Leave me comments so I know people are actually reading my blogs! Thanks!

Tuesday, August 06, 2019

Daily Battles: How to Play Two Video Clips Simultaneously and Synchronously Side-by-Side

I was trying to compare two computer vision models on how well they handle object detection on certain scenarios and wanted to see the bounding boxes from each model drawn in the same clip and compare visually side by side. So I need a way to play two clips (same clip but with different bounding boxes drawn on top of them) synchronously so I can compare the exact same frame for both clips.

Problem Statement:
Be able to play two 1:1 ratio clips side by side simultaneously and synchronously (frame synced to frame) and be able to start and pause both clips simultaneously without spending any money on new software.
It was actually not easy to find the exact solution. Let me share with you what I learned.

Option 1: iMovie App on Mac

Obviously this tool is only available on a Mac. However, it is a free tool that comes with the Mac OS, which is handy.


The iMovie app has a split screen button that let you easily place two video clips side by side. Then you can even export the resulting split screen movie to a new video clip, so you can play them side by side again and again in the future.

You basically import two clips into the app, and then drag each one to the timeline with one above the other (not drag on on top of the other, which confused me quite a while). Selecting one of them in the timeline, and then click that split screen button. That's it!

This article link below will give you all the details.

iMovie for Mac: Create a split-screen effect

However, since my two clips are 1:1 ratio, and iMovie only allows for 16:9 and 4:3 ratio, my two side by side clips all got cropped automatically (because two clips side by side becomes 2:1, which is 18:9), and I lost a section of my clip on the left side for both clips. And there is absolutely no way to create custom size ratios in iMovie. You have to pay Apple money to get their better version of the app, which doesn't meet my requirement. So this is not a solution for me!

Option 2: VLC Media Player

VLC Media Player is a free and open source cross-platform multimedia player that runs on both Windows and Mac.



Many people have posted tutorials (such as the one linked below) on how to change some settings in VLC that will allow you to open multiple instances of the VLC app, thus, allowing you to play multiple clips at the same time. You basically uncheck a few checkboxes in settings (which is not available for the Mac version and you have to do some command line trick to get it working).

VLC HowTo/Play multiple instances

But opening multiple instances of the player doesn't let me control both clips in order to simultaneously start and pause. In order to that, I have to create complicated across instance hotkeys, which I won't do.

Inside the VLC player, there are actually functionalities built in to allow you to play two clips side by side with synchronous control. In the 3.0.X versions, you go to File--Advanced Open File, and you get this screen below:
In here you can supposedly specify two different clips to be played synchronously. I was so happy when I found this, and then I was so sad when I found out it doesn't work!!

Then I found that I am not the only one suffering. Someone else has already reported a bug to VLC:

#22495 new defect: Advanced File Open - Play another media synchronously not functioning in 3.0.x

AAAAAHHHH!!!!

Anyway, if you are willing to go back to the 2.x.x versions, this function still works there. You do create security risks if you downgrade though.

So again, not a solution for me!

Option 3: QuickTime Player

QuickTime player is another Mac built in multimedia player. You can double clip on your two clips to open two QuickTime windows and drag them to be side by side. But how can you play/pause both clips at the same time?


I did find this web page below that says you can either select "Play All Movies" from the Movie menu, or press command-option-space to start both clips at the same time. But guess what? I don't have the option of "Play All Movies." That is only available in the paid version of QuickTime Pro app! Dang! And command-option-space also doesn't work!! Dang!!

Play two movies simultaneously in QuickTime Player

After many trial and error, I finally figured out what works, and you are in luck!!

To start both clips at the same time, press Command-Enter. And to pause, press Command-Enter again!

That's it! And this would meet my needs. So problem solved and for this battle, I won!

Option 4: Command Line Tools

You can also play multiple videos side by side from command line control. But this requires installing and configuring frameworks, so not for the faint-hearted.

You can use gstreamer/gst-launch pipeline described in this article.

I've also heard you can use the tiling plugin in Nvidia's DeepStream SDK.

I will eventually get those working on my computer. For now, option 3 works for me!



Video of the Day:

Think of your life challenge as a bear approaching you. Don't panic and stay calm. The problem might not be that bad!




BTW: The easiest way to remember my blog address is http://lanny.lannyland.com

1 comment:

  1. Anonymous2:49 PM

    haha! this was problem you were dealing with last night!

    ReplyDelete