0

I'm trying to save an RTSP streaming from a hikvion camera to a .mp4 file in a USB pen drive in a raspberry pi 3.

I'm using raspbian, I read a lot from the internet, and I'm using different programs to try to save the video.

I used cvlc, openRTSP and ffmpeg, and all of them have errors...

Some commands that I used:

openRTSP -D 1 -c -B 10000000 -b 10000000 -4 -Q -F video_openRTSP_ -P 1200 -w 1920 -h 1080 -f 25 -t -u admin xxxxx rtsp://admin:xxxxx@192.168.1.64:554/h264/ch1/main/av_stream
ffmpeg -i rtsp://admin:xxxxx@192.168.1.64:554/h264/ch1/main/av_stream -acodec copy -vcodec copy ffmpeg.mp4
cvlc --rtsp-tcp rtsp://admin:xxxxx@192.168.1.64:554/h264/ch1/main/av_stream --sout=file/mp4:cvlc.mp4 --stop-time=900 vlc://quit

I tried a lot of different parameters for each one of these 3 programs... The final result never was good. I guess the Hikvision firmware is not implementing well the RTSP protocol...

Exists some alternative firmware for Hikvision cameras? As we have openWRT and ddWRT for routers?

Someone had the same problem as me?

(I want to store at least 15 minutes, even when the .mp4 file is saved, sometimes only save few seconds of videos, and sometimes I can't reproduce the video)

Pictures of the errors:

openRTSP:

enter image description here

enter image description here

ffmpeg:

enter image description here

enter image description here

Rui Martins
  • 3,337
  • 5
  • 35
  • 40
  • Are you sure about URL? I've worked with 3 HikVision cameras and their URL was simple - just no path part after port number. I just tested it again in VLC player, it works. UPD: Ok, I tested a bit more - path part is not important at all. You can skip it or type any string, it doesn't matter, stream still play. So my suggestion is first to try it play in any player – Wolfrevok Cats Oct 06 '20 at 01:12
  • @Wolfrevok Cats , but I didn't want to watch the video, I only want to store internally in a USB pen – Rui Martins Oct 07 '20 at 09:20
  • I understand, but are you sure your stream is working properly at all, independently of saving it somewhere? Also, if it's ok for your task to get records from internal camera archive - there is much easier way with REST API – Wolfrevok Cats Oct 07 '20 at 19:33
  • @WolfrevokCats I guess that I'm receiving well the streaming. I already updated the firmware of the camera, and I reseted to origin factory... How can I test if my streaming are being well received? – Rui Martins Oct 07 '20 at 19:53
  • @WolfrevokCats What is the Bitrate that you use in your cameras? – Rui Martins Oct 07 '20 at 20:51
  • as I suggested first - just play same stream with any player with RTSP support. I'm using VLC. It connects to my cameras and plays live or archived streams very well (not sure about VLC version for your OS though). "Media" -> "Open Network Stream..." and paste same URL. I checked some cameras - bitstream is 4096kbps, but it's not really important for my tasks, we need still shots more than video. Also - check video settings, if extensions are used, like "H.264+", "H.265+" and "SVC". Turn them off if they are. They may be not 100% compatible with your video software. – Wolfrevok Cats Oct 07 '20 at 22:38
  • @WolfrevokCats, but I can play the streaming in VLC, the problem is when I put it recording with CVLC, ffmpeg or openRTSP – Rui Martins Oct 08 '20 at 17:38
  • what if you try another player and another recording software? – Wolfrevok Cats Oct 08 '20 at 23:30
  • Regarding alternative firmware for Hikvision cameras - no, of course it's not exists. It's chinese hardware at its best, all documentation and sources are hidden like some government secrets and technical support is more like "are you sure you plugged it to a power socket?" – Wolfrevok Cats Oct 08 '20 at 23:34
  • @WolfrevokCats, I don't know more software to store the video. I used ffmpeg, cvlc, and openRTSP. All of them failed :( – Rui Martins Oct 09 '20 at 00:53
  • I'm trying to see a pattern here. I think that camera gives stream with some corruption or some rare extensions, like I mentioned (did you turn them off?). The only player you tried that receive stream correctly is VLC. It is based on ffmpeg, so it's weird why ffmpeg utilities got an error. cvlc is same VLC without GUI, so same story here. I don't know what is OpenRTSP, not much info about it, so it's interesting to know which underlying library it use. My suggestion - try another player, better not based on FFMPEG to see how it works. What if change stream to MJPEG for testing? – Wolfrevok Cats Oct 11 '20 at 20:11

0 Answers0