biigle / core

:large_blue_circle: Application core of BIIGLE
https://biigle.de
GNU General Public License v3.0
12 stars 16 forks source link

Live video stream support #273

Open mzur opened 5 years ago

mzur commented 5 years ago

I played around with video stream support. An OGG stream via HTTP can be created with VLC like this:

cvlc "my-video.mp4" --sout='#transcode{vcodec=theo,vb=800,acodec=vorb,ab=128,channels=2,samplerate=44100,scodec=none}:http{mux=ogg,dst=:8080/}' --no-sout-all --sout-keep

The stream is published at localhost:8080. If I set this as the video source in the video annotation tool it works, if somewhat flaky. The following issues need to be resolved:

Idea: BIIGLE itself listens to the video stream and records it. The video annotation tool then shows a stream of the recorded version of the video. The keyframes of new annotations must be placed relative to the start of the recorded version.

This can't continue until we have more information on how the actual video streams of the ROV work.

mzur commented 4 years ago

The ROV provides an analog 1080p50 signal via SDI. In order to get a HTTP video stream, a video encoding device like this would be required. I see the following issues:

mzur commented 4 years ago

Investigate which exact device would provide the correct video stream that would be compatible with a browser and BIIGLE. The GEOMAR people might buy such a device. Create a mockup for a setup with BIIGLE and live video streaming.

mzur commented 3 years ago

I think this device would be the correct one. It converts an SDI video stream to an MPEG-TS stream that can be served via HTTP. However, it is not clear if the stream is compatible with video streaming JavaScript libraries (i.e. HLS, HTTP Live Streaming). It claims that "live stream previewing on any web browser" is possible in the web interface of the device, so it should work. I asked the manufacturer via email to be sure.

mzur commented 3 years ago

The manufacturer did not respond. However, I found an alternative (cheaper) device here. It's a 3G-SDI to H.264 converter which supposedly supports live streaming via HLS. This would work with hls.js.

The availability of such a device means that we could do an experimental implementation with a fake HLS stream and hls.js. The library includes a hls.liveSyncPosition which could be the actual current video time. If so, it would allow the video annotation tool to create annotations at the correct time. The live stream video could be swapped later with the recorded video and the annotations would be correct.

mzur commented 3 years ago

Here is an example command to use VLC to convert a video to static (non-live) HLS files (source):

cvlc -I dummy input.mp4 vlc://quit --sout='#transcode{width=320,height=240,fps=25,vcodec=h264,vb=256,venc=x264{aud,profile=baseline,level=30,keyint=30,ref=1},acodec=mp3,ab=96}:std{access=livehttp{seglen=10,delsegs=false,numsegs=0,index=hls/mystream.m3u8,index-url=http://localhost:8000/streaming/mystream-########.ts},mux=ts{use-key-frames},dst=hls/mystream-########.ts}'
mzur commented 2 years ago

Something to read on video live streaming: https://www.daily.co/blog/video-live-streaming/

mzur commented 2 years ago

Evaluate video.js to serve both regular video playback and live video playback. Maybe it even fixes the frame-accurate annotation issues (ref).

Edit: Maybe not... they seem to calculate the frame based on currentTime.

mzur commented 1 year ago

Here is a summary of an informal meeting with representatives of DFO Canada, Marine Scotland, GEOMAR and Bielefeld University discussing live video annotation.

Existing solutions

Essential features of a live video annotation system

Next steps

Technical thoughts

mzur commented 2 months ago

Right now I tend to prefer the OFOP/IRLS solution of not showing the video stream in the annotation application. The application should run on desktop machines but also on a tablet or phone. It should be able to read metadata (including the current time) from the ship systems (GPS?). Users should be able to press different predefined buttons to mark the current timestamp with a (whole frame annotation) label. If they keep the button pressed, a multi-frame whole frame annotation is recorded. In addition to the timestamp, the app can also record additional predefined metadata coming from the ship (e.g. geolocation, ROV sensor data). Later, the app produces a file that can be imported in BIIGLE to create annotations of a video. To make this easier, it should also offer a label (tree) import from BIIGLE so the labels can be matched with their UUIDs during the import.

Additional idea: Users can record a "voice label". They just speak what they see which may be quicker than entering a new label on the fly that does not yet exist as a button in the app. The concept of a voice label could be added to BIIGLE too.