At this time is it not possible to create Facebook Live stream targets using the REST API or with a Client-Side Application … read more
There a solution to transcode live/video (HLS/MP4) stream to RTMP (Facebook) using ffmpeg .
Transcode HLS To RTMP (Facebook live)
ffmpeg -re -i "http://domain/x/x/input.m3u8" -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv "rtmp://rtmp-api.facebook.com:80/rtmp/111111111111111?ds=1&a=XXXXXXXXXXXXXXXXX"
Transcode MP4 To RTMP (Facebook live)
ffmpeg -re -i ./video.mp4 -acodec libmp3lame -ar 44100 -b:a 128k -pix_fmt yuv420p -profile:v baseline -s 426x240 -bufsize 6000k -vb 400k -maxrate 1500k -deinterlace -vcodec libx264 -preset veryfast -g 30 -r 30 -f flv "rtmp://rtmp-api.facebook.com:80/rtmp/111111111111111?ds=1&a=XXXXXXXXXXXXXXXXX"
Facebook video format Video Format:
- We accept video in maximum 720p (720 x 1280) resolution, at 30 frames per second. (or 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.
- The Live API accepts H264 encoded video and AAC encoded audio only
Audio Format:
- Pixel Aspect Ratio: Square
- Frame Types: Progressive Scan
- Audio Sample Rate: 44.1 KHz
- Audio Bitrate: 128 Kbps stereo
- Bitrate Encoding: CBR
Create Facebook live “Go Live Dialog”
call the following code to initialize a pop-up window with control that determine where to direct your POST request.
<script>
document.getElementById('liveButton').onclick = function() {
FB.ui({
display: 'popup',
method: 'live_broadcast',
phase: 'create',
}, function(response) {
if (!response.id) {
alert('dialog canceled');
return;
}
//rtmp://rtmp-api.facebook.com:80/rtmp/111111111111111?ds=1&a=XXXXXXXXXXXXXXXXX
alert('stream url:' + response.stream_url);
FB.ui({
display: 'popup',
method: 'live_broadcast',
phase: 'publish',
broadcast_data: response,
}, function(response) {
alert("video status: \n" + response.status);
});
});
};
</script>
Sorry i’m using google translator you can use rtmp instead of hls
yes you can .
Hi, is there a way to stream using a m3u file ? I’ve got one and I cant use it with the command you gave above. Thanks
m3u8 file? show me an example so i can help you faster.
Thanx! Could you explain why you’re using “-s 426×240” ?
you must use “-s” in order to set the video size (width*height)
read more about video scale : https://trac.ffmpeg.org/wiki/Scaling%20(resizing)%20with%20ffmpeg
Can i do the same with streaming any of my old youtube channel video to my new youtube channel