10
I’m using ffmpeg
to try to stream a live on Facebook, using the function concat
to stream multiple video files, but at the end of the first file, Facebook hangs and does not continue playing the rest of the files.
This is my.txt list
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 make the 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 starting a broadcast in the preview, it is already possible to see the start video, however, when it ends, the live lock and playback does not continue.
When analyzing the logs of ffmpeg
, at 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 this one 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 coding of the files I made using Sony Vegas, which in the case are the inicio.mp4
and encerramento.mp4
, however, I encoded the same in three different programs and even upended them to Youtube and downloaded again, and still gives the same error.
I think the question is interesting for the knowledge involved, but it is outside the scope of this site for not being about programming (but about using a tool, ffmpeg). Anyway, you know you don’t have to reinvent the wheel, right? You’ve heard of OBS? Besides a good guide on the tool website, there are several tutorials out there on how to use it to live on FB. For example: https://www.youtube.com/watch?v=_3zrWLzR6jA.
– Luiz Vieira
No, by reinventing the wheel I said try to rebuild what OBS does, after all, he uses the ffmpeg (so that the processing cost will be essentially the same). I did not understand what you meant by "filming and sending at the same time". What you will use as input for your streaming (whether it is a camera input or a video file) is set in OBS via the "sources" ("sources"). OBS has just one source called "media source" that reads video files to stream.
– Luiz Vieira
I was writing my "reply" when you apparently deleted your comment. Anyway, it was just a hint. I may be mistaken, but it seems to me that you will only have additional difficulties in trying to do directly in ffmpeg.
– Luiz Vieira
I removed the comment because it sounded a little "rude" my answer, I would prefer to do by ffmpeg precisely for the knowledge involved in such, I have knowledge in OBS and have even used it a few times for the same function, thanks for the tip, if anyone comes to answer on how to do with ffmpeg it will be helpful too.
– Leo Letto
It was not rude no. : ) Well, if you prefer to learn, I think it is just. Unfortunately, I still don’t think it’s very in the scope of this site (it would be more in the scope if you wanted to do, even for learning, using the ffmpeg API in some programming language). But that’s it. It was just a comment to try to help. Good luck! :)
– Luiz Vieira
I’m using PHP to try to broadcast this live, but as doubt does not cover anything about PHP itself, I think it does not enter the scope itself.
– Leo Letto