简体   繁体   English

将视频和音频从OpenRTSP传输到ffmpeg

[英]Pipe video and audio to ffmpeg from OpenRTSP

I am trying to record rtsp stream in HLS format using openRTSP and ffmpeg. 我正在尝试使用openRTSP和ffmpeg以HLS格式记录rtsp流。 openRTSP receives rtsp and pipe to ffmpeg to record, openRTSP接收rtsp并通过管道传递给ffmpeg进行记录,

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. 注意上面的命令-v仅用于视频。

But now I need to record audio also so I removed -v option, but the video is not getting recorded. 但是现在我还需要录制音频,因此我删除了-v选项,但是未录制视频。 It's just creating two files named audio-MPEG4-GENERIC-1 and video-H264-2 no HLS video file. 它只是创建两个名为audio-MPEG4-GENERIC-1video-H264-2 no HLS视频文件的文件。 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. 我知道这是一个古老的问题,但是今天在Google搜索中出现了。 Since I can answer this I will, for any future Googlers out there. 既然我能回答这个问题,那么我会为将来的任何Google员工提供的。

You don't need to use openRTSP at all. 您根本不需要使用openRTSP。 ffmpeg can handle RTSP streams just fine. ffmpeg可以很好地处理RTSP流。 I recently coded up a livecam streaming site for my security cameras. 我最近为我的安全摄像机编码了一个实时摄像机流媒体站点。 The command I'm using to generate the HLS stream is this: 我用来生成HLS流的命令是这样的:

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. 这将输出hls.m3u8和所有hls.ts文件。 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 这是有关标志的一些很好的文档: FFmpeg格式文档

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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