Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
On the Topic of Staff/Donor Command Logging
#1
The topic of logging staff/donor command usage is something that @RussEfarmer and I have both been exploring, but from different angles.  In particular, he has been exploring real-time command logging while I have been exploring extracting command usage from recorded gameplay.  I will try to have my code publicly available in the next few days, but I’ve been swamped with work.  I wanted to make this post weeks ago.

I record 100% of my time on Dink’s prop hunt both because I can reference footage to supplement bans, but also for my own accountability.  However, when you have 100s of hours of footage, simply making a couple of notes on every map of PH isn’t enough.  Example: I warn and gag someone for racism.  Later, another staff member gags the same person for racism.  In order for us to make a ban, we would need to show footage of the actions by both staff members.  In order to get this person banned, I would need to potentially watch several hours of footage.

High Level Overview
To solve this issue, I’ve written a Python script that automatically extracts my command usage from recorded gameplay footage.  At a high level, the program indexes through frames of a video looking for text.  Once all text on a frame has been found, it then parses through the text looking for statements that conform to command usage.  This is relatively simple since each command has a pattern associated with it.  For example, a kick command follows the following format: !kick [NAME] (REASON) where the [NAME] part is required and the (REASON) part is optional.  Additionally, following command usage, each command will print out on your screen stating that “you [COMMAND]ed [NAME]...”.  Here’s an example where the program found instances of me gagging the former president of the US for micspam:
   

The output of the program is a .csv file containing a table of commands used by staff/donors, the name of the command user, and finally the target of the command.  After a video has been analyzed, a secondary Python script can be used to quickly search through the output .csv files to search for particular command usage, particular users, etc.

More Details
Tesseract is an excellent optical character recognition engine currently sponsored by Google, and tesseract has support for a wide variety of programming languages including Python.  We will use tesseract as the means to detect text on video frame images.

The process for command text extraction is relatively simple.  We first use Python CV to determine the fps of the video because if your video was recorded at 60 fps and text from the chat stays on your screen for 5ish seconds, then you have at most 300 frames where the text will appear.  Many back-to-back frames will contain the same text from the chat, so it is not necessary to extract the text from all frames.  In fact, this will make our process extremely slow.  Therefore, we have the option to simply skip ahead X number of frames to avoid repeatedly searching nearly identical images for text.  In my case, I record at 30 fps, so I query text every 10 frames.

We can make additional optimizations as well.  For example, the text chat always appears on the lower left quadrant of my screen (you can set this to appear somewhere else btw).  We can limit our search area to just 1/4th the size of the original frame to save time as well.  With these optimizations, I can get through a 1 hour video in about 10ish minutes (which is relatively fast considering we are extracting text from an image!).

Once all the text has been found, I perform pattern analysis using a few regular expressions to identify command usage.  This is better left to be explained via comments in my code (that I will release soon).

Right now this is built for prop hunt, but the architecture could quickly be adapted for the other game modes.  I’m also adding in the functionality to search for the tables showing which players are online, scores, etc.  This is more for if you need to narrow your search for a particular interaction with a player where a command was not used.

Other Projects
I created a simple Python program for managing youtube video uploads.  The program is done, I just need to make a video tutorial because you need to go through Google authentication in order to link with your youtube channel.  I put the videos I want to upload in a folder, run the script, and they are automatically uploaded to my youtube channel as unlisted videos.  Simple, effective, and youtube serves as cloud storage for videos.  You can also make your videos public with such an obscure name that no one will ever find them through the search bar.  I’ll put this on my github soon.

EDIT: I don't know why the text was so small, fixed it so you don't need a microscope to read this post.
#2
This is amazing
Retired gay boy
Yes I still play!!
[Image: image.png]
#3
You’ll just see some donors and staff gagging and ungagging themselves and others.
[Image: b_560x95.png]
#4
(11-01-2021, 01:45 PM)Summer Wrote: You’ll just see some donors and staff gagging and ungagging themselves and others.
Indeed! It's good for finding evidence for abuse reports, ban requests, etc.  Also, it automates note taking so I don't have to spend the start of the next map noting down what happened last map if the last map was particularly hectic.
#5
I've been excited for this for a while, pieces of automation like this are things we've needed for way too long.. as you said I've been working on and off to get some kind of text logging from gmod for a couple years now but I could never really get there, if this is what it took then I probably couldn't have done it haha

now finally staff can go outside instead of sitting and watching a video of people saying racial slurs for 6 hours a day
#6
(11-01-2021, 06:49 PM)RussEfarmer Wrote: I've been excited for this for a while, pieces of automation like this are things we've needed for way too long.. as you said I've been working on and off to get some kind of text logging from gmod for a couple years now but I could never really get there, if this is what it took then I probably couldn't have done it haha

