How to use apache spark to face detection in video stream - apache-spark

Here is the background of the problem I'm trying to solve:
I have a video file (MPEG-2 encoded) sitting on some remote server.
My job is to write a program to conduct the face detection on this video file. The output is the collection of frames on which the face(s) detected. The frames are saved as JPEG files.
My current thinking is like this:
Using a HTTP client to download the remote video file;
For each chunk of video data being downloaded, I split it on the GOP boundary; so the output of this step is gonna be a video segment that contains one or more GOPs;
Create a RDD for each video segment aligned on the GOP boundary;
Transform each RDD into a collection of frames;
For each frame, run face detection;
if the face is detected, mark it and save the frame to JPEG file
My question is: Is Apache-Spark the right tool for this kind of work? If so, could someone point me to some example does the similar thing?

Related

Is there an audio file format that doesn't contain metadata, so individual chunks can be split up at any position and just be saved to a file?

Is there an audio file format, where I can save all the individual chunks (recorded in javascript) while splitting them up at any point to save them to different files and have them still all playable?
Yes this is what WAV file does ... if you save the file to conform to WAV payload format you can play back the file you create as a WAV file even without file having its normal 44 byte header
I store raw audio data in arrays that can be sent to Web Audio API's AudioBuffer. The raw audio data arrays can be manipulated as you wish.
Specifics for obtaining the raw data are going to vary from language to language. I've not obtained raw data from within JavaScript. My experience comes from generating the data algorithmically or from reading .wav files with Java's AudioInputLine, and shipping the data to JavaScript via Thymefeaf.

Seaweedfs merge/write received buffer data to file

I would like to ask question about Seaweedfs functionality.
In my case, I have a browser where is audio recorder.
Audio chunk files are transferred to NodeJS backend using socket.
When chunk is at backend I have to save it in storage and merge together.
Does Seaweedfs supports functionality where buffer data is received and merged in storage?
Or maybe there is a better solution how I can store audio chunks in live recording and merge them together getting full audio file at the end.
I added a filer REST API to append to a file. You can wait for the weekly release next Sunday.
Does that work for you?
//create or append the file
POST /path/to/file?op=append
PUT /path/to/file?op=append

Out of memory error because of giant input data

I am using RandomForestClassifier in python to predict whether the pixel in the input image is inside the cell or outside it as a pre-processing stage to improve the image , the problem is that the data size of the training set is 8.36GB and also the size of the test data is 8.29GB so whenever I run my program I get (out of memory) error. Will extending the memory not work?. Is there any way to read csv files which contain the data in more than one step and then free the memory after each step?
Hopefully you are using pandas to process this csv file as it would be nearly impossible in native python. As for your memory problem here is a great article explaining how to process large csv files by chunking the data in pandas.
http://pythondata.com/working-large-csv-files-python/

Compare audio volume from two videos

How Can I compare audio volume level from two videos?
One of our clients complains about our output video (from DirectShow based application) increase the audio volume between 0.5db to 1db.
How Can I check this? Is there any external tool that can help me to check audio volume signal?
Thanks!
You need to inspect your filter graph and identify if there are any filters in the audio path, which could modify the data. You can insert a filter that gets you audio stream between the audio renderer, or earler in the pipeline; then when you grab the data, you can calculate volume levels and compare to reference values.
Small discrepancies (up to 1 dB, or slightly higher) can be a result of different level calculations or downmixing, yours or taking place somewhere on the way.

How to extract video's file volume information using FFMPEG?

We need to extract the volume information for every second from a video file in order to produce a graphical representation of volume changes during the video progress.
I'm trying to use FFMPEG with audio filter but I get stucked in how to extract the volume information for every second (or frame) and then export this information to some report file.
Thanks in advance.

Resources