FFmpeg streaming using H.264 (with audio) - Red5 m

2020-07-27 05:18发布

I'm trying to stream my webcam with FFmpeg to my Red5 server using RTMP. I've done this successfully using FLV format with the following line:

ffmpeg -f video4linux2 -i /dev/video0 -f flv rtmp://localhost/live/livestream

I'm new to FFmpeg and live streaming, and I've tried to stream using H.264/MPEG-4. But my knowledge is a bit limited with the FFmpeg options (which I did find here: http://man.cx/ffmpeg%281%29).

So, my questions would be:

  1. How can I use H.264/MPEG-4 to stream to my Red5 server?

  2. What are the options to stream audio as well?

  3. And one final issue is:

I'm having a delay of about 5 seconds when I play the content with JWPlayer in Mozilla Firefox (on Ubuntu). Can you please help me out to solve this problem? Any suggestions why this might be?

Many thanks

1条回答
Ridiculous、
2楼-- · 2020-07-27 05:58

There is no need to use ffmpeg for streaming H.264/MPEG-4 files because red5 has build in support for this. Using ffmpeg will only put an unnecessary load on your CPU usage. Red5 will recognize the file type automatically, you only have to specify the mp4 file in your JWPlayer.

About the delay, as far as I know JWPlayer has a buffer of 3 seconds by default. You can try to lower this (property bufferlength or something like that). And maybe JWPlayer has a "live" property as well to stream with minimal delay, but I am not sure about that. Removing ffmpeg will probably speed up the process also.

查看更多
登录 后发表回答