2

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

3
  • Have you tried with -f mp4 or -f m4v in place of -f flv ? For mp4, ffmpeg by default uses H.264 and AAC codecs.
    – d33pika
    Feb 6, 2013 at 2:11
  • -f mp4 is a bad idea because -f flv is mandatory for rtmp streaming and mp4 isn't suitable for streaming. Feb 10, 2013 at 4:10
  • I am trying the same stuff. I start the Red5 server, but if I use the same ffmpeg command, the terminal outputs: rtmp://localhost/live/livestream: Unknown error occured Jul 16, 2014 at 16:14

1 Answer 1

3

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.

1
  • any idea how to stream h.265?
    – minghua
    Nov 14, 2019 at 5:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.