Journal

360-degree-video-tutorial

A first try at an HD 360 degree video for YouTube, from Fragmentarium BMP frames to an uploaded 4K equirectangular video.

Introduction

Hi all ! This is my first try at a HD 360 degree video to be uploaded to Youtube.
My first goal was, as recommended by youtube to upload a 8192 x 4096 video to get the full 4K 360 degrees experience. So that’s exactly what I tried to do.  As you will see here under, that mission was more difficult than first expected.
First a little Warning : File size while working in those resolutions can be huge, especially using uncompressed video files. Check that you’ve got enough free hard drive space (> 100 Go, depending on the video length of course) before starting. Also working with such files can obviously lead to very long processing and rendering time. I included some various rendering times that might be helpful to estimate the length of the process.

Here are my laptop specs
Windows 7 64 bits
32 Go DDR4
I7 4700MQ @ 2.4 Ghz
Working on regular 1.5 To HDD 7200 r/m

Workflow

1. Create the content

I made the content of my first video using Fragmentarium with a modified glsl snippet based on  archive. The Fragmentarium version I used is Fragmentarium-1.0.30-3Dickulus which has allows to make spline cam paths, among some other very interesting features.  I might publish the source code later on.

Fragmentarium outputs a sequence of uncompressed files (BMP). For my first test I used 3500 pictures, rendered at 8192 × 4096. I will not go into details about the rendering process but it took about one week to render the files on a GTX 980ti.

2. From BMP to uncompressed AVI

As my output is a list of BMP files my first task is to render the sequence as a full video file. I tried to output a mp4 file using various tools but all of them crashed, ran out of memory or did other random stuff I wasn’t look for. I could of course have used ffmpeg for the whole process but I was using my windows laptop and I first thought my usual tools would do the job easily.

Using the trusted and open-source VirtuaDub I first made an uncompressed avi file with the correct size and frame rate settings. Virtudub automatically understands that a list of ordered bmps or jpgs are frames of a video sequence.

Here are some render times to meditate on :

4096 × 2048 : 12 minutes for a 800 frames file
8192 × 4096 : 25 minutes render time, 80 Go file
4096 × 2048 : 6000 frames, about one hour, 140 Go
7168 × 3584 : 25 minutes render time, 60 Go file
4096 × 2046 : 9000 frames, 1 hour 15 minutes,  261 Go, 60 fps

3. Who likes 8192 × 4096 ?

The answer is simple : nobody. I tried various tools but after a while I settled on a lower resolution, I used Virtuadub to resize the video to half-size, that is 4096 × 2048. I have tried a successful workflow using h.265 but apparently youtube doesn’t like that yet.

Ok now I have a 150 Go audioless video file and lost a few yours to get to this point which luckily you can avoid losing if you are reading this.

Handbrake

After a few tries I went to Handbrake. Handbrake is open-source and has a cocktail and a pineapple as a logo, that’s a good sign. Back to handbrake. First good news, It didn’t crash on startup. Back to h.264. Again, handbrake, conversion and upload. My first test with a low resolution works.

When you first load the file in handbrake, the software does a process called tile scanning. That process did freeze when using the 8192 × 4096 resolution.
That’s why I settled for half-size resolution at least for a first try.

4096 × 2048 : 800 frames in h265 : 5 minutes render time
4096 × 2048 : 800 frames in h.264 : 6 minutes render time
4096 × 2048 : 6000 frames in h.264 : about 40 minutes render time
4096 × 2048 : 9000 frames in h.264 : about one hour

4. add audio

Last but not least, my video lacks any audio. FFmpeg allows for an easy merge with an audio file using the following command :

ffmpeg -i input_audio.wav -i input_vid.mp4 -vcodec copy output.mp4

5. add metadata

Youtube provides a tool to add the metadata necessary to be recognised as a 360 degree video. This tool is available for free here. It’s very simple to use, just open the file, inject the metadata and save.

6. Upload patiently

Drink a beer, enjoy a coffee, it’s going to take a while. The upload is of course going to be longer than usual because of the filesize but the youtube processing also seems to be much longer.

7. Enjoy

Banner of the 360° video & tutorial, a decaying fractal city

Originally published on svdk.fr in 2017.

Esc