简体   繁体   中英

Pipe video and audio to ffmpeg from OpenRTSP

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM