I am using ip cam which provides streams mov/mp4. I am successfully saving the stream using this command:
ffmpeg -i rtsp://@192.168.241.1:62156/abc.mp4 -acodec copy -vcodec copy c:/abcd.mp4
Now I want to stop it programmatically for that I used following commands:
Ctrl+C
and q
both are working fine(logs are showing in right manner) but in the end I am getting corrupt video file.
Can any one guide me how can stop recording with clean execution.
May be it will be helpful for someone so I am positing here my solution.
After few search I found that files are corrupted because here are I am interrupting to finish the mp4 encode, so I switched to something like mkv
and it worked perfectly.
This is the command I am using now:
ffmpeg -i rtsp://@192.168.241.1:62156/abc.mp4 -acodec copy -vcodec copy c:/abcd.mkv