Recording length not honored, time lost between files



  • So I've switched from libx264 to copy for my mp4 camera streams. Now that I've upgraded properly (running a dev build), I can see the Recording height/width/fps and I've adjusted those but I'm stuck at 2min for cutoff, even if I change it to 5 or 15 minutes. When I change it to 1 min the server honors it and I get 1min long videos. But nothing longer than 2 minutes. Hikvision cam pulling a h264 stream, what am I missing?



  • So overnight I've noticed a pattern in my files. I'm seeing 2min files (roughly, give or take a few seconds) like this. I've copied the timestamp data from one of the video recording feeds I looked at.

    1. 10:17:04 to 10:15:04
    2. 10:19:05 to 10:17:08
    3. 10:21:05 to 10:19:09
    4. 10:23:05 to 10:21:08
    5. 10:25:05 to 10:23:09
    6. 10:27:05 to 10:25:08
    7. 10:29:05 to 10:27:09
      8. 10:30:02 to 10:29:08
    8. 10:32:02 to 10:30:02

    So it seems as thought the software is trying to give me a 15 minute file, but isn't able to (video file #8 is the shorter one). And I see this pattern throughout all six cameras recording last night. Also, I'm loosing 3-4 seconds of video footage between each file - that's not good if something actually happens - so why the loss of time between files?

    BTW the funky formatting on this forum is driving me crazy. #8 without spaces in this list should be 9) but it's not showing up that way since I bolded it, shows up as 8. instead of 8 ) without space (otherwise it looks like 😎 with space).



  • Update: Still have a repeatable problem with missing time between files, and recording length still defaults to 2 minutes, even when I have 15 entered over the past week of recordings.


  • administrators

    hey there, if you have the recording length set to 15 minute segments and those times above are the recording lengths of the files you are getting then it seems like ffmpeg crashing. This could be a few things but the most common are :

    • loss of connection to the camera. Like network loss or camera reboot.
    • the resources of the hardware are being maxed out. Like there isn't enough CPU or RAM.


  • @moeiscool I'm sitting at 133% (little over one core in use) on a 2.5Ghz i5, 8GB ram Mac Mini. Cameras are not rebooting nor loosing power, and network is not lost that I can tell - they are wired into POE switch directly connected to separate gigabit/usb input port on the Mini, no timeouts or issues there.

    What should I do to find out if ffpmeg is crashing? Where can I look?



  • bump - looked at logs in user and superuser section, nothing pops up... where else can I look to figure out what's going on?



  • @super_kev Just to make sure:
    Have you set "Save Log in SQL: YES" ?

    If not, ffmpeg logs will not be saved in the "main" log viewer.

    I would asume you get "ffmpeg unexpected exit" in logs or similar, with details of the cause?


  • administrators

    @super_kev sorry i haven't responded sooner. If your CPU use is that high then FFmpeg processes will start to crash. Can you please export the settings for one of the cameras behaving this way and upload it here.

    Can you please take a screenshot of the internal camera settings? Like the ones in the camera's web interface (they are sometimes set with a third-party program but most usually have the web interface).

    for logs about FFmpeg, you can turn on logging for the camera in question. At the bottom of the advanced section there is "Logging". Please only set it to Warning when having it save to SQL. "Debug" will just overflow the db with useless data.



  • Here are some screenshots of the settings from one of the cameras - all six are like this, and all six only record at 2min intervals. I also turned on SQL debug as warnings only and logged into superuser but didn't see anything - just that I had logged in (Web Socket).

    0_1515903172957_Log.jpg 1_1515903157025_Settings2.jpg 0_1515903157024_Settings1.jpg



  • Please open the log viewer in the normal Dashboard, not in Super Admin.
    In the menu left upper corner.



  • Ah, gotcha, here are my logs for one cam. Looks like a timestamp issue?

    0_1515956485883_Log1.jpg

    1_1515956485883_Log2.jpg



  • The warnings regarding timestamps is also logged for all my cameras. I think this is more an information rather than an error, and not causing any problems on my setup.
    If you keep logging, does is not show more?
    Video finished and so on every 2 minutes?



  • Yes, now there is a repeating pattern. For some reason I'm now seeing a message that camera is not recording, when it is. But I don't know if there is anything else. Here we go:

    2 minutes ago	2018-01-15T00:12:07.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG STDERR
    msg : [segment @ 0x7fdcc980cc00]
    
    2 minutes ago	2018-01-15T00:12:07.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG STDERR
    msg : Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly [segment @ 0x7fdcc980cc00] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
    
    2 minutes ago	2018-01-15T00:12:04.000Z	undefined	fjAsOVPOp1	
    type : Camera is not recording
    msg :
    msg : Restarting Process
    
    2 minutes ago	2018-01-15T00:12:04.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG Process Started
    msg :
    cmd : -loglevel warning -rtsp_transport tcp -i rtsp://admin:[email protected]/video.h264 -vcodec copy -r 10 -an -s 2048x1536 -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:2 -segment_time 600 "/Users/cctv/Shinobi/videos/H4sJYRmYiU/fjAsOVPOp1/%Y-%m-%dT%H-%M-%S.mp4" -c:v mjpeg -f image2pipe -q:v 15 -r 2 -s 2048x1536 pipe:1 -update 1 -r 1 "/Users/cctv/Shinobi/streams/H4sJYRmYiU/fjAsOVPOp1/s.jpg" -y
    
    2 minutes ago	2018-01-15T00:12:04.000Z	undefined	fjAsOVPOp1	
    type : Video Finished
    msg :
    filename : 2018-01-14T16-10-08.mp4
    
    4 minutes ago	2018-01-15T00:10:08.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG STDERR
    msg : [segment @ 0x7f8b42019e00]
    
    4 minutes ago	2018-01-15T00:10:08.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG STDERR
    msg : Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    
    4 minutes ago	2018-01-15T00:10:08.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG STDERR
    msg : [segment @ 0x7f8b42019e00] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
    
    4 minutes ago	2018-01-15T00:10:04.000Z	undefined	fjAsOVPOp1	
    type : Camera is not recording
    msg :
    msg : Restarting Process
    
    4 minutes ago	2018-01-15T00:10:04.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG Process Started
    msg :
    cmd : -loglevel warning -rtsp_transport tcp -i rtsp://admin:[email protected]/video.h264 -vcodec copy -r 10 -an -s 2048x1536 -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:2 -segment_time 600 "/Users/cctv/Shinobi/videos/H4sJYRmYiU/fjAsOVPOp1/%Y-%m-%dT%H-%M-%S.mp4" -c:v mjpeg -f image2pipe -q:v 15 -r 2 -s 2048x1536 pipe:1 -update 1 -r 1 "/Users/cctv/Shinobi/streams/H4sJYRmYiU/fjAsOVPOp1/s.jpg" -y
    
    4 minutes ago	2018-01-15T00:10:04.000Z	undefined	fjAsOVPOp1	
    type : Video Finished
    msg :
    filename : 2018-01-14T16-08-07.mp4
    
    6 minutes ago	2018-01-15T00:08:08.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG STDERR
    msg : [segment @ 0x7ff3fb09bc00]
    
    6 minutes ago	2018-01-15T00:08:08.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG STDERR
    msg : Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
    
    6 minutes ago	2018-01-15T00:08:08.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG STDERR
    msg : [segment @ 0x7ff3fb09bc00] Non-monotonous DTS in output stream 0:0; previous: 0, current: 0; changing to 1. This may result in incorrect timestamps in the output file.
    
    6 minutes ago	2018-01-15T00:08:04.000Z	undefined	fjAsOVPOp1	
    type : Camera is not recording
    msg :
    msg : Restarting Process
    
    6 minutes ago	2018-01-15T00:08:04.000Z	undefined	fjAsOVPOp1	
    type : FFMPEG Process Started
    msg :
    cmd : -loglevel warning -rtsp_transport tcp -i rtsp://admin:[email protected]/video.h264 -vcodec copy -r 10 -an -s 2048x1536 -f segment -segment_atclocktime 1 -reset_timestamps 1 -strftime 1 -segment_list pipe:2 -segment_time 600 "/Users/cctv/Shinobi/videos/H4sJYRmYiU/fjAsOVPOp1/%Y-%m-%dT%H-%M-%S.mp4" -c:v mjpeg -f image2pipe -q:v 15 -r 2 -s 2048x1536 pipe:1 -update 1 -r 1 "/Users/cctv/Shinobi/streams/H4sJYRmYiU/fjAsOVPOp1/s.jpg" -y
    
    6 minutes ago	2018-01-15T00:08:04.000Z	undefined	fjAsOVPOp1	
    type : Video Finished
    msg :
    filename : 2018-01-14T16-06-06.mp4
    


  • Could the whole "Camera is not recording" be a problem here, or maybe the timestamp missing? Am I pulling the wrong main stream? The probe shows great data and there are no problems with the video view...


  • administrators

    Camera is not recording means that there has been no update to the recorded files folder when there should have been. It could be that permissions need to be set if it can't write. chmod -R 777 . inside the shinobi folder if all fails.

    but if it has recorded some stuff then its not that...

    you are able to watch the stream... but not record?! are you recording over network?



  • Permissions were 755, which I left as I'm getting lots of video files in each ID stored in /Shinobi/video, and they are automatically deleted once storage hits a certain size.

    Yes, I can watch, and all streams are recorded, but only in 2 min intervals. Cams are connected to a POE switch directly into the computer, on a separate subnet not accessible to outside world.



  • Ok, so I took BatchMod and dropped Shinobi folder on it and did 777 out of desperation, and bingo, now videos are saving at 10 min intervals, but I still think I'm loosing 2-5s between clips - I'll check once I see a repeating pattern in the next few hours. Why would Staff/Everyone permissions be incorrect with 755 (when user should be full read/write/execute?) when it should just be the user who's in control? I should have checked the .json files to see if permissions were incorrect there...



  • Nope, just looked and I'm back to every 2 minutes on all cameras. However, if I go in and save the settings (say, it was set on 10 minutes, if I go in and hit the save button again) the first file recorded since I hit save will be about 10 minutes long, then it defaults to 2 minutes again. I checked permissions on all Shinobi directory files and they are still all 777.



  • Updated to latest Dev build (from stable/pro) and still am getting 2 min recording intervals, with several seconds lost between files (probably when feed is chopped and file is saved by ffmpeg?)


  • administrators

    if you are missing time inbetween it could be that your camera is losing connection. When FFMPEG makes new segments it doesn't need to to stop the stream, it just starts pushing the data to a new file.


 

Looks like your connection to Shinobi Forum was lost, please wait while we try to reconnect.