Friday, March 27, 2015

Preparing Media For The 3Sixty Space at York

3:54 AM




In a recent student project to create archaeological exhibitions in the 3Sixty space we needed to look at how to easily chop a very wide movie into four separate smaller movies.

There are lots of templates to help you present in the 3Sixty space, including Powerpoint files but we also needed a way to view the presentations NOT in the space itself which would require some form of 3D version of a 2D presentation shown in real 3D. Are you keeping up? We needed a version of the presentation that could be viewed on screen rather than in the room.

I found a python library that would let you edit videos using code called MoviePy. It's brilliant! You can do video-in-video effects, split panel videos, animations, freeze frames and all sorts.

So, with the code below, we were able to take a VERY WIDE movie generated by the Powerpoint template being exported as a movie... and make four separate movie files, one for each wall.



from moviepy.editor import *
from moviepy.video.fx.all import *

movie_file = "/Library/WebServer/Documents/Three.js/ExportedFromPowerpoint.mp4"
w = 1440 #3840 #width of full movie
h = 244 #600 #height of full movie
s = w / 4 #individual screen size i.e 960
print "Chopping..." #.subclip((0,0.0), (1,10.0))

clip1 = (VideoFileClip(movie_file))
wall1 = crop(clip1, x1=0, y1=0, x2=s, y2=h) #Wall 1
#wall1 = wall1.without_audio()
wall1.write_videofile("wall1.mp4", codec='libx264')
print "Chopped: wall1.mp4", wall1.duration, "seconds long."


clip2 = (VideoFileClip(movie_file))
wall2 = crop(clip2, x1=s, y1=0, x2=s*2, y2=h) # Wall 2
wall2 = wall2.without_audio()
wall2.write_videofile("wall2.mp4", codec='libx264')

print "Chopped: wall2.mp4", wall2.duration, "seconds long."

clip3 = (VideoFileClip(movie_file))
wall3 = crop(clip3, x1=s*2, y1=0, x2=s*3, y2=h) # Wall 3
wall3 = wall3.without_audio()
wall3.write_videofile("wall3.mp4", codec='libx264')
print "Chopped: wall3.mp4", wall3.duration, "seconds long."

clip4 = (VideoFileClip(movie_file))
wall4 = crop(clip4, x1=s*3, y1=0, x2=s*4, y2=h) # Wall 4
wall4 = wall4.without_audio()
wall4.write_videofile("wall4.mp4", codec='libx264')
print "Chopped: wall4.mp4", wall4.duration, "seconds long."

print "Chopped: All done!"

It's worth noting that we only needed audio on one of the movies, otherwise four tracks of the same audio played causing a weird echo effect.  Also, unless the codec was libx264, the movies didn't load into the Three.js space.

After this we were then able to use the movies in a 3D simulation of the room.

See how this was used here.

Written by

We are one of the initiators of the development of information technology in understanding the need for a solution that is familiar and close to us.

0 comments:

Post a Comment

 

© 2013 Klick Dev. All rights resevered.

Back To Top