Split Screen Multiple Videos Tutorial (Sample Videos Added In Post 7)

  • Thread starter amp88
  • 20 comments
  • 77,112 views
3,746
As you'll have no doubt noticed if you've seen my recent posts here, I've been experimenting with combining multiple video streams into one video, giving a split screen effect (think of the programme 24).

I'd had the idea in my head for a while, but hadn't found a quick, easy and cheap/free solution. The closest I'd come was with Ulead VideoStudio, however this was not free and I could only get two video streams to run concurrently, in a picture-in-picture fashion, not in a true split screen fashion. So, I was searching again the other night when I came across AviSynth. AviSynth is a post-processing scripting language which allows the user to do various things such as add subtitles to video, resize video sources and adjust the brightness of video sources. It also allows stacking video sources (which is basically split screen).

Since AviSynth is a scripting language, you must write a script to do what you want, there is no GUI as with most modern programmes, allowing you to click on buttons and select options from menus. This means that it takes a bit of time to learn how to use it, but for something basic such as making a split screen video, the amount of time it takes is minimal.

Ok, so let's move on to the process...

1. Capturing Video

The first thing you have to do is to get the videos you want to edit. I've got a capture card (which is a piece of hardware you either put inside your PC or connect to it) which allows me to capture video straight from the PS2 to the PC, since I just play the game on my PC monitor. Having a capture card is the easiest way of capturing video from the PS2, since you can capture video from the PS2 in whatever resolution you like and at whatever compression level you like.

I capture video and audio uncompressed and usually at a resolution of 384x288. Capturing like this takes approximately 5.5 MB/sec (about 320-330 megabytes per minute), which means if you capture like this you'll need a lot of free hard drive space.

Alternatively, you can cap video and compress it on the fly. Capturing video compressed will means it takes up less space on your hard drive (anything from 5-40 megabytes per minute, depending on which codec you use to compress and what compression settings you apply), but if you compress the video while you're capturing it, you shouldn't compress it later on when you're putting the whole video together. If you compress the video twice the results won't look as good as if you just compressed the video once.

Important note: All the video you capture to use to make your split screen video MUST be captured at the same resolution and in the same format

2. Cropping your video sources

When you cap the videos, it can be difficult to just get what you want. You'll often end up with a few seconds of extra video before and after the video you want to use. You'll have to crop the video down to get rid of the stuff you don't want. For cropping video, I use a program called VirtualDub. VirtualDub is a powerful video editor which allows you to compress video and audio, capture video and join video files.

First load the video you want to crop into VirtualDub:



In this example, I've got a video of a BMW M3 CSL at Monaco. The video has a few seconds at the start and a few at the end I'd like to get rid of. Move the slider bar at the bottom until you get to the point you'd like to start cropping (you can use the left and right arrows on your keyboard to move forward and back a frame at a time, for fine adjustment) and click on the left arrow just to the left of "Frame..." about a third of the way along the bottom of the GUI. When you do this, you should see some text along the bottom of the GUI saying "Start offset set to x ms":



Then move the slider to the point where you'd like your video to end and click the right arrow. You should now see the text along the bottom change to "End offset set to x ms":



Now all you have to do is to save the part of the video you've selected. Go up to the Video menu and select "Direct stream copy". Then go to the File menu, select "Save as AVI" and choose where you'd like to save the cropped video. It should take a few seconds to save the video to your hard drive, depending on how long the clip is.

Ok, so that's the first video cropped. Repeat the process for all the videos you'd like to include in your split screen video.

3. Choosing your audio

The next thing to do is to think about the audio you'd like to use in your clip. If you're doing a split screen video of various angles of the same lap around the same track you might want to use the original audio (i.e. the engine and/or ingame music). If this is the case, then open one of your cropped videos into VirtualDub again and click on File > Save WAV...
Choose where you'd like to save the audio file and click OK. You can forget about the audio for a while now.

4. Writing the AviSynth Script

Now it's time to write the AviSynth script to join the video files. To do this, open up a text editor (Notepad is the best program to use on Windows, don't use Word) with a blank document. The first thing we have to do is to identify our video sources and give them names.

I'll write an example file below. My example file will use two video files and will arrange them together horizontally.

Code:
a = AviSource("L:\File 1.avi")
b = AviSource("L:\File 2.avi")

StackHorizontal(a,b)

You'll need to change the file paths (the "L:\File 1.avi" and "L:\File 2.avi") to wherever the files are on your PC. You can use Stack files horizontally and/or vertically. You can also have as many files as you like, but 9 is probably a good maximum limit. If you wanted to have 9 files stacked in a 3x3 grid arrangement, the file would look something like this:

