1

I am trying to record rtsp stream in HLS format using openRTSP and ffmpeg. openRTSP receives rtsp and pipe to ffmpeg to record,

Here is the command I used and which works fine

openRTSP -D 10 -v -t -c -b 800000 rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov | .././ffmpeg -r 15 -i - -codec copy -hls_list_size 65535 -hls_time 2 "./live.m3u8"

Note in above commnad -v is for video only.

But now I need to record audio also so I removed -v option, but the video is not getting recorded. It's just creating two files named audio-MPEG4-GENERIC-1 and video-H264-2 no HLS video file. I think some problem with piping. Can anyone help me to solve it.

Haris
  • 13,645
  • 12
  • 90
  • 121
  • Your question is confusing, hls is `HTTP Live Streaming` then it is over http but you are using an rtsp url ? – mpromonet Mar 28 '16 at 16:19
  • Basically my input stream is rtsp and I want to store it on hls format. – Haris Mar 28 '16 at 17:24
  • Your post is unclear, because HLS is a streaming signaling protocol not a video format. Basically a m3u8 file is just a playlist of http url to get fragment of stream. In the pipe (with the -v) there is H264 elementary stream, you can store it and stream it as HLS. – mpromonet Mar 28 '16 at 17:45
  • You are right, using above command I am getting the `live.m3u8` generated with all the `.ts ` file path. Also all the `.ts` generated in the same directory. So after running the above command I can see `live.m3u8, live0.ts,live1.ts,live2.ts.....` generated in the directory. And I can play live.m3u8 using VLC. Now using the same way I have store the video as well as with audio, but while removing `-v` option and running the command I am getting only these two files generated `audio-MPEG4-GENERIC-1` and `video-H264-2` instead `live.m3u8` and all other `.ts` files. – Haris Mar 28 '16 at 18:03
  • Have you ever found the solution for this? – Z T Dec 10 '16 at 21:39

1 Answers1

1

I know this is an old question, but it came up in a Google search for me today. Since I can answer this I will, for any future Googlers out there.

You don't need to use openRTSP at all. ffmpeg can handle RTSP streams just fine. I recently coded up a livecam streaming site for my security cameras. The command I'm using to generate the HLS stream is this:

ffmpeg -v quiet -i 'rtsp://user:pass@192.168.1.110:554' -c:v copy -c:a copy \
    -bufsize 50k -pix_fmt yuv420p -flags -global_header -hls_time 5 -hls_list_size 3 \
    -hls_flags delete_segments hls.m3u8

This will output hls.m3u8 and all of the hls.ts files. You might have to play with some of those parameters for your specific needs. Here is some good documentation for the flags: FFmpeg Formats Documentation

Ryan Steffer
  • 425
  • 6
  • 10