Signbank / Global-signbank

An online sign dictionary and sign database management system for research purposes. Developed originally by Steve Cassidy/ This repo is a fork for the Dutch version, previously called 'NGT-Signbank'.
http://signbank.cls.ru.nl
BSD 3-Clause "New" or "Revised" License
19 stars 13 forks source link

Capture videos via webcam #266

Open ocrasborn opened 7 years ago

ocrasborn commented 7 years ago

Cf. idea by @henrinie , https://github.com/Signbank/FinSL-signbank/issues/212#issuecomment-274079767

ocrasborn commented 5 years ago

If there's time left before Sept 1 2019, let's take this over from FinSL Signbank; end of the thread there was that it was stable enough.

Jetske commented 1 year ago

scrsh

This is what I have now. On the left is the live webcam stream and on the right you can playback the recorded video.

I kind of forgot to use the FinSL version and used WebRTC instead of RecordRCT. If you want though, I can try to switch to that. It takes some time to figure out but it could be more stable.

The upload button does not always work so I need to figure out why, and maybe also add some checks for a limit to the length/size of the video. And it still needs styling as well.

But if you have any feedback at this point, let me know.

susanodd commented 1 year ago

It looks really exciting!!

Jetske commented 1 year ago

image

Update: it looks a lot better now and also seems to be quite stable. I tried multiple browsers and had no problems.

I also added a little figure overlay to the recording box to guide people where they should be placed in the frame. With webcams I can imagine that people tend to sit too close to the screen or too high.

susanodd commented 1 year ago