now finally staff can go outside instead of sitting and watching a video of people saying racial slurs for 6 hours a day
You're selling yourself short, you'll see how few lines of code the "meat and potatoes" of the text extraction is in a few days.  
I really want your method to work because mine is more of a band-aid to an annoying problem (trying to find commands + times).  I remember you saying your method could be implemented server side.  I don't know how any of that would work, but I have quite a bit of experience connecting to Google cloud services.  We could rig it so the contents of what was recorded was dumped into a shared folder in Google Drive every 24 hours.  Elegant solution really, but it would require Dinkleberg to be on board with the idea.
#7
(11-01-2021, 07:42 PM)chelllman Wrote:
(11-01-2021, 06:49 PM)RussEfarmer Wrote: -snip-
We could rig it so the contents of what was recorded was dumped into a shared folder in Google Drive every 24 hours.
I'd like to bring attention the pricing and options of Google Drive... Someone would have to be a maid for this folder everyday... 2 TB for $10 a month... That isn't much when putting videos, and multiples if that of the same time.
[Image: 46b034e83951acf7e5a924cb3b485d52.png]
Getting Dink to be on board with anything that takes money is going to be harder than asking him to add a model to the server. 6 month LEAD TIME. This project would see the same lead time and sadly would be forgotten in the process.

I do love seeing you guys create something to help, even if it's because of lack of care to fix relay correctly from our lord and savior. I'd really suggest keeping this as a plugin/project relying on the staff/donors/playerbase. I think we would see a better outcome by doing this, since you know it's hard to get someones attention :/
#8
(11-01-2021, 09:53 PM)[black]Darkkran Wrote:
(11-01-2021, 07:42 PM)chelllman Wrote:
(11-01-2021, 06:49 PM)RussEfarmer Wrote: -snip-
We could rig it so the contents of what was recorded was dumped into a shared folder in Google Drive every 24 hours.
I'd like to bring attention the pricing and options of Google Drive... Someone would have to be a maid for this folder everyday... 2 TB for $10 a month... That isn't much when putting videos, and multiples if that of the same time.

-snip-

I do love seeing you guys create something to help, even if it's because of lack of care to fix relay correctly from our lord and savior.

This is a valid point.  I think the way around this would be to only store text containing command usage (including a timestamp).  Burden to store videos can still be on staff members (most staff delete videos after a time), but having the text command usage could be used for quick indexing.  Example: We simply search through the files for a particular user, find the times commands were used on them, and then various staff members can index by date on their own computers to find supporting video evidence.
Storing 100% of the video server side would just not be practical unfortunately.

One thing that would be cool is to have shadow record enabled server side that is automatically triggered when certain individuals use commands.  I've had people complain to me about certain donors abusing commands, but since no one ever records and they behave when staff are on, nothing happens.  It would be awesome if when certain people use commands, the shadow buffer is saved (past 30 seconds maybe).  These videos could be automatically deleted after 3 days in the cloud.

At this point, I'm just spitballing, I really like Russ's idea.
#9
(11-01-2021, 10:04 PM)chelllman Wrote:
(11-01-2021, 09:53 PM)[black]Darkkran Wrote:
(11-01-2021, 07:42 PM)chelllman Wrote:
(11-01-2021, 06:49 PM)RussEfarmer Wrote: -snip-
We could rig it so the contents of what was recorded was dumped into a shared folder in Google Drive every 24 hours.
I'd like to bring attention the pricing and options of Google Drive... Someone would have to be a maid for this folder everyday... 2 TB for $10 a month... That isn't much when putting videos, and multiples if that of the same time.

-snip-

I do love seeing you guys create something to help, even if it's because of lack of care to fix relay correctly from our lord and savior.

This is a valid point.  I think the way around this would be to only store text containing command usage (including a timestamp).  Burden to store videos can still be on staff members (most staff delete videos after a time), but having the text command usage could be used for quick indexing.  Example: We simply search through the files for a particular user, find the times commands were used on them, and then various staff members can index by date on their own computers to find supporting video evidence.
Storing 100% of the video server side would just not be practical unfortunately.

One thing that would be cool is to have shadow record enabled server side that is automatically triggered when certain individuals use commands.  I've had people complain to me about certain donors abusing commands, but since no one ever records and they behave when staff are on, nothing happens.  It would be awesome if when certain people use commands, the shadow buffer is saved (past 30 seconds maybe).  These videos could be automatically deleted after 3 days in the cloud.

At this point, I'm just spitballing, I really like Russ's idea.

Having the information stored on staff would be much better. I agree having it stored server side wouldn't work imo. Sadly, I can attest to bearing witness to years of Dink's procrastination and being super busy that this project cannot rely on the server box at all. Russ has gotten a few things in by helping with coding or writing stuff, but it was pushed and pushed so hard by staff. Pointshop was fixed for a very long time before it was implemented and that's a problem with the man above... This is not negativity but more of realism. The logical thing here would have fixed relay for certain things INFORMATION I CANNOT POST HERE, DM ME .

Example: We simply search through the files for a particular user, find the times commands were used on them, and then various staff members can index by date on their own computers to find supporting video evidence.

This is a strong alternative as long as you guys keep this idea solely behind staff members/donors/players willing to help.


Forum Jump:


Users browsing this thread: 1 Guest(s)

About Us
    This is Dinkleberg's GMod, a gaming community based in Garry's Mod. We have a Trouble in Terrorist Town, Prop Hunt, Murder, and Deathrun Server. Come check them out sometime.