ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped frames

Have some questions or having issues with your IP Camera(s), Post them here for the mods and other users to assist you with.
User avatar
Draco
Posts: 7
Joined: Tue Mar 22, 2016 1:04 pm

ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped frames

Post by Draco »

I attempted to call into support but was unfortunately quickly redirected to send in an email instead, so I'll post here and send one in too!

I have two Amcrest 1080p IP2M-841B units that are impacted by these same issues.

These following issues will happen at random and get worse over time:
  • - Image will glitch, skip frames, corrupt by going all green or partially green, and sometimes look like a bad VHS tape attempting to track. (completely missing keyframes)
    - While monitoring latency/ping results, it will show spikes in excess of 600ms, 1200ms and 2000ms over wireless (as well as hard-wired) when this is happening.
    - Accessing the control panel for the camera will be dreadfully slow and unresponsive (as expected considering the latency, really).
My usage:
I'm accessing the camera with ffmpeg powered tools utilizing RTSP (rtsp://user:pass@ipcam1) for my live stream on twitch.tv/draco - OBS (video plugin) and OBS-MP (aka OBS Studio) also will see the same problems ingesting the feed. Both of these streaming programs do use ffmpeg-related libraries for A/V.

ffmpeg when run by console on my Linux server is littered with frame drops even while the above listed issues aren't happening or heavily apparent. Output of this is pasted below.

And just to stress this point: Rebooting the camera resumes proper functionality! Over time, something is happening which is making the unit fall unstable in delivering packets. My assumption is high CPU usage due to a runaway process but my guesses are based on no engineering knowledge on the cameras hardware and software.

Simple output example:

https://www.dropbox.com/s/e6zq6d5w6i9ya ... 1.png?dl=0

ffmpeg:

Code: Select all

Input #0, rtsp, from 'rtsp://admin:securepw@amcam02:554/cam/realmonitor?channel=1&subtype=0':
Metadata:
title : Media Server
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 15 fps, 100 tbr, 90k tbn, 30 tbc
Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
[libx264 @ 0x80ac43920] using SAR=1/1
[libx264 @ 0x80ac43920] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
[libx264 @ 0x80ac43920] profile High, level 4.0
[libx264 @ 0x80ac43920] 264 - core 144 r2533 c8a773e - H.264/MPEG-4 AVC codec - Copyleft 2003-2015 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=36 lookahead_threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=60 keyint_min=6 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=cbr mbtree=1 bitrate=2000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=2000 vbv_bufsize=2000 nal_hrd=cbr filler=1 ip_ratio=1.40 aq=1:1.00
[flv @ 0x80ac53620] Codec for stream 1 does not use global headers but container format requires global headers
Output #0, flv, to 'rtmp://cast:1935/cast/test':
Metadata:
title : Media Server
encoder : Lavf56.40.101
Stream #0:0: Video: h264 (libx264) ([7][0][0][0] / 0x0007), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 2000 kb/s, 30 fps, 1k tbn, 30 tbc
Metadata:
encoder : Lavc56.60.100 libx264
Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 16000 Hz, mono
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
Past duration 0.999992 too large
[NULL @ 0x80ac41b20] RTP: missed 11 packets
Last message repeated 2 times
[NULL @ 0x80ac41b20] RTP: missed 151 packets
[flv @ 0x80ac53620] Non-monotonous DTS in output stream 0:1; previous: 4080, current: 4060; changing to 4080. This may result in incorrect timestamps in the output file.
[NULL @ 0x80ac41b20] RTP: missed 1 packets
[h264 @ 0x80ac4c520] error while decoding MB 33 41, bytestream -5
[h264 @ 0x80ac4c520] concealing 336 DC, 336 AC, 336 MV errors in P frame
[NULL @ 0x80ac41b20] RTP: missed 4 packets
[NULL @ 0x80ac41b20] SEI type 218 size 1528 truncated at 272
[h264 @ 0x80ac4ca20] SEI type 218 size 1528 truncated at 261
[NULL @ 0x80ac42020] RTP: missed 1 packets
[NULL @ 0x80ac41b20] RTP: missed 7 packets
[NULL @ 0x80ac41b20] RTP: missed 1 packets
[h264 @ 0x80ac4b120] left block unavailable for requested intra4x4 mode -1 at 0 22
[h264 @ 0x80ac4b120] error while decoding MB 0 22, bytestream 19402
[h264 @ 0x80ac4b120] concealing 1889 DC, 1889 AC, 1889 MV errors in I frame
If Amcrest or *anyone* can provide any further insight on this, I'm all ears. I would love to advertise and show off these Amcrest cameras on my live streams. They're being installed as kitchen/cooking cameras and when they're working properly, they provide such incredible convenience for me, which is why I'm pretty disappointed in the unstable nature of them.

