How to get video files from team-recording-bot - microsoft-graph-api

Intro: We are creating a bot to record the team meeting. After the meeting gets over
we should get the recordings files in video format.
Issue: We have implemented this code(https://github.com/microsoftgraph/microsoft-graph-comms-samples/tree/master/Samples/V1.0Samples/AksSamples/teams-recording-bot)
using azure kubernetes. We are able to join the team meeting and recording start automatically and we get audio wav file format in zip file to our local but we need video files.
So how can we get the video files in .zip file to our local.
Implementation of code: We have used ivideosocket. But we dont no how we can implement code to get video
so that we can save that video to our local in .zip file.
`
private void OnVideoMediaReceived(object sender, VideoMediaReceivedEventArgs e)
{
this.GraphLogger.Info($"[{e.SocketId}]: Received Video: [VideoMediaReceivedEventArgs(Data=<{e.Buffer.Data.ToString()}>, Length={e.Buffer.Length}, Timestamp={e.Buffer.Timestamp}, Width={e.Buffer.VideoFormat.Width}, Height={e.Buffer.VideoFormat.Height}, ColorFormat={e.Buffer.VideoFormat.VideoColorFormat}, FrameRate={e.Buffer.VideoFormat.FrameRate})]");
// TBD: Compliance Recording bots can record the Video here
e.Buffer.Dispose();
}
`

Related

Wrong duration in MediaRecorder stream on iOS

I am trying to use multiple files with ffmpeg and I am having a problem with the duration of the files created through iOS devices.
I am recording the videos through the webcam of the device with:
mediaRecorder.current = new MediaRecorder(videoPlayer.current.srcObject);
mediaRecorder.current.start();
mediaRecorder.current.ondataavailable = (e) => {
setVideoCreatedData(e.data);
};
Then I am downloading the file to my computer and testing the metadata through https://www.metadata2go.com/ and this is the output:
As you can see, the duration is 0s.
I want to then use this file with ffmpeg, however, it does not detect the duration and therefore I am experiencing problems.
How should I record the video in order to get a proper duration on the file's metadata?

Record audio (FLAC or WAV) in ReactJs and use Speech2Text from google using ruby backend

I need to record an audio through front-end. I'm using React Mic and mic-recorder-to-mp3 ReactJS libraries. Everything is fine, I'm managing to download the blob of the audio and hear it. Although, I need to upload it to my back-end so I can use Google SpeechToText API to extract text from audio.
That is the script that im using but its not returning any result, i think that is cos' the audio recorded dont have the right encodings.
require "google/cloud/speech"
require 'json'
# Instantiates a client
speech = Google::Cloud::Speech.new
# The name of the audio file to transcribe
file_name = "./newmp3.mp3"
# The raw audio
audio_file = File.binread file_name
encoding = :LINEAR16
# The audio file's encoding and sample rate
config = {
encoding: "LINEAR16",
language_code: "pt-BR",
model: "default",
sample_rate_hertz: 16000
}
audio = { content: audio_file }
# Detects speech in the audio file
response = speech.recognize(config, audio)
results = response.results
puts response
You are sending an mp3 file to the API, but you are telling it that the file is encoded as LINEAR16 (PCM data). This will not work.
According to the speech API docs, MP3 is only supported through the beta API.
One easy way to resolve this is to use a simple external audio encoder like ffmpeg, and convert it to something like FLAC before sending it over:
ffmpeg -i input.mp3 output.flac
Then set FLAC as the audio type for your encoding setting. But remember you cannot upload more then 1 minute of audio using this method. Uploading longer files has to be done asynchronously by using Google Cloud servers for storage.

Can Google's Speech API accept an external Video URL?

I recently figured out that Google's Vision API can accept an external image URL and I was curious if anyone knew if Google's Speech could accept an external video URL such as a YouTube video?
The code I have in my mind would look something like this:
def transcribe_gcs(yotube_url):
"""Asynchronously transcribes the audio file specified by the gcs_uri."""
from google.cloud import speech
from google.cloud.speech import enums
from google.cloud.speech import types
client = speech.SpeechClient()
audio = types.RecognitionAudio(uri=youtube_url) # swapped out gcs_uri with youtube_url
config = types.RecognitionConfig(
encoding=enums.RecognitionConfig.AudioEncoding.FLAC,
# sample_rate_hertz=16000,
language_code='en-US')
operation = client.long_running_recognize(config, audio)
print('Waiting for operation to complete...')
response = operation.result(timeout=90)
# Each result is for a consecutive portion of the audio. Iterate through
# them to get the transcripts for the entire audio file.
for result in response.results:
# The first alternative is the most likely one for this portion.
print(u'Transcript: {}'.format(result.alternatives[0].transcript))
print('Confidence: {}'.format(result.alternatives[0].confidence))
I was curious if anyone knew if Google's Speech could accept an
external video URL such as a YouTube video?
It needs to be a local path to your audio file (less than 1 min audio file) or GCS URI for audio file longer than 1 minute. What you're thinking is not possible, the audio/video file needs to be in GCS.
I think you can achieve this by streaming same video (for example on wowza or on any server of your choice.) and then simply extract audio using lets say ffmpeg and pass this to google. It should work. use StreamingRecognizeRequest instead of RecognitionAudio.

How to change url from m3u8 to .ts

I'm trying to make an iptv link work on my receiver
this is the original link that i want to convert
http://s7.iapi.com:8000/re-NBA/index.m3u8?token=BzyIVQOtO77MTw
and this is the format that i want to reach in the end.
http://pro-vision.dyndns.pro:12580/live/laurent/laurent/2791.ts
An m3u8 file is just a text file that acts as an index for media streams - it will contain 'pointers' to the location of video and audio streams themselves.
A TS file is a 'container' that contains the video and audio streams themselves - i.e. the actual video and audio data.
You can't simply convert any m3u8 to a ts file or stream, but you can extract from the m3u8 file a ts file URL, which maybe is what you want.
If you look at the overview section of the m3u8 definition there is a very simple example which is maybe the best way of understanding this:
https://datatracker.ietf.org/doc/html/draft-pantos-http-live-streaming-19
The m3u8 file includes the ts references and can be seen in this extract from the above document:
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXTINF:9.009,
http://media.example.com/first.ts
#EXTINF:9.009,
http://media.example.com/second.ts
#EXTINF:3.003,
http://media.example.com/third.ts
The numbers here refer to the length of the stream. More complex examples allow you have multiple variants of a particular stream, to allow different bit rate versions of a video for Adaptive Bit Rate (ABR) streaming for example.

Not able to play the .wav sound which i recorded through coding in blackberry

i have tried to record the audio in wav format and i succeeded but when i try to play that file, it gives an error that 'media file is of unsupported format'.
the main portion of code is as follows:
player = Manager.createPlayer("capture://audio?encoding=pcm&rate=44100&bits=16&channels=1");
player.realize();
controller = (RecordControl) player.getControl("RecordControl");
controller.setRecordLocation("file:///SDCard/BlackBerry/voicenotes/voice.wav");
//controller.setRecordSizeLimit(396900);
controller.startRecord();
player.start();
Thread.sleep(7000);
controller.commit();
player.close();
This code works well and it gave me a voice.wav file but i am not able to play this file.Is there is something which i forget?
Thanks in advance.
Sounds like the same problem as here:
http://supportforums.blackberry.com/t5/Java-Development/Bug-in-media-Manager-Player/td-p/1009027/page/2
Essentially, you need to add the RIFF/WAVE-header for the recorded data yourself, see the last post on the thread for example.

Resources