ffmpeg rtmp and local file output

2019-02-16 00:13发布

问题:

I'm new in stackoverflow =) I have a trouble with ffmpeg I receive a rtsp stream from a grabbing device (camera) and I stream-out it to rtmp (Youtube Live) I want to have a copy of the stream in my computer so I write at the same time in a local file

I use this command :

ffmpeg -y -i 'RTSP_SOURCE' -c:v copy -c:a libvo_aacenc -map 0:v -bsf:v dump_extra -fflags +genpts -flags +global_header -movflags +faststart -map_metadata 0 -metadata title= -f tee -filter_complex aevalsrc=0 '[f=mp4]/tmp/backup.mp4|[f=mpegts]/tmp/backup.ts|[f=flv]rtmp://a.rtmp.youtube.com/live2/STREAM_ID'

The problem is when I have some disconnections, ffmpeg exits and stop to recording Is there any flag or option for telling to ffmpeg to continue recording in local files even there is not internet ?

Thank you very much for your help =)

回答1:

You can try:

ffmpeg -f tee "[onfail=ignore] ...

More description is available here.