Code:
a = AviSource("L:\File 1.avi")
b = AviSource("L:\File 2.avi")
c = AviSource("L:\File 3.avi")
d = AviSource("L:\File 4.avi")
e = AviSource("L:\File 5.avi")
f = AviSource("L:\File 6.avi")
g = AviSource("L:\File 7.avi")
h = AviSource("L:\File 8.avi")
i = AviSource("L:\File 9.avi")

StackHorizontal(StackVertical(a, b,c), StackVertical(d,e,f), StackVertical(g,h,i))

Once you're happy with the file, you'll have to save it as an AVS file. Go to File > Save, select where you'd like to save it and save it as split screen.avs

5. Opening your AVS file

Now you've written your avs file, you'll have to open it in your video editor. Again, I use VirtualDub for this. Drap and drop the avs file into VirtualDub. Several things can happen here. The first (and best) is that VirtualDub will open your avs file and you'll see your split screen arrangement:



If this happens, skip to the next section ("Choosing your audio").

The second possibility is that you get an error message something like this:

file open error.JPG


As this error suggests, VirtualDub couldn't open a file listed in your avs file. Open the avs file back up in the text editor and check the path of the video file at the line specified in the error (line 2, in this case). It's easy to make a mistake when typing/copying the file path. Fix the path, save the avs file and try again.

The third possibility is that you get an error message like this:

height error.JPG


This error is a bit more difficult to solve. You get this error because the stack command for avs files specifies that the arrangement must be rectangular or square. That is, you can't have 3 video files on the top line and only 2 on the bottom line, or you can't have 2 on the top line and 1 on the bottom.

Thus...

A B C
D E

is not valid, but

A B C
D E F

is valid.

The easiest way to solve this problem is just to remove the 'extra' videos, or to add in another video to make the arrangement rectangular or square. A slightly more complex solution (the one that I use), is to create a blank video to use as a spacer. If I turn off my PS2, there's no signal coming into my capture card. When I record this, I just get a black screen. Since this video came from the same source as the rest of the videos, it's the same size and format as the other videos I capture. This is valid for the avs file. This black screen is then used as another input video for the avs file.

The fourth possibility is that you get an error like this:

image format error.JPG


This error means that the videos you're trying to open aren't in the same format. If you get this error it's most likely because a different codec has been used to compress the videos. A way to solve this is just to compress all of the videos with the same codec. If you don't know how to find out what codec a video is compressed with, download GSpot and then open the video file in GSpot. You should then see something like this:



Look in the Video pane on the right hand side in the Codec field. If you're trying to make a video with 4 streams and you find 3 are compressed with divx and the fourth is compressed with xvid, it's obviously a good idea to just compress the xvid one to divx. To compress the video, open it in VirtualDub, go to Video > Compression and choose the relevant codec. Then go to File > Save as AVI and choose where to put the file. Now change your avs file to point to the corrected video file and try opening it again. Hopefully it should work this tim.

There will be other possibilites for errors, but these are the only ones I've encountered myself.

6. Saving Your Video

Ok, we're on to the last step. So far, you've captured your video, cropped it to the right size, got the audio sorted, written your avs file and opened your avs file in VirtualDub. Now all we have to do is to save our video file to the hard drive.

As I said before, when I cap my videos I cap them uncompressed. This stage is where I compress them. If you compressed your videos when you captured them, go to the video menu and select "direct stream copy", unless you want to compress the video again. To choose the compression for your video, go to Video > Compression. You'll be shown a pop-up window with a choice of the different codecs you've got on your system, something like this:

codecs.JPG


It's your choice what codec you use to compress your video. I generally use DivX 5.2.1 for game videos because it gives good compression with high video quality. If you've never compressed video before and aren't sure which codec or compression settings to use, experiment with different codecs and different compression settings and see what you like. To change the compression settings for a particular codec, choose the codec and click on "Configure". The configuration window for that particular codec will then be shown, along with different settings, such as the average bit rate and/or quality/size sliders. You can mess about in here. The higher the bit rate you select, the better the quality should be, but the bigger the file will be.

Once you've chosen your codec and configuration you're almost ready to save your video.

The last thing to do is to choose the audio you'd like to use in your clip. If you saved the WAV file earlier in step 3, go to Audio > WAV Audio and select the audio file you saved earlier.

If you're putting together a clip of various different cars at different tracks and you don't want to use the original sound from the game (because all the engines will be out of sync, obviously), go to Audio > No Audio.

If you'd like to put in your own audio (a song, for example), then go to Audio > WAV Audio and find the track you'd like.

