[FFmpeg-user] reconnect to streaming server if connection drops

Federico Allegretti allegfede at gmail.com
Mon Oct 12 20:03:10 CEST 2015


Hello guys, i'm streaming video from a cheap ez-capture usb dongle to
ustream servers using ffmpeg and this script.

#---------------------------------------------------------
RTMP_URL=rtmp://1.17022938.fme.ustream.tv/ustreamVideo/myidnumber
KEY=mykeynumber

# setta il sistema a PAL
v4l2-ctl --set-standard=pal

#setta l'ingresso del device 0 al video composito
v4l2-ctl -d /dev/video0 -i 1

# setta la dimensione del frame
v4l2-ctl --set-fmt-video=width=640,height=480

:loop
ffmpeg -f video4linux2 -i /dev/video0 -f alsa -ac 1 -ar 44100 -i hw:2,0 -f
flv "${RTMP_URL}/${KEY} flashver=FME/2.5\20(compatible;\20FMSc\201.0)"

timeout /t 10 >null
killall avconv

goto loop


I noticed that when the connection drops, ffmpeg cannot handle an auto
reconnect, but i also noticed that closing the process with a ctrl-c
keypress i got "written rtmp send error 32" and some other error messages.

Are those raised by my ctrl-c or are messages feeded back from server to
the source?

Could i intercet those messages to automatically close the ffmpeg process
and re-start it again?

Thanks,

Federico

-- 
Open TV Architecture project: http://sourceforge.net/projects/otva/

Messagenet VOIP: 5338759

My blogs: http://altri-media.blogspot.com/
               http://subbaqquerie.blogspot.com/

YouTube Channel: AllegFede

VIMEO HD videos: http://www.vimeo.com/user1912745/videos


More information about the ffmpeg-user mailing list