How can I store a video with proper indexing - database

How can I store a video (either in database or file system) so that instead of starting streaming from starting I can start this streaming from any fix index.
Main aim is like I have a large video of roads of New York from one end to other and corresponding map of New York save on a central server. Now a user opens up the website and selects the two points on the map of New York and video of road between those two points starts streaming, not from starting but from first point to second point given by user.
So main requirement is to store a video with its indexes such that I can start streaming from any of the index.
Edited Part :
Actually I am planning how to store video of complete city so I can show it to user whenever he selects it on map.
So Now Main question in my mind is can I merge video for all roads in one video like various linked lists (Roads). Like if there are two turns at particular point then instead of storing two videos from that point for different path can I store them in a single video such that which video you have to play will depend upon starting and ending point selected by user and shortest path between those two points, But can I store video of all roads as a single video.
How can I do this, will it depend on stream mechanism or on storage ?
Thanks,
GG

I guess that this all depends on the capability of your playing/streaming mechanism. I would find out about these before determining how to store the file and/or "index" points. Ask some specific questions about your streaming technology, such as:
can you fast forward to a certain point?
can you stop at a certain point?
can you play one stream after one ends?
another play capabilities that may help solve this?
If you can trigger the playing of your video to fast forward to a certain point, you can store the amount of time or frames to fast forward from the beginning and associate these with your map start. You would also need to "abort" the stream at a certain point, that matches your map end point.
However, if you can not fast forward your stream, you many need to break your video file into smaller segments and start at the proper one based on the map point selected. You would then need to play multiple files until you reach the end point.

Related

Efficient retrieval of lat-lon points that are within a square boundary

I have a react-native application that populates pins on a map that have been submitted by users. The front end gets the corners of the window and then the back end goes through each pin to check if it falls within the boundary, and returns the ones that do.
This is taking too long on the backend and I want to ask the community for ideas, because I doubt I have the best one.
My idea is to store tables of pins grouped by quadrants, effectively a cache, and then I can in almost constant time return the pins from the quadrants involved.
Is there a simpler way to do this?
Maybe using NoSQL?
🙏🏻
A month later it seems geohashing is probably the best way, plus AWS has a library for automatically handling this with dynamodb. Apparently it takes the corners of the screen, lat/lon, and automatically returns the items from the DB in the view, in, I assume, constant time, since that's the whole point of geohashing, getting performance that works at scale..
https://www.npmjs.com/package/dynamodb-geo
https://aws.amazon.com/blogs/compute/implementing-geohashing-at-scale-in-serverless-web-applications/
Otherwise, using a geohashing library that is built for serving mobile apps likely exists.

Non Redundant Image Extraction From Video

I am collecting data for a project. The data collection is done by recording videos of the subjects and the environment. However, while training the network, I would not want to train it with all the images collected in the video sequence.
The main objective is to not train the network with redundant images. The video sequence collected at 30 frames/sec can have redundant images (images that are very similar) within the short intervals. T(th) frame and (T+1)th frame can be similar.
Can someone suggest ways to extract only the images that can be useful for training ?
Update #2: Further resources,
https://github.com/JohannesBuchner/imagehash
https://www.pyimagesearch.com/2017/11/27/image-hashing-opencv-python/
https://www.pyimagesearch.com/2020/04/20/detect-and-remove-duplicate-images-from-a-dataset-for-deep-learning/
Update #1: You can use this repo to calculate similarity between given images. https://github.com/quickgrid/image-similarity**
If frames with certain objects(e.g., vehicle, device) are important, then use pretrained object detectors if available, to extract important frames.
Next, use a similarity method to remove similar images in nearby frames. Until a chosen threshold is exceeded keep removing nearby N frames.
This link should be helpful in finding right method for your case,
https://datascience.stackexchange.com/questions/48642/how-to-measure-the-similarity-between-two-images
This repository below should help implement the idea with few lines of code. It uses CNN to extract features then calculates there cosine distance as mentioned there.
https://github.com/ryanfwy/image-similarity

TTS concatenation based on user input

Greeting StackOverflow community,
Is it possible to take what a user says or enters (like the letters 1 - 9) and instead of the text to speech engine reading the numbers back to the user it plays a prerecorded audio clip so it sounds like our voiceover person instead of the robot?
Can you do this dynamically based on what the user inputs?
All i'm really asking for is a prod in the correct direction of how to start figuring this out.
You can. I've written logic, a long time ago, that takes the desired phrase and a list of available clips to find the largest segments (clips often had multiple phrases) that could be used to assemble the audio. It tends to sound very choppy, but it is possible if you have enough prerecorded audio. In my case the content was in a niche and could be accomplished with 95% coverage with only a couple thousand recordings.
At the end, it was just basic search logic to find clips. If you do this at the word level, you could just name each clip with the word and split the input and generate the audio tags. <audio src='the.wav'/><audio src='quick.wav'/><audio src='brown.wav'/><audio src='fox.wav'/>...

AS3/Flash Need help organizing and building with performance in mind

I am working on a project (Collectable Card Game) that has me accessing several cards at once. Essentially,think solitaire. Where a lot of cards are on the stage at once, and you flip them over to reveal them. --- The catch is each card can be re-flipped and display a different card from the availableCards array.
Initially I would create a single object that held a different card in each frame. This works fine, but seems highly impractical due to so many objects on the stage, all of them holding every single frame... in other words, each card would be a full deck.
I restarted and decided to go with each card is it's own object. So I stopped because before I get going again, I wonder if there is an even better way?
Do I create one hundred cards in Flash and store their names in an array?
Can I create a single card, and somehow get a card image from a clip with one hundred frames?
If there is a way to have all the card images in a single object it would be easier to work with in Flash, but would that mean the whole object would have to be used just to show a single frame?
Thanks in advance everyone!

Data source for all the roads in the world?

For no reason in particular, I'm curious what the expected number of feet you would have to walk to find the nearest road is, starting from a random point on the world, facing a random direction. I can write a program to compute this value, given the right data source.
Is there any data source containing all the roads in the world? For example, Google Maps has roads for many cities around the world. Is there any way to get access to that data? Is there an API for this kind of query?
OpenStreetMaps has the data you are looking for. You might want to look at the FAQ. Here is a link to the data page
No.
You may get about all roads for 1st world countries, which will be a lot. But countries Somalia, Congo, Bhutan? Half of their roads don't exist on any map, including official maps of their own governments. Half of these that do aren't digitized, only on paper. Many of those are restricted by military.
You may find services that would provide all the easily purchasable civilian-available road maps of the world. But not all roads have been mapped, not all maps digitized and not all digital maps published or made available. And many are hopelessly outdated too.

Resources