Jump to content


Photo

Decode MPEG and analyze content for surveillance


  • Please log in to reply
13 replies to this topic

#1 l0pan

  • Member
  • 11 posts

0
Neutral

Posted 26 September 2012 - 15:55

I have IP camera which sends MPEG TS video stream to my DM8000. I’d like that DM8000 receives and decodes it for motion detection with gstreamer. So a hardware MPEG decoding is needed for gstreamer. I think it can be done this way:[list=1]
[*]Add a Property for selecting decoder in gst-plugin-dvbmediasink/gstdvbvideosink.c
[*]Now I can send mpeg stream to the second HW decoder (i.e. /dev/dvb/adapter0/video1) and it won’t affect TV (?)
[*]Create gstdvbvideosrc (in openpli/gst-plugin-dvbmediasink ?) that can read raw decoded data from decoder the same way as AiO stb screengrabber does this
[*]Now I can get decoded video from gstdvbvideosrc for motion detection
[/list]

Will it work?
Is there any other ways to do this?
Also for what purposes is there the second decoder in dm8000?

Re: Decode MPEG and analyze content for surveillance #2 Sjaaky

  • Senior Member
  • 7,443 posts

+41
Good

Posted 26 September 2012 - 16:06

The second decoder in the dm8000 is used for PiP.

I guess doing everything in software is a lot easier. You don't need to decode every frame for motion detection. If you decode a frame every few seconds, that will me more than enough, or not?
Look at gstreamer plugins like this one https://gitorious.or...t-motion/README

Re: Decode MPEG and analyze content for surveillance #3 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 26 September 2012 - 16:06

1 & 2 should work
3 is a bit harder, as the grab routines grab from the first videodecoder, using some (reverse engineered?) register values.
might be difficult to find the registers for the second videodecoder (or otherwise, find the secondary video frames when it turns out that video0/video1 are timesharing with a single decoder)

Re: Decode MPEG and analyze content for surveillance #4 l0pan

  • Member
  • 11 posts

0
Neutral

Posted 26 September 2012 - 18:04

Forgot to say, that after motion is detected I want to start recording and stop recording if there is no motion for some time. I consider software decoding too.
I guess I need to create gstreamer tee element with two valve elements: one valve to stop decoding after receiving a buffer and resume it every second while the second valve will control recording (i.e. stop recording if there is no motion and start if there is). Motion detection element will be after decoder and it will send signals to recording control valve.
Is there gstreamer MPEG-TS multifilesink splitter plugin?
Is there gstreamer plugin for receiving only one buffer every second?

I’d prefer HW decoding because it’s more universal, takes less cpu and I won’t miss any motion:)

Re: Decode MPEG and analyze content for surveillance #5 l0pan

  • Member
  • 11 posts

0
Neutral

Posted 12 October 2012 - 20:59

I have some issues with 1 & 2, i.e gstdvbvideosink:
I changed
/proc/stb/vmpeg/0/fallback_framerate to /proc/stb/vmpeg/1/fallback_framerate
/dev/dvb/adapter0/video0 to /dev/dvb/adapter0/video1
And send video to it. But it interrupted TV translation (although TV is still available on one transponder thru PiP).
What should I change in gstdvbvideosink so it does decoding without displaying it?

Re: Decode MPEG and analyze content for surveillance #6 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 12 October 2012 - 21:08

are you sure your stream does not contain audio as well? (that would still cause a conflict when gstreamer tries to open /dev/dvb/adapter0/audio0)

Re: Decode MPEG and analyze content for surveillance #7 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 12 October 2012 - 21:10

btw, just to make sure, you changed the names of the devicenodes in the dvbmediasink sourcecode I guess?
(if you would just rename the devicenodes in /dev, that would cause e2 to start using the secundary video device for tv, so you'd still have a conflict with gstreamer)

Re: Decode MPEG and analyze content for surveillance #8 l0pan

  • Member
  • 11 posts

0
Neutral

Posted 12 October 2012 - 21:21

Yes, No audio. I run
gst-launch  tcpclientsrc host=192.168.1.4 port=9999  ! typefind !  mpegtsdemux !  video/mpeg ! queue !  dvbvideosink
Yes, in dvbmediasink sourcecode.

Re: Decode MPEG and analyze content for surveillance #9 mirakels

  • Forum Moderator
    PLi® Core member
  • 7,603 posts

+62
Good

Posted 12 October 2012 - 22:06

I gues you heard of the 'motion' tool? It is a video capture tool for linux doing motion detection and allows for saving motion parts and is very configurable.
Don't think it decodes MPEG streams but it should be possible to pass decode mpeg streams to it...
I've been running it for years on a linux box with a video capture card.
Geen wonder... Had slechts een dm7000, maar wel ook een rotor. eigenlijk al een tijdje ook een dm600 en dm7025. Maar nu kijkend met een et9000 en vuduo

Re: Decode MPEG and analyze content for surveillance #10 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 12 October 2012 - 22:29

Yes, No audio. I run

gst-launch  tcpclientsrc host=192.168.1.4 port=9999  ! typefind !  mpegtsdemux !  video/mpeg ! queue !  dvbvideosink
Yes, in dvbmediasink sourcecode.


ok, I would have expected that to work (though I never tried it myself)

Perhaps the dm8k video1 device needs some more magic before it will work.

Re: Decode MPEG and analyze content for surveillance #11 l0pan

  • Member
  • 11 posts

0
Neutral

Posted 13 October 2012 - 21:43

I see how it works now. Actually it doesn’t interrupt TV on video0 but overlaying the whole picture. I can see TV under video1 layer if I reduce decoding size for video1. I doubt that there is magic to overcome overlaying. It must be how drivers works or hardware limitation. Is there source codes for bcm7400.ko drivers?

Also it’s not possible just to rename decoder devicenodes in /dev, because it would require to rename also device control nodes in /proc/stb/vmpeg/0-1, but it’s impossible.

Re: Decode MPEG and analyze content for surveillance #12 pieterg

  • PLi® Core member
  • 32,766 posts

+245
Excellent

Posted 13 October 2012 - 22:20

ok, then you just need to adjust the second video decoder output, so it doesn't overlap the full screen anymore

see /proc/stb/vmpeg/1/dst_*
(normalized on pal resolution)

Re: Decode MPEG and analyze content for surveillance #13 l0pan

  • Member
  • 11 posts

0
Neutral

Posted 13 October 2012 - 22:33

Yes, I tried to move it beyond full screen using proc/stb/vmpeg/1/dst_*, but when it approaches screen boarder picture begins to shrink automatically. So video1 picture is always within full screen.

Re: Decode MPEG and analyze content for surveillance #14 l0pan

  • Member
  • 11 posts

0
Neutral

Posted 13 October 2012 - 22:48

Although it looks like it doesn't affect decoder resolution... so it is ok


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users