This article describes the best practices when adding video content to your Augmented Reality scenes in CraftAR. By taking into account some aspects described here you’ll provide users with a better experience by reducing latency and considering hardware limitations of mobile devices.
The article discusses the following sections:
In CraftAR you can create AR experiences with video contents. For this you need to provide a URL to a video file stored on a server and accessible from the Internet.
Before crafting such experiences we recommend uploading your video to a professional video hosting service. Our review of video hosting services provides guidelines to select services that work particularly well with CraftAR.
But if you simply want to perform a quick test with a video then you can use right now our video url that we prepared for testing: https://s3-eu-west-1.amazonaws.com/crs-beta-catchoom/contents/Catchoom/CraftAR-theUltimateARToolbox_cellular.mp4
IMPORTANT! You cannot provide links to public video sharing websites like YouTube.
We recommend using .mp4 videos (MP4 container) compressed with H.264 video (baseline profile) and AAC audio codecs. If your videos are in another format, we strongly recommend converting them in order to ensure support on a wide range of mobile devices. For learning about platform specific support you can read Android Supported Media Formats and best practices for deploying live streaming media for iPhone and iPad. Professional video hosting service often perform format conversions at the time of upload – see the instructions below. If you are hosting the videos on your own servers you can make the conversion using VLC multimedia player (free and cross-platform), or from command line using FFmpeg.
Most of the video hosting services expose links to video streams suitable for cellular networks (3G), and 4G or Wi-Fi (e.g. Vimeo’s SD.MP4 links). Note that currently CraftAR panel assumes the videos to have 16:9 aspect ratio (e.g. 640×360 pixels). When you are hosting videos on your own servers, or your hosting service enables defining the specific quality of the hosted videos, we recommend:
- MP4 video encoded with H.264 baseline profile with 300 kbps and resolution of 640×360 pixels (~2.5 MB/minute). For providing higher quality suitable for tablets with 4G or Wi-Fi, use H.264 main profile with 500 kbps (~4.5 MB/minute).
- Audio encoded with ACC codec with bitrates between 64 kbps and 128 kbps.
If your videos have a much higher bitrate than the recommended above, and the streaming is too slow, the instructions below will help you to reduce their bit rate.
Videos with transparency
Videos with transparency (also known as videos with alpha channel) refer to videos or animations that have a partial or total see-through background, which allows the user to see what is behind the video.
To know more about how we support videos with transparency in the CraftAR Service and in the SDKs, see how to add videos with transparency to Augmented Reality with CraftAR .
Professional video hosting services that work well with CraftAR
Vimeo is an easy to use service, that produces quality videos that work well with all CraftAR tools. Note that for commercial purposes you must be a Vimeo PRO user. Below we provide instructions for copying the video url from the Vimeo service. If for the moment you prefer to avoid creating a Vimeo account, try one of our own videos hosted at Vimeo and go directly to Step 3 in the instructions below.
Step 1: Create an account
Create an account at http://vimeo.com and login.
Step 2: Upload the video
- First, go to “Upload” tab. Then, click on“Choose a Video to Upload” and “Upload Selected Videos”. Note that on free Vimeo accounts, uploading a video may take several minutes.
- While waiting for the video to be uploaded, go to the “Privacy” tab and ensure that the “download the video” option is checked.
Step 3: Copy the video link
- Go to the video page, and scroll down to the video toolbar placed below the video.
- Click the Download button, and then right-clicking on the file “Copy link address”.
- We strongly recommend using the link under “SD.MP4 file” that provides optimum video quality for CraftAR.
If the Download button is not available, go back to “video settings->privacy” and ensure that “download the video” is checked and saved. Note: The above instructions were written on 2014-06-18. We will do our best to keep them updated.
Step 1: Install and launch VLC
We used version 2.1.4 (Rincewind) of VLC when writing those instructions. We recommend you to always use the latest version of VLC. We will do our best to keep the instructions updated.
Step 2: From the “File” menu, select “Convert / Stream”
Step 3: Choose the input video file via “Open media…”
Step 4: Click “Customize” in the section “Choose Profile” and set:
- Encapsulation: “MP4 / MOV”
- Video codec:
- Codec: H.264
- Bitrate: 300 kb/s
- Resolution: 640×360
- Audio codec:
- Codec: “MPEG 4 audio (AAC)” (if ACC does not work use “MP3” codec)
- Bitrate: 96 kb/s
- Channels: 2
- Samplerate: 44100
Step 5: Choose destination file and click “Save”
Step 1: Install FFmpeg
Follow the instructions from: https://www.ffmpeg.org/download.html We used version 1.2.4 of FFmpeg when writing those instructions. We recommend you always use the latest version of FFmpeg. We will do our best to keep the instructions updated.
Step 2: Conversion
Conversion command recommended for smartphones 3G: ffmpeg -i inputfile.avi -codec:v libx264 -profile:v baseline -preset slow -b:v 300k -vf scale=-1:360 -codec:a libfaac -b:a 96k output.mp4 Higher quality conversion recommended only for tablets with 4G: ffmpeg -i inputfile.avi -codec:v libx264 -profile:v main -preset slow -b:v 500k -vf scale=-1:360 -codec:a libfaac -b:a 128k output.mp4 Break down of the above parameters:
- -i [input file] – specifies the name of the input file.
- -codec:v libx264 – indicates H.264 video encoder.
- -profile:v baseline – sets H.264 profile to ‘baseline’. For newer devices use ‘main’.
- -b:v – sets video bitrate in bits/s.
- -vf scale – resizes video to a desired resolution. ‘-1’ means resizing to maintain the same aspect ratio.
- -codec:a libfaac – indicates the default AAC audio codec.
- -b:a – sets audio bitrate in bits/s.