The video capture via webcam can be added to the Feedback Pages. (#873 is live now)

susanodd commented 1 year ago

This is a really nice feature!

@ocrasborn see if this works for you?

(Related. Cross platform browser usage seems to be weird. Chrome upload / Firefox viewing. #886)

Jetske commented 1 year ago

@ocrasborn somehow Firefox cannot read the mp4 files recorded in other browsers. The other browsers I tried (IE, Opera, Vivaldi, Edge, Brave) don't seem to have this problem.

I'm curious if it works on apple though!

susanodd commented 1 year ago

@Jetske , this is the error that arises when trying to convert this already uploaded video on the server using the new convert_to_mp4:

When a non-mp4 is found, it prints the path and the type (before trying to convert):

Non-MP4 video file found: /var/www/writable/glossvideo/tstMH/Fi/Fietsmandje test-44099_gWkW6Em.mp4 application/x-empty

It thinks the type of the video file is application/x-empty

Then this failure:

/var/www/writable/glossvideo/tstMH/Fi/Fietsmandje test-44099_gWkW6Em.mp4: Invalid data found when processing input

It succeeded on buffelmozzarella. I'll see if that's visible on Mac later. (That one was recorded on Firefox.)

susanodd commented 1 year ago

There seem to be quite a few "backup" files that were created for Fietsmandje. The code that makes a backup is perhaps doing something. Only the oldest file is non-empty. But the one shown above (in the error messages) is the one in GlossVideo.

-rwxrwx--- 1 ubuntu www-data               0 Mar  9 14:23 Fietsmandje test-44099.mp4
-rwxrwx--- 1 ubuntu signbank-writable 989997 Mar  6 12:35 Fietsmandje test-44099.mp4.bak17156
-rwxrwx--- 1 ubuntu www-data               0 Mar  9 15:06 Fietsmandje test-44099_81sT9uW.mp4
-rwxrwx--- 1 ubuntu www-data               0 Mar  9 15:05 Fietsmandje test-44099_8SABKf7.mp4
-rwxrwx--- 1 ubuntu www-data               0 Mar  9 14:30 Fietsmandje test-44099_HbliWq3.mp4
-rwxrwx--- 1 ubuntu www-data               0 Mar  9 14:29 Fietsmandje test-44099_a72txns.mp4
-rwxrwx--- 1 ubuntu www-data               0 Mar  9 15:21 Fietsmandje test-44099_gWkW6Em.mp4
susanodd commented 1 year ago

The webcam video recorded on Firefox is visible on Safari now!

Jetske commented 1 year ago

Yes, sorry, I was trying all sort of files and they can be deleted.

But that is useful. Should all other files except for the last uploaded mp4 be bak files?

susanodd commented 1 year ago

I'm not exactly sure. It's whatever that reversion code is doing. I suspect multiple "backup" things are running simultaneously. I suspect they are supposed to stay in GlossVideo (The ones with bak seem to stay there.) This was also the reason for the extra command to find dangling video files. At the moment I don't think any code physically deletes any video files.

susanodd commented 1 year ago

We could probably best put a tool inside of Admin for the actual files (including those that are not in GlossVideo). Probably the command you made could be put there, although it's for the virtual environment now (but never merged). I added a folder video_backups under writable in the last commit in order to fix the weird files. It copies them first. Your video functions could make use of that too.

BACKUP_VIDEOS_FOLDER = 'video_backups'

susanodd commented 1 year ago

Another one from yesterday is empty: -rwxrwx--- 1 ubuntu www-data 0 Mar 9 15:22 FIETSTAS-44102.mp4

I'm going to delete all of those fietstas test videos and also from GlossVideo.

Maybe a test is needed to check that the video has data.

susanodd commented 1 year ago

I removed all the empty files. The wrongly named one (that was in GlossVideo) I copied it via via ponyland to my own computer and uploaded it to the gloss. It's there now! And only the one video in GlossVideo, with the correct name.

rosestamp commented 1 year ago

I tried using this feature and I signed a test sign twice but the video cut off after 1 sec

susanodd commented 1 year ago

I checked the video file on the server. It has the correct permissions and group and it's visible. @Jetske this must be in the code that does the recording.

susanodd commented 1 year ago

I checked the GlossVideo admin to look at new videos to see if any have the wrong group (that has been repaired, but there can be some uploaded before it was repaired.)

The sign NGT 1,5-A seems to have a new video (gloss 2895). (Or a newly uploaded video.) But it looks like the video isn't complete when viewed. (I assume the hand should go all the way up?)

Jetske commented 1 year ago

There is an error in chrome & edge because of the comma in the filename. But at the moment I can't find why it cut off the video..

susanodd commented 1 year ago

@Jetske is this working okay now?

Jetske commented 1 year ago

Looks like it's working fine when recording in Chrome (and I assume most other browsers) and then it is visible in Firefox, but recording videos in Firefox is disabled. I don't know about safari at the moment...

susanodd commented 1 year ago

No, Safari doesn't allow it.

I'll close this now.

susanodd commented 2 weeks ago

On Firefox, there is no way to dismiss the modal that says it's not available

webcam-recording-not-available-no-dismiss

susanodd commented 2 weeks ago

On Firefox, there is no way to dismiss the modal that says it's not available

Now trying it on Chrome on Ubuntu.

It records okay and can see the preview. But when I upload it, only the image is visible. The video is not visible.

ubuntu-chrome-video-recording

ubuntu-chrome-recorded-video-where-is-it

Jetske commented 2 weeks ago

@susanodd I had a lot of trouble getting it to work in Firefox, it was disabled to prevent having bad video files saved that can't be viewed in Chrome. We can look at it again, if necessary. Are there complaints from users about this?

susanodd commented 2 weeks ago

@susanodd I had a lot of trouble getting it to work in Firefox, it was disabled to prevent having bad video files saved that can't be viewed in Chrome. We can look at it again, if necessary. Are there complaints from users about this?

Probably no complaints. But I need to be able to record videos somehow in order to finish the feedback issue #1258

At the moment, I have no computer and no browser that succeeds.

susanodd commented 2 weeks ago

This almost works on Safari. It turns on the camera and I see myself in the video window. But then there's a website (not Apple) message that I need to use a different browser. I think it should go ahead and record, not check the browser. It will work. It turned on the camera and it started recording, but the camera can't be turned off then because the site didn't do anything, it gave the message. In safari you get a red camera icon in the browser window bar and can see the camera is on. You only need to grant the site permission.

Maybe we can use the Apple on @vanlummelhuizen's desk to work this out?

susanodd commented 2 weeks ago

I looked up what software works with Safari and it's maybe the same as is being used by signbank? Maybe it didn't work yet when the feature was added? MediaStream This is one of the toggles in the Safari Developer menu as experimental features, you can choose this. Anybody can turn this on. Like a plug-in. Mac has Unix underneath.

Jetske commented 2 weeks ago

I think recording works in all browsers, but then saving the video gives most trouble. Because in some browsers the stream has a different format than in other browsers, or something like that. I'm not exactly sure. When we were testing it months ago, videos that were recorded in Firefox could not be viewed in Chrome. The other way around it did work, so that's why I restricted the option.

susanodd commented 2 weeks ago

I think recording works in all browsers, but then saving the video gives most trouble. Because in some browsers the stream has a different format than in other browsers, or something like that. I'm not exactly sure. When we were testing it months ago, videos that were recorded in Firefox could not be viewed in Chrome. The other way around it did work, so that's why I restricted the option.

Any ideas how to solve this? It doesn't work to record in Chrome either.