Saving Video to PC Shared Folder from IP4M-1028W Dome Camera

Have some questions or having issues with your IP Camera(s), Post them here for the mods and other users to assist you with.
Post Reply
kamera14
Posts: 8
Joined: Mon Oct 28, 2019 8:18 pm

Saving Video to PC Shared Folder from IP4M-1028W Dome Camera

Post by kamera14 »

One thing that attracted me to Amcrest was the claim that the camera could save to a networked file system/shared folder. Well, after fiddling around trying to get the IP4M-1028W dome camera to save to a HDD connected to my PC (running Ubuntu/Linux), I read that it doesn't support SMB (Samba/Windows sharing). So, I tried FTP'ing to a local server of mine and it refused to work ("right only read" or something was the error).

I tried their Windoze PC video recorder, but the build date was 2016! LOL. It needed some old drivers to run on Windoze 10 and, even then, didn't enable the "PC-NVR" parameters. Yikes. Ditch that idea.

So, I installed NFS on my PC as a test, and I was able to get the files to save there.

The setup to do this is as follows (Ubuntu only, folks, sorry):
1. Edit /etc/fstab to add the HDD, say:
/dev/sdb1 /mnt/myhddrive ext4 defaults 0 1
2. Then, mount it using "sudo mount -a"
3. Install all the necessary software:
sudo apt-get install nfs-kernel-server nfs-common rpcbind
sudo dpkg-reconfigure rpcbind
sudo /etc/init.d/rpcbind restart
4. Then, setup permissions and NFS exports, say:
sudo chown nobody:nogroup /mnt/myhddrive
sudo chmod 777 /mnt/myhddrive
5. Edit "/etc/exports" and add permissions, e.g.:
/mnt/myhddrive 192.168.1.0/16(rw,sync,no_subtree_check)
6. Then, enter:
sudo exportfs -a
sudo systemctl restart nfs-kernel-server
7. Disable firewall unless you know all the NFS ports:
sudo ufw disable
8. Then, log into the camera and enter the appropriate info (say the PC IP is 192.168.1.100):
Enable NAS
Server Address: 192.168.1.100
Remote Directory: /mnt/myhddrive

So, with all that, the camera can now send its video stream to the PC's HDD. However, I do notice that it does corrupt a high percentage of mp4's. Not great. I am trying out different settings to see what causes that.

Hopefully this might help someone out there who happens to have a Linux box.
kamera14
Posts: 8
Joined: Mon Oct 28, 2019 8:18 pm

Re: Saving Video to PC Shared Folder from IP4M-1028W Dome Camera

Post by kamera14 »

Update: The corruption was due to the Wi-Fi link signal strength. I moved the Wi-Fi station closer to the camera and it was not an objectionable problem anymore.
User avatar
Revo2Maxx
Site Admin
Posts: 5900
Joined: Sat Jun 15, 2019 3:05 pm

Re: Saving Video to PC Shared Folder from IP4M-1028W Dome Camera

Post by Revo2Maxx »

I would say Thank you for sharing with everyone you find the problem. Not always do people share, admit or explain what has gone on to fix a problem they were having...

It might be that you may want to like I have had to add a Weekly Router reboot just to keep things running smooth as well. It might be that disconnecting it for the short time to move it and the reboot when you started it back up might have helped with the issue as well.

I know that some issues I was having I found to be related to Cables, port issues and router fail over time. Before adding cameras to my Router I could have gone 6 month or a year without a reboot.

Just like sometimes it is good idea to restart your computer, Camera, DVR's and Routers is good to restart ever so often.
Be Safe.
kamera14
Posts: 8
Joined: Mon Oct 28, 2019 8:18 pm

Re: Saving Video to PC Shared Folder from IP4M-1028W Dome Camera

Post by kamera14 »

Thanks. One more thing I would like to add: I found that, on Linux, I can run openRTSP to capture the stream to disk as an alternative to the above. The procedure was:

sudo apt install livemedia-utils
cd {video folder location}
openRTSP -i -D 2 -u login_username login_password -P 900 -b 500000 -B 500000 "rtsp://192.168.1.100:554/cam/realmonitor?channel=1&subtype=0"

(This saves the files as avi format (even though the camera spits out mp4, it's ok), chunks = 900 sec, wait 2 seconds for inactivity before exiting; I also needed to increase the buffer size to 500000. Also, I need a video player to play 3x the speed, but no big deal for a security application-- all the frames are there. I tried f=10, but no diff.).

As a bonus, I created the following "bash script" (file) which executes when the storage PC boots up:

#!/bin/bash
cd {video folder location}
counter=0
while :
do
echo "\nCount No = " $counter
currentdate=`date +"%Y-%m-%d-%Hhr-%Mmin-%Ssec"`
openRTSP -i -D 2 -u login_username login_password -P 900 -b 500000 -B 500000 -F $currentdate "rtsp://192.168.1.100:554/cam/realmonitor?channel=1&subtype=0"
counter=$((counter+1))
done
exit

Seems to work pretty good. I noticed that the RTSP stream still gets interrupted. Whether it is Wi-Fi, or the camera, I do not know. However, with open RTSP, the recovery is very quick.

Good luck to all the hackers out there.
kamera14
Posts: 8
Joined: Mon Oct 28, 2019 8:18 pm

Re: Saving Video to PC Shared Folder from IP4M-1028W Dome Camera

Post by kamera14 »

Update: The RTSP doesn't get interrupted if you have a good, strong Wi-Fi signal! That was the problem.
kamera14
Posts: 8
Joined: Mon Oct 28, 2019 8:18 pm

Re: Saving Video to PC Shared Folder from IP4M-1028W Dome Camera

Post by kamera14 »

I found that open RTSP is a bit long in the tooth. FFMPEG actually does a pretty terrific job, especially when the link goes down and back up. If you use the following in the script, rather than "rtsp:...", you will be impressed!

ffmpeg -i 'rtsp://username:[email protected]:554/cam/realmonitor?channel=1&subtype=0' -stimeout 500000 -vcodec copy -t 3600 -y $currentdate.mp4

No need to download openRTSP in this case if you have ffmpeg already installed.
Post Reply