User Generated Content

Product
Video Cloud
Applies to Roles
Publisher, Developer
Version
Brightcove 5
Edition
Pro, Enterprise

People can become highly engaged with your site and your content when they themselves are providing some of the content. This article describes strategies and best practices for using Video Cloud to integrate user-generated video with your web presence.

The key issue in working with user-generated content (UGC; also known as Consumer-Generated Media, or CGM) is how to get the video from your users into your Video Cloud account. Obviously, you can't give everybody who visits your web site access to your Video Cloud Studio account. You need to direct user-generated videos to a server you control, and then feed those videos to your Video Cloud account in a controlled way, using either the Video Cloud  Media APIs or FTP batch provisioning features.

Main Steps

Here's an overview of the strategy you can follow in planning and executing a UGC campaign:

  1. Plan your UGC campaign. Formulate your call to action and policies. Give guidance to your users about file format and video encoding issues. Consider copyright and trademark issues.
  2. Set up an intermediate server to host your upload form and receive the videos.
  3. Create an upload form where your users can upload their videos and metadata.
  4. Review the videos before they are published. Apply whatever editorial filter you want to the user-generated videos.
  5. Move the user-generated videos from the intermediate server to your Video Cloud Media Library. You can use the Media API createVideo method or FTP batch provisioning.
  6. Publish your choice of the user-generated videos on your web pages. You can use smart playlists for dynamic content.

This diagram shows the recommended workflow:

UGC workflow

Before you begin

You need to plan your UGC campaign in accordance with your business goals. You'll need the following skills and resources:

  • basic web development skills, to create an upload form and capture the uploaded videos and their user-supplied metadata.
  • your Video Cloud Media API write token, or alternatively access to the Video Cloud FTP batch provisioning servers.
  • an HTTP server that you control that can host the upload form and store videos before they are moved into your Video Cloud Media Library.

Planning your UGC campaign

You need to plan your UGC campaign in accordance with your business goals. Plan how you will communicate your UGC campaign to your audience. You can use promotions around your existing video content and web properties, as well as those of your affiliates and business partners. Many UGC campaigns have a contest element, in which case you'll need to think about prizes, judging, and the duration of the campaign.

In your UGC campaign, you need to communicate your policies to your users. Some factors to consider:

  • file formats accepted
  • source file encoding recommendations
  • maximum file size and video length
  • legal requirements, like ownership and rights to distribute the uploaded video, and restrictions on the users' use of copyrights and trademarks (both yours and those of third parties).

You'll also need to plan how you want to publish the videos.

Reviewing videos before publishing

In a publicly-available UGC campaign, some users may submit video content that is unacceptable for publishing — content that violates copyright or trademarks, or is obscene, disgusting, or just pointless. Plan how you want to select or moderate and publish the user-generated videos. There are several approaches you can take:

  • Review all the submitted videos on your intermediate server, and then move the acceptable ones to a separate directory from which they can be uploaded to your Video Cloud Media Library.
  • Upload all the submitted videos directly to your Video Cloud Media Library, but leave them in an inactive state until they've been reviewed and approved.

Setting up an intermediate server

You don't want user-generated content to go directly into your Video Cloud Media Library, unless you can really trust all of your users. Instead, you should use an intermediate server: users upload their videos to the intermediate server, and you then use the Video Cloud Media API or FTP batch provisioning to move the videos from the intermediate server into your Video Cloud Media Library. The intermediate server should have enough space to handle the number of videos uploaded. We generally recommend at least 4G of RAM, and 160GB of hard drive space.

Your IT department or your existing hosting solution for your web site may be able to help you set up the intermediate server. Hosting providers such as Amazon EC2, Media Temple, or RackSpace (among many, many choices) may also meet your needs.

Creating the upload form

The upload form gives users a way to upload videos to your intermediate server. The upload form typically has fields where the user can provide a name, short description, and tags for the video, though you can add a field for any property of the Video you want modified by the user. In this example, a user can input name, short description, tags, and a related link URL and text, and also assign the video to a pre-specified playlist.

Upload form

Here's the HTML:

<form method="post" enctype="multipart/form-data" action="video_upload.jsp">
<h1>1. Choose a Video</h1>
     <div class="fileBrowse">
          <input type="file" name="video">
     </div>
     <div class="uploadDescriptionText">
          <b>Supported File and Size Information</b><br/>
               All mp4, mov, and avi types accepted.
               Files can be no larger than 1 GB.
     </div>
<h1>2. Add Details</h1>
     <div class="separator"></div>
          <h2>Display Name</h2><label>(required)</label>
     <div><input name='name'/><label>60 characters</label></div>
     <h2>Short Description</h2>
          <div><input name='shortDescription'/><label>250 characters</label></div>
     <h2>Tags</h2>
          <div><input name='tags'/><label>Separate tags with commas</label></div>
     <h2>Related Links</h2>
          <div><label>Display Text for Link</label>
               <input name='linkText'/>
               <label>40 characters</label></div>
	  <div><label>Link URL</label><input name="linkURL"/></div>
<h1>3. Choose a playlist</h1>
        <div>
            <select name="playlist">
                 <option value="birds">Birds</option>
                 <option value="insects">Insects</option>
                 <option value="fish">Fish</option>
            </select>
        </div>
<h1>4. Publish!</h1>
    <input type="submit"/>
</form>

Make sure you do proper field validation on the input provided by your users. For example, a video's short description can be no longer than 250 characters. See the Media Objects Reference for information about the fields available for a video.  

You'll need to write some code to retrieve the file and the metadata from the request. This example uses the Spring MVC framework, which provides for simple file upload and retrieval:

