Can't get new segments in some mpd live streamming servers - javascript

I'm trying to parse mpd of several DASH live streamming servers to get newly published segments.
You know, there is a tag named "MinimumUpdatePeriod" in the mpd, so it must be upgraded within this time, and usually 1 or 2 segments are newly published during the period. This way, I can get list of segments regularly, they are accumulated one by one.
But in some servers, they go wrong. Even though minimum update period time is expired, no new segments are published. Instead, random number of segments are published per random interval. I can't understand why this happens.
Currently, I'm using the Google shaka player's submodule to parse mpd and catch segment lists, I don't think there is any problem in it. So That's what I'm so confused. I just made simple Javascript module to use shaka, it works really well in case of normal servers as I said, but not for other ones.
The platform is Ubuntu 20.04, I'm using latest version of shaka player.
Thanks for your reading, I hope your opinions.

Related

GetStream.io returning activities in wrong order

I'm running across an extremely strange bug while using GetStream: i'm running a script to migrate over 200k activities (previously used an internal stream-framework fork) and I'm running across a really bizarre issue.
The problem is this: I'm setting the 'time' field to a custom value (usually in the past). Now: these activities are being ordered wrong by the API.
Although the activities being added have correct, ISO8601 UTC times in the past, the oldest ones are coming back on top of the feed (mixed with only a couple of new activities).
This is really odd and I'm at the end of my wits -- this seems like an issue on Stream's end.
Thoughts? Below is a screenshot of the issue.
Surprisingly, it works as expected because API considers last n operations to build the feed. After retrieving these operations, they are ordered according to time. That's why if you add old activities, they are the only operations to build the feed.
Workaround to this is that adding activities in reverse order such that insert old activities first and new activities last then you will be able to read the new ones.
Moreover, if you are importing a lot of activities, you might consider import feature.

Is there a npm package, or web api, for reading specific parts of an image?

I'm adding a new function to my node express server that will allow me to upload a drivers ELD daily log and get from that image / pdf the time driven, start time, end time, lunch, etc..
I've looking into converting the pdf into a csv / json / html, but the issue there is that it's an unlabeled mess. So I am figuring that trying to somehow read and create a chart similar to the chart already on the eld log.
ie. Reading it would be segmented by say 15 minutes, or however many pixels.
IF line exists in segment call proceed and log data ELSE check segments "SB" "D" "ON" then recursively call
In the example shown above, this driver went on duty at 6:45am.
The files are provided in a pdf format, and I am having issues extracting the data and have it be useful / labeled.
UPDATE: Thinking about it a bit more, this solution might be pretty resource costly, especially if done on the server end, ie. chopping up the image / leaving it in a buffer and reading off it... Maybe it would be better to just try and make sense of the garbage parsing from pdf to something else...
UPDATE 2: I may try and use Tesseractocr depending on how it outputs data.
Using on a page like this:
I think the term you're looking for is OCR (optical character recognition). That's the name of the technology for converting text on images into actual text to work with. Once you have that, decoding the text should be easy if it's in a standard format. There are plenty of OCR libraries for Node: https://www.npmjs.com/search?q=OCR No need to reinvent the wheel and try to build your own OCR system :)

Compare sound between source and microphone in JavaScript

I'm working about audio but I'm a newbie in this area. I would like to matching sound from microphone to my source audio(just only 1 sound) like Coke Ads from Shazam. Example Video (0.45 minute) However, I want to make it on website by JavaScript. Thank you.
Building something similar to the backend of Shazam is not an easy task. We need to:
Acquire audio from the user's microphone (easy)
Compare it to the source and identify a match (hmm... how do... )
How can we perform each step?
Aquire Audio
This one is a definite no biggy. We can use the Web Audio API for this. You can google around for good tutorials on how to use it. This link provides some good fundametal knowledge that you may want to understand when using it.
Compare Samples to Audio Source File
Clearly this piece is going to be an algorithmic challenge in a project like this. There are probably various ways to approach this part, and not enough time to describe them all here, but one feasible technique (which happens to be what Shazam actually uses), and which is also described in greater detail here, is to create and compare against a sort of fingerprint for smaller pieces of your source material, which you can generate using FFT analysis.
This works as follows:
Look at small sections of a sample no more than a few seconds long (note that this is done using a sliding window, not discrete partitioning) at a time
Calculate the Fourier Transform of the audio selection. This decomposes our selection into many signals of different frequencies. We can analyze the frequency domain of our sample to draw useful conclusions about what we are hearing.
Create a fingerprint for the selection by identifying critical values in the FFT, such as peak frequencies or magnitudes
If you want to be able to match multiple samples like Shazam does, you should maintain a dictionary of fingerprints, but since you only need to match one source material, you can just maintain them in a list. Since your keys are going to be an array of numerical values, I propose that another possible data structure to quickly query your dataset would be a k-d tree. I don't think Shazam uses one, but the more I think about it, the closer their system seems to an n-dimensional nearest neighbor search, if you can keep the amount of critical points consistent. For now though, just keep it simple, use a list.
Now we have a database of fingerprints primed and ready for use. We need to compare them against our microphone input now.
Sample our microphone input in small segments with a sliding window, the same way we did our sources.
For each segment, calculate the fingerprint, and see if it matches close to any from storage. You can look for a partial match here and there are lots of tweaks and optimizations you could try.
This is going to be a noisy and inaccurate signal so don't expect every segment to get a match. If lots of them are getting a match (you will have to figure out what lots means experimentally), then assume you have one. If there are relatively few matches, then figure you don't.
Conclusions
This is not going to be an super easy project to do well. The amount of tuning and optimization required will prove to be a challenge. Some microphones are inaccurate, and most environments have other sounds, and all of that will mess with your results, but it's also probably not as bad as it sounds. I mean, this is a system that from the outside seems unapproachably complex, and we just broke it down into some relatively simple steps.
Also as a final note, you mention Javascript several times in your post, and you may notice that I mentioned it zero times up until now in my answer, and that's because language of implementation is not an important factor. This system is complex enough that the hardest pieces to the puzzle are going to be the ones you solve on paper, so you don't need to think in terms of "how can I do X in Y", just figure out an algorithm for X, and the Y should come naturally.

