Live on Facebook using FFmpeg?

9

I'm using ffmpeg to try to stream a Facebook live, using the concat function to stream multiple video files, but at the end of the first file, Facebook crashes and does not continue playing the rest of the files. p>

This is my list.txt

file 'media/inicio.mp4'
file '../../video/arquivo01.mp4'
file '../../video/arquivo02.mp4'
file '../../video/arquivo03.mp4'
file 'media/encerramento.mp4'

And I'm using the page below to broadcast:

$chave = "chave-do-facebook";

ffmpeg -f concat -safe 0 -re -i lista.txt -vcodec libx264 -preset veryfast -maxrate 3000k -bufsize 6000k -pix_fmt yuv420p -g 50 -c:a aac -b:a 160k -ac 2 -ar 44100 -f flv "'.$chave.'" 2> log.txt

When you start a transmission in the preview, you can already see the start-up video, but when it finishes, the live hangs and playback does not continue.

When parsing the logs from ffmpeg , to the end first video the following message appears:

[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000123ef40] Auto-inserting h264_mp4toannexb bitstream filter
[h264 @ 00000000008f08e0] top block unavailable for requested intra mode
[h264 @ 00000000008f08e0] error while decoding MB 34 0
[h264 @ 00000000008f08e0] concealing 3600 DC, 3600 AC, 3600 MV errors in I frame

And then it keeps repeating itself until I close the live:

[h264 @ 00000000008f1740] QP 4294967211 out of range
[h264 @ 00000000008f1740] decode_slice_header error
[h264 @ 00000000008f1740] no frame!

I came to think that the error was in the encoding of the files I made using Sony Vegas, which in this case are inicio.mp4 and encerramento.mp4 , however, I coded them in three different programs and even Youtube and downloaded again, and still still giving the same error.

    
asked by anonymous 01.03.2017 / 21:14

1 answer

1

Only with ffmpeg I do not know, but using PhatomJS , I believe you can do what you want, but being honest I think the OBS a much easier way to make broadcasts.

phantomjs phantom.js | ffmpeg -y \
-c:v mjpeg \
-f image2pipe \
-framerate 5 \
-i - \
-r 30 \
-c:v libx264 \
-x264-params keyint=60 \
-b:v 1000k \
-minrate 1000k \
-maxrate 1000k \
-bufsize 500k \
-f flv 'rtmp://rtmp-api.facebook.com:80/rtmp/chaveparatransmissao'

Good luck!

    
27.03.2017 / 16:25