public class FileUploadController extends SimpleFormController {
 
    protected ModelAndView onSubmit(
        HttpServletRequest request,
        HttpServletResponse response,
        Object command,
        BindException errors) throws ServletException, IOException {
 
         // cast the bean
        FileUploadBean bean = (FileUploadBean) command;
 
        // Retrieve the file
        MultipartFile uploadedFile = bean.getFile();
        
        // We need to move the file to a temporary location, so it's accessible on disc
        // Give the temporary file a unique name, in this case, we'll use a timestamp
        File tempFile = new File("../temp/" + new Date().toString());
        
        // Move the file
        uploadedFile.transferTo(tempFile);
        
        // Retrieve the properties of the video
        String videoName = bean.getName();
        String shortDescription = bean.getShortDescription();
        ...       
    }
}
 
public class FileUploadBean {
 
    private MultipartFile file;
    private String name;
    private String shortDescription;
    ... Define remaining video properties
 
    public void setFile(MultipartFile file) {
        this.file = file;
    }
 
    public MultipartFile getFile() {
        return file;
    }
    
    public String getName() {
    
return name:
    }    
    public void setName(String name) {
     this.name = name:
    }
    ... Define remaining video getters/setters
}

Finally, declare the controller and the resolver in the application context:

<beans>
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
     <!-- The maximum file size in bytes -->
     <property name="maxUploadSize" value="500000000"/>
    </bean>
    <bean id="fileUploadController" class="examples.FileUploadController"/>
</beans>

Note that the multipartResolver restricts the size of the file to 0.5G.  Though Video Cloud can accept a video up to 2G in size through the Media API, it is strongly recommended to limit this to 0.5G, since the file is transmitted over HTTP.

Ingesting the video from the intermediate server

Once you have the file in a temporary location on your intermediate server, along with the metadata entered by the user, you can move it into your Video Cloud Media Library using the Media API. In our examples for this article, we use the Java open source SDK, which you can find at http://bc-j-mapi-w.sourceforge.net/

If PHP is your language of choice, we highly recommend the Video Cloud PHP SDK, Echove. In addition, there are a number of other Media API SDKs you can choose from. Read more about the Media API SDKs. These SDKs merely wrap around the Media API for easier development and let you use the language you're most comfortable with.

Using the Java SDK for the Video Cloud Media API, you can execute the following code: 

Video video = new Video();
video.setName(videoName);
video.setReferenceId(videoReferenceId);
video.setShortDescription(videoShortDescription);
video.setItemState(ItemStateEnum.INACTIVE);

// Other video fields
...
List<String> tags = new ArrayList<String>();
tags.addAll(tags);
video.setTags(tags);
WriteApi api = new WriteApi(Logger.getAnonymousLogger(),"ISO8859_1");
Long videoId = api.CreateVideo(writeToken, video,
               "full path to video.mov", TranscodeEncodeToEnum.MP4, 
               true, false, false);

The signature of the CreateVideo method in the Java SDK is as follows:

CreateVideo(String writeToken, Video video, String filename,
            TranscodeEncodeToEnum encodeTo, Boolean createMultipleRenditions,
            Boolean preserveSourceRendition, Boolean h264NoProcessing)

You can set TranscodeEncodeToEnum to either FLV or MP4.  We highly recommend setting this to MP4 (H.264) for best quality and mobile compatibility. Read more about the parameters you can use with the create_video method. This line ensures that when the video enters your Video Cloud Media Library, it is inactive:

video.setItemState(ItemStateEnum.INACTIVE);

When you use the Media API, make sure you upload content to Video Cloud serially, as discussed in Building Robust Applications in a Shared Environment.

Upon successful return from CreateVideo, delete the video from its temporary location on the intermediate server.

Ingesting videos using FTP batch processing

You can also use the Video Cloud FTP batch processing feature to move videos from your intermediate server to your Video Cloud Media Library. This involves writing a script to generate and upload manifests to Video Cloud based on the videos and metadata uploaded by the users. The script should run over a certain time interval, and should be located on the same server in which the user uploads the video. In the future, we plan to provide an example of a script that does this.

Publishing the user-generated video

Consider how you want to present your user-generated videos. On what pages will you publish them? Do you want a customized player?

You can group user-generated videos automatically using smart playlists. Here are two approaches you might consider:

  • Make a smart playlist for the most-viewed user-submitted videos. To do this, tag all of the user-submitted videos with a common tag and create a new smart playlist defined by "contains [UGC] tag" and "order by Total Plays."
  • Define subject-based tags and let your users select the best one. In the upload form example above, we defined the tags Birds, Insects, and Fish, and let the user select one of them. Then, you'd create three smart playlists, defined by "contains Birds tag", "contains Insects tag", and "contains Fish tag." You can further define the playlists with the order the videos should be listed, like newest first (by Activated Date) or most popular (by Total Plays).

After the user chooses the playlist, you can add the tag value to the video tags. In the Java SDK for the Media API, you can add the tag in a line like this:

tags.add(playlist);

Once the video is uploaded to your Video Cloud Media Library, the video will automatically be added to the defined playlist.

UGC and Monetization

Video Cloud players that play user-generated content can support advertising, just like all Video Cloud players. However, you need to consider that, from your advertisers' perspective, user-generated content may not have the same value as your regular content and they may not want to sponsor video that isn't brand-worthy.

Video Cloud has special key/value pairs that you can add to a video indicate whether the video is user-generated content or not. Use the cgm=1 key/value pair to indicate that a video is user-generated content, and cgm=0 to indicate that it is not. Read about adding key/value pairs to a video in the Advertising module.

 

Tags
cgm, ugc, upload