- Draco
twitch.tv/draco

(Also, nice touch using OCRemix tracks for hold music. I'm just not entirely impressed by who I got on the phone. And for the love of god, stop using aggressive captcha on this forum. It constantly pops up on hitting Preview Post) ~_~
Attachments
Quick snap of the output seen when the camera begins flipping out.
Quick snap of the output seen when the camera begins flipping out.
amcrest-rtsp-glitch-01.png (31.6 KiB) Viewed 6136 times
User avatar
Draco
Posts: 7
Joined: Tue Mar 22, 2016 1:04 pm

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by Draco »

Just as a quick update to this situation (because there's nothing worse than a thread that goes nowhere):

After emailing this over to Amcrest support, they have initiated an RMA process and want to replace both of my cameras.

Once I get the two back from them, I'll update further on if the issue remains. Here's hoping the replacement fixes this! With my Oculus Rift soon on the way, I'll need these for some OBS scenes. :P
HellKnightHicks
Posts: 2
Joined: Fri Apr 01, 2016 7:25 am

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by HellKnightHicks »

Im looking to do the same thing myself.

Did you ever get this issue stored out?
User avatar
Draco
Posts: 7
Joined: Tue Mar 22, 2016 1:04 pm

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by Draco »

HellKnightHicks wrote:Im looking to do the same thing myself.

Did you ever get this issue stored out?
They only just received my return RMA package. They're sending out the (new? refurbished?) cameras back today. I'll be sure to update the thread on how things turn out once I get them.
HellKnightHicks
Posts: 2
Joined: Fri Apr 01, 2016 7:25 am

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by HellKnightHicks »

Thanks.

I need to stream a surveillance camera... I have an Amcrest myself... Any pointers?

I was just gonna use OBS to stream from the Surveillance system... Dunno of a better way.
User avatar
Draco
Posts: 7
Joined: Tue Mar 22, 2016 1:04 pm

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by Draco »

HellKnightHicks wrote:Thanks.

I need to stream a surveillance camera... I have an Amcrest myself... Any pointers?

I was just gonna use OBS to stream from the Surveillance system... Dunno of a better way.
I suppose a quick and dirty way of going about streaming one is using ffmpeg/avconv or gstreamer (more complicated/buggy) depending on your setup/platforms that has access to the DVR/cams. I'm sure there might (possibly) be more convenient solutions to this though.

Since I despise Amcrest's inconvenient Chrome app/plugin (which is possibly going away, since Chrome is getting rid of apps), I planned to do some sort of node.js-based solution to ingesting the feeds from these cameras and throwing them on a simple webpage at some point. All I want is a simple way to view multiple cameras and send PTZ/image adjustment options to them over the provided API. Pretty simple in theory, but may take some time for a novice programmer such as myself.

Reliability is key and I hope the cameras I'm getting back on RMA provide a better experience for me.
djanjic
Posts: 1
Joined: Sun Apr 17, 2016 6:11 am

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by djanjic »

I'm having similar problems with my new (2 weeks) 2 842 Wireless IP Cameras where it drops frames. I go from say (seconds) 1,2,3,4 and then skips a few seconds and then starts again.

Did you have any resolution/joy with the new cameras? Thanks.
User avatar
Draco
Posts: 7
Joined: Tue Mar 22, 2016 1:04 pm

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by Draco »

djanjic wrote:I'm having similar problems with my new (2 weeks) 2 842 Wireless IP Cameras where it drops frames. I go from say (seconds) 1,2,3,4 and then skips a few seconds and then starts again.

Did you have any resolution/joy with the new cameras? Thanks.
I didn't forget this thread! I've just been busy. :(

Currently broadcasting the cams now and the only reliable way to watch/stream each cam is by using VLC (or any RTSP-streamer program?) and RTSP. Since the RTSP stream is user/pass protected (it's annoying we can't disable this), make sure you're polling it with a client (vlc for instance) that can do that authentication properly. I've found some clients can't parse a user/pass properly sometimes. (eg. "rtsp://admin:pass@ip")

Here's OBS (Studio/Multiplatform) grabbing the two VLC windows w/ game capture:
https://www.dropbox.com/s/acqbsx2gm5cjq ... 6.png?dl=0

The wifi does seem pretty iffy though on these units in regards to actual strength sometimes. Maybe it's just the routers and/or general interference I subject them to with my other devices. I've had them still drop frames, but it picks right back up easily, unlike fetching with ffmpeg/RTMP.

I will attempt ffmpeg + rtmp later on to see if the same issues still happen, but I've had these two VLC windows up for days without any glitching cropping up that I was getting no matter what with the 2 other cams I sent in for an RMA.

Feel free to stop by if you'd like (twitch.tv/draco) and chat, whether the cast is live or not. I'm always around in there. I'll try to keep this thread alive some more too. :)

-Draco
TomSwift
Posts: 1
Joined: Mon May 02, 2016 8:57 pm

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by TomSwift »

@Draco - were you able to get ffmpeg to connect to the camera? I've been trying a simple ffplay rtsp://admin:pass@ip:port/cam/realmonitor?channel=0&subtype=1 and all I get is method OPTIONS failed: 401 Unauthorized. Not sure if this is ffmpeg/ffplay or the camera.
User avatar
Draco
Posts: 7
Joined: Tue Mar 22, 2016 1:04 pm

Re: ffmpeg/RTSP - 1080p IP2M-841B units glitching/dropped fr

Post by Draco »

TomSwift wrote:@Draco - were you able to get ffmpeg to connect to the camera? I've been trying a simple ffplay rtsp://admin:pass@ip:port/cam/realmonitor?channel=0&subtype=1 and all I get is method OPTIONS failed: 401 Unauthorized. Not sure if this is ffmpeg/ffplay or the camera.
Sorry for the long delay between replies.

With ffplay I was able to connect just fine with my normal URL line. (rtsp://admin:pass@amcam02) Though I wasn't using the rest of the path to target any of the sub-streams.

The bigger issue I'm having is that even with hitting it up with rtsp or rtmp, it'll drop packets like mad. ffmpeg with this camera just doesn't pull clean frames consistently. It's just repeat console messages like so:

Code: Select all

03:36:10.315: error:   error while decoding MB 20 31, bytestream td
03:36:10.324: warning: max delay reached. need to consume packet
03:36:10.324: warning: RTP: missed 40 packets
03:36:10.324: warning: max delay reached. need to consume packet
03:36:10.324: warning: RTP: missed 16 packets
03:36:10.324: warning: max delay reached. need to consume packet
03:36:10.324: warning: RTP: missed 2 packets
03:36:10.614: warning: max delay reached. need to consume packet
03:36:10.614: warning: RTP: missed 28 packets
03:36:10.614: warning: max delay reached. need to consume packet
03:36:10.614: warning: RTP: missed 4 packets
03:36:10.913: warning: max delay reached. need to consume packet
03:36:10.913: warning: RTP: missed 3 packets
03:36:10.914: warning: max delay reached. need to consume packet
03:36:10.914: warning: RTP: missed 13 packets
Unfortunately, this rules out using it as a direct source in OBS (Multiplatform/Studio) since it uses ffmpeg libs to ingest. What's odd about the whole thing is VLC can pull it just fine without glitching/artifacting over long periods of time. I'm not sure if any Amcrest devs can give a hint on why this is so? I doubt they would care, unfortunately. Every time I've tried to hit them up, I've gotten very basic support... the "did you turn it off and back on again?" kind. Feel free to prove me wrong, Amcrest! :\
Post Reply