3
votes

I'm trying to record live video stream to a file.

I tried with VLC using

vlc {INPUT} --sout '#std{access=file,mux=ts,dst=file.mp4}'

I tried with ffmpeg using

ffmpeg {INPUT} -vcodec copy -acodec copy file.mp4

Both records just fine, but the source tends to loose connection for 1-2seconds, and then recording just stops >.< leaving me with half finished recording :(

I want the recording to continue, and the recording app try to reconnect.

What can you recommend?

2

2 Answers

3
votes

Ok I've found a solution myself.

If I set VLC on loop and instruct it to append the file, it reconnects to the stream and continue recording (no black video while connection is lost tho)

the command is:

cvlc {INPUT} --loop --sout '#std{access=file{append},mux=ts,dst=file.mp4}'
0
votes

What is the source, why it is losing connection? If you can't avoid it, create some kind of 'reconnector' and use it every time connection breaks. Then, you'll have pieces of video. Later, glue that pieces together...