linux – How to set a ffmpeg timeout when downloading a hls stream?

I am downloading a video from a HLS stream like this:

ffmpeg -i "" -c copy -to "1:00:00" video.ts

However from time to time the server will have issues and ffmpeg will wait very long to download a single ts segment. Is there a way I can make ffmpeg stop (and return an error) if a certain timeout is reached on every individual .ts segment?

I tried adding -timeout 5000000 (5 seconds) but it doesn’t seem to do the job, unless I am using it incorrectly. Any help would be appreciated.

Read more here: Source link