Search code examples
ffmpegconnectionffserver

connection timeout between client and ffserver


I have a directory which contain some files,I loop around this files and stream them using ffmpeg to ffserver,the problem is when song is over,the client stop receiving the stream.VLC and jwplayer have this problem-which I tested-(although I can fix this problem in jwplayer by adding repeat: true option but I don't think it's such a good idea).

what I need is an option or some trick in ffserver which keep connection alive(at least for a while) so that if a song is over,the next song start automatically(it take 1 second to switch songs),maybe ffserver have a timeout option ?


Solution

  • I ended up using concat for streaming files without breaking connection

    the easiest way would be to create a file,name it file_paths.txt and add paths to file like this :

    file '/path/to/file1'
    file '/path/to/file2'
    file '/path/to/file3'
    

    and then in your ffmpeg command do something like this :

    ffmpeg -re -f concat -i file_paths.txt  http:/ip:8090/feed1.ffm
    

    this works really well,although all files must have the same codec and format for more information and see how to use concat for different formats see this