Tools - ImmersiveStorytelling/DocumentationMasterclass GitHub Wiki
FFmpeg is a free command-line tool for converting video and audio files.
The video files in our Unity projects have the .hpv extension while the 360°-video files are .mp4.
We convert the .mp4 file to an image sequence with FFmpeg so we can then convert it to a .hpv file with the HPVCreator-tool.
Using the FFmpeg-tool:
-
Windows 10:
- Open the Ubuntu-app
-
cd
to the location of your .mp4 file you want to convert (usecd /mnt
to choose your HDD) - Using
mkdir {folderName}
you can create a folder where FFmpeg should save the image sequences it creates - The
ffmpeg -i videoToConvert.mp4 -f image2 /pathToFolder/nameOfImageSequence-%06d.png
command will start FFmpeg converting the .mp4 video to an image sequence.
-
Windows 8 or lower:
- Open a commandprompt
-
cd
to the location of your ffmpeg.exe file - Using
mkdir {pathToFolder/folderName}
you can create a folder where FFmpeg should save the image sequences it creates (example:mkdir C:\Users\eaict\Desktop\testDirectory
will create a directory calledtestDirectory
on the Desktop, located on the C-drive, while our ffmpeg.exe is on the E-drive) - The
ffmpeg -i videoToConvert.mp4 -f image2 /pathToFolder/nameOfImageSequence-%06d.png
command will start FFmpeg converting the .mp4 video to an image sequence.
-
Linux and OSX:
- Open your terminal
-
cd
to the location of your .mp4 file you want to convert - Using
mkdir {folderName}
you can create a folder where FFmpeg should save the image sequences it creates - The
ffmpeg -i videoToConvert.mp4 -f image2 /pathToFolder/nameOfImageSequence-%06d.png
command will start FFmpeg converting the .mp4 video to an image sequence.
NOTE:
On Windows 8 or lower, you should download FFmpeg from this website.
On Linux/OSX, depending on your system, it is possible you should install FFmpeg through you package manager.
The HPVCreator-tool creates .hpv (High Performance Video) files that can be imported in Unity.
Download the tool from this page for your system and open it.
For the input path, you choose the folder where FFmpeg saved the image sequence.
Choose an output path and click 'Convert'.
Now, a .hpv-file is created and we can start using it in Unity.
Take a look at this example.
You'll see you should have the EventProcessor.cs
, HPV_Manager.cs
, HPV_Node.cs
and SingletonService.cs
files.
You should add the EventProcessor.cs
, HPV_Manager.cs
and SingletonService.cs
as components to a GameObject in Unity.
Then you add the HPV_Node.cs
to a Sphere you created in your scene.
When you place your .hpv-file in the Assets-folder of you Unity project and edit the Filename in the HPV_node.cs, the video should work out of the box.
In code, you'll be able to edit the speed of playing, the direction the film plays... but that will be explaned in the Code-wiki.
Another more effecient solution is to see if it's possible to place mp4 video's in the code, so that converting the files isn't needed anymore. We used the above listed tools because five years ago there wasn't much virtual reality support. Unity didn't support 360° mp4 video files. Now they do. This needs some further research.