Live API Best Practices

It is important to note the following specs for Facebook's live video streaming product and API. This documentation will be actively updated to reflect developments of the product.

Technical Recommendations and Tips

  1. While it's possible to insert previously recorded video into a live stream, we highly recommend that you exclusively show live content during live videos. This ensures that live content remains live.

  2. Broadcast for longer periods of time to reach more people. The longer you broadcast, the more likely people are to discover and share your video with their friends on Facebook. We recommend that you go live for at least 10 minutes, though you can stay live for up to 4 hours.

  3. Tag your location! When you add your location to a live video, that gives a greater chance that you'll appear on the Facebook Live Map!

  4. For optimal security of your streams, we recommend using the RTMPS stream URL and key. This will encrypt your live stream.

  5. If you're streaming with the Live API, we recommend setting up a wired internet connection to ensure stability. Wireless internet connections will work but may drop streams due to poor network connectivity.

  6. If possible, we encourage the use of hardware encoders in lieu of online encoders that run through your machine or computer. This will help with stability and ensure that frames are pushed successfully to the Facebook Live endpoint.

Technical Specs

Video Format:

  • We accept video in maximum 720p (1280 x 720) resolution at 30 frames per second, with 1 key frame every 2 seconds.
  • You must send an I-frame (keyframe) at least once every two seconds throughout the stream.
  • Recommended max bit rate is 4 mbps. Going above this maximum is possible but will make live streams highly unstable.
  • Titles must be less than 255 characters otherwise the stream will fail
  • The Live API accepts H264 encoded video and AAC encoded audio only

Video Length:

  • 4 hour maximum length for live stream.
  • 4 hour maximum length for preview streams (either through Live dialog or publisher tools). After 240 minutes, a new stream key must be generated.
  • RTMP stream URLs will expire 24 hours after they are created.

Advanced Audio Settings:

  • Audio Sample Rate: 48 KHz
  • Audio Bitrate: 128 Kbps mono

Advanced Video Settings:

  • Pixel Aspect Ratio: Square
  • Frame Types: Progressive Scan
  • Bitrate Encoding: CBR

OBS Settings:

If you are using Open Broadcaster Software to stream live, the following tips will ensure the best quality live stream.

  • When putting the Facebook Live RTMP stream URL and key into OBS, go to Settings > Stream. Under 'Stream Type', select 'Custom Streaming Server'. Then break apart the server URL (rtmp://rtmp-api.facebook.com:80/rtmp/) and key. For more information, follow our Quick Start Guide.

Error Codes

Error messages will be sent via RTMP then will persist through to the Graph API. You can use the broadcast/video ID and query for the errors in the graph explorer via a GET request. Errors returned will contain the error code, description, and a timestamp.

error_subcode Error Summary Description

LIVE_VIDEO__DELETE_FAILED

Live Video Not Deleted

There was a problem and we weren't able to delete your live video. Please try again.

LIVE_VIDEO__NOT_EXIST

Live Video Does Not Exist

The live video you are trying to access does not exist in the system any more.

LIVE_VIDEO__PRIVACY_REQUIRED

Privacy Setting Required

You need to set a privacy before going live.

LIVE_VIDEO__LIVE_STREAM_ERROR

Generic Stream

There was an error during the stream

LIVE_VIDEO__EDIT_API_NOT_ALLOWED

Editing Via Video API Is Not Allowed While Live

Editing a live video using the Video Edit API is not allowed. Use the live video ID.

COPYRIGHT__LIVE_COPYRIGHT_VIOLATION

Live Copyright Violation

Your live video has been stopped because it may contain audio or visual content that belongs to {pageName}.

VIDEO__CREATE_FAILED

Upload Problem

There was a problem and your video wasn't uploaded. Please try again.