[FFmpeg-user] Using ffmpeg receive udp stream without hangs

zy 393969258 at qq.com
Fri Sep 28 03:55:14 EEST 2018


I try to use ffmpeg to receive udp streams and write to my local files. But the udp links may be interrupted. When ffmpeg can't access the udp link, the writing process hangs.


Is there any way to keep ffmpeg to write blank to the file instead of just hanging? Or use multicast when the main udp disconnected, it switch to the vice udp. When main udp connect again it can switch back to the main udp.


Following up are my own commands, the sender sent the file to udp, and receiver receive the udp port. If the sender was interrupted, the receiver stop writing to the files.


sender:
ffmpeg -re -i test.ts -c copy -f mpegts -map 0 udp://0.0.0.0:6666
re
receiver:
ffmpeg -i udp://0.0.0.0:6666 -vn -acodec pcm_s16le -ac 8000 -f segment -segment_time 3 -reset_timestamps 1 -strftime 1 -segment_format wav ~/Desktop/temp/%s.wa
server:
ffserver



Thanks,
Z!


More information about the ffmpeg-user mailing list