Now, all you need to do is to save the video file. Go to File > Save as AVI and choose where you'd like to save your video file. When you click on Save, your video should start to be compressed and you should see something like this:

compressing video.JPG


Depending on numerous factors such as your system configuration, number of video streams, codec, chosen bitrate, audio, length of the video clips etc the video should take between 2 and 10 times the length of the longest clip to save (i.e. a 2 minute long video clip should take between 2 and 20 minutes to save). Be patient! :)
 
kennythebomb
Awesome tutorial, very thoroough, I hope people can use it for their benefit :)

Thanks :)

Hopefully people who read the guide will take at least something away from it, even if they don't use it to produce any split screen videos.
 
Thanks. I've got a few examples but don't really have the ability to host them for any length of time. Here's an example of a 5 stream video of a Caterham around Laguna Seca though.

edit: Link removed, dead
 
I found some of the videos I made for this whilst rummaging on the PC this morning, so I've re-uploaded a few of them if anyone's interested.

BMW M3 GTR Race Car - GT4 vs Real Life Comparison (click the preview picture for the video)


40.4MB

Lotus Carlton (standard) Trial Mountain B Spec Comparison (click the preview picture for the video)


10.9MB

A 6 stream video, 5 for each of the B Spec aggression levels and an A Spec lap by me in the bottom right hand corner.

Caterham Laguna Seca lap. Multiple views of the same lap, with sound (click the preview picture for the video).


9.7MB

Fully modified Audi R8 B Spec Comparison Videos.

Fuji


7.4MB

Infineon


7.9MB

Tsukuba


4.8MB

edit: I've got no idea how this thread got 1700 views with only 6 replies. People need to appreciate decent work more! :P
 
Wow. This is really cool. I can't do that since I dont have a capture card, But you can do some really cool stuff other than comparisions. Like a race. Have the in car or top of car view for all the cars, so it looks like a live in car camera. Then you could see all the cutting off and pushing etc. That would be cool. :D
 
Very nice tutorial, nice job man.👍

Check out your vids, only the bmw and lotus really work. From Catheram video, files had expired due to inactivity.:ouch:
 
Man how the **** do you watch these vids? I click on them and it takes me to megaupload, but doesnt show the video....get it working or tell me how to watch them......But as for the tutorial, its very thourough, really good job on it...just wish i could see your videos...
 
Man how the **** do you watch these vids? I click on them and it takes me to megaupload, but doesnt show the video....get it working or tell me how to watch them......But as for the tutorial, its very thourough, really good job on it...just wish i could see your videos...

Sorry it took me so long to reply to this but I must have missed your reply and I only check the links in my sig every once in a while. To view the videos, click on the link to the file (the preview picture) and you'll be taken to the MegaUpload page for the video. Then you have to enter the validation code into the box on the page (like this) and click on download. You have to wait roughly 45 seconds then click on the "Click here to download" button after the 45 seconds is up.
 
Great tutorial it will really help when i try to put vids up. 👍 :)
 
I'd really like to see some video that demonstrates this. Did this thread move or what? I'm going to try this regardless and since I'll be using this page as a guide, I'll post a link to whatever junk I produce and upload to YouTube.
 
This is something I did just to see how it looks. This is the stackhorizontal script with videos a and b. It worked really fast, but I had to use DirectShowSource for the DV from my Sony camera. Sorry it's so dark...



And this one (no audio) with four panes.

 
Hy guys!
My name is Marcos, I`m a Brazillian guy and I have a question for you...
I would like to do a GT4 race contest here in my office, and I would like to take a Video to...
Like the picture of the video (BMW M3 GTR Race Car) Post N#7

The idea is a large video with the race and in the corner a small video with the players...

How can i do this in VirtualDub???
(I can do the Split Screen like you guys, but I would like to do something diferent in this time)

Thanks

Marcos
 
how come when i add the videos in and everything no errors and the videos i watched each of them they are fine with same format same everything with CamStudio and together it has this weird pixelated thing where its moving....
in9ulh.jpg
 
Ok, thankfully i ran across this, and learned how to do avisynth. an unedited video, or two videos work perfectly when i script it out after running it thru vd and then into my videopad from NCH software! but when i edit them first, then follow the same steps.... it takes away half of the time and slows it down by half! what am i doing wrong? please help! I have a music video to shoot and it's crucial that i have the edited split screen!

Thanks
 
I know this is a old forum but still hoping to get some replies.
I have two IP cameras, i like to view both of them in my screen simultaenously by split screen. Can i use AVISynth to do that? (I am pretty new to AVISynth and yet to learn it). Is there any better way to do it? I do not want commercial or off shelf s/w as i am planning to write my won app and extend it to my requirements later.

Thanks
 
Back