Cannot connect createAnalyser() and createGain() to audioContext()

I'm learning the WebAudio API and experimenting by building a simple audio player with a visualiser and an equaliser.
Both the visualiser and equaliser work on their own, but when I have them both connected to the AudioContext, the equaliser stops working.
Here's some of the code...
The equaliser
var sum = APP.audioContext.createGain();
APP.lGain.connect(sum);
APP.mGain.connect(sum);
APP.hGain.connect(sum);
sum.connect(APP.audioContext.destination);
And the visualiser
APP.analyser = APP.audioContext.createAnalyser();
APP.source.connect(APP.analyser);
APP.analyser.connect(APP.audioContext.destination);
If I remove the final line APP.analyser.connect(APP.audioContext.destination); then the equaliser works, but then my visualiser obviously breaks.
This works fine in Firefox, but not in Chrome (osx).
Thanks in advance for any help!
1) My guess is that it's not that the equalizer "stops working" - it's that you're connecting both the output of the equalizer and the output of the analyzer (which is a pass-through of the source!) to the destination, and it's summing them - so you have an equalized copy summing with a non-equalized copy, and it's dramatically lessening the equalizer's effect. The fix is simple - don't connect the analyzer to the destination. (It doesn't need to be connected to anything to work.)
2) I suspect you're using a less-than optimal way of doing equalization. You should use shelving filters and a peak filter in SERIES (one connected to another to another), not three filters in parallel (summing to one node). If you connect them in parallel, you're going to get odd phase-offset effects. Take a look here: Web audio API equalizer.

Parse and predict tsv values for Highcharts gantt

I have to build a small management dashboard that consists of several parts. Most of them were no problem, but on the current page I got completely stuck.
Explanation:
I have used an example that I have found and some examples in the Highcharts forum to build my own chart.
The basic function is working, I am getting my data from a tsv file, building the arrays and displaying them.
Now comes the tricky part and I am not able to get my head around it…
The data I'm getting is live data from SAP and is the record of current production processes. (The provided dataset is a finished one, but later I want to display the actual live data.)
Since it is a pilot there is no chance to access the SAP database at the moment and I have to handle the data in tsv format.
There are 3 different states for each package.
B10: start
B30: pause
B40: stop
At the moment I am just separating all working packages and printing them, but according to the management here there are many functionalities missing.
Prerequisite: Refresh every x seconds
What they want (the easy version):
If one of the processes gets a B10, its starts “running” and its bar should get green. If there is no B30 in the next rows, the last point get’s the current time as “now” and is extending (the bar is growing).
If there is a B30, the process should “pause”, the color of the bar should change to red (including data points of that process) and only continue if there comes another B10. Between B30 and the new B10 there are no datapoints.
On B40 the process simply stops and turns grey again.
My problem: I have no single idea how I should analyze the “future” data (next steps). Should I separately run through the tsv again and check it for occurrences of B30 or B40 in advance? What’s making my life even more complicated is that two independent processes could run at the same time (for ex. Process 1 and Process 40). Also an indicator line should “run” to indicate the current time.
What they want in the future (or how I call it: nightmare):
2 or even more persons could work at the same process, but they always want to see just one bar per process… In the case of multiple operators it also has to be true that all operators have to set their status to B30, otherwise the process will not interrupted.
They further want to zoom into the current day with only the processes of the day, and if a process (for example 40) is started in “advance”, it should appear in the same zoom level. The processes for the day and a schedule will be provided in a separated file and I have to compare my data points to the schedule.
I know, it’s a weird explanation for a weird request. I also don't want anyone to give me a finished product, but I have to develop this here by myself and I just got a real problem with the logic. If I didn't explain well enough or there are further questions, please ask me and I will answer immediately.

Categories

Resources