This article describes the best practices when adding video content to your Augmented Reality scenes in CraftAR. By taking into account some of the 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:
- Supported Formats
- Video quality
- Videos with transparency
- Professional video hosting services that work well with CraftAR
- Video conversion
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.mp4Android 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.
- MP4 video encoded with H.264 baseline profile with 300 kbps and resolution of 640x360 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.
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 .one of our own videos hosted at Vimeo and go directly to Step 3 in the instructions below.
Step 1: Create an accountCreate 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: Instal and launch VLCWe 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 section “Choose Profile” and set:
- Encapsulation: “MP4 / MOV”
- Video codec:
- Codec: H.264
- Bitrate: 300 kb/s
- Resolution: 640x360
- 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 FFmpegFollow the instructions from: https://www.ffmpeg.org/download.html We used version 1.2.4 of FFmpeg when writing those instructions. We recommend you to always use the latest version of FFmpeg. We will do our best to keep the instructions updated.
Step 2: ConversionConversion 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.