microsoftgraph / microsoft-graph-comms-samples

Microsoft Graph Communications Samples
MIT License
204 stars 220 forks source link

Issue with the compliance recording bot implementation over Azure Classic Cloud #728

Open deshneni-akhil opened 4 weeks ago

deshneni-akhil commented 4 weeks ago

Describe the issue

https://github.com/microsoftgraph/microsoft-graph-comms-samples/blob/master/Samples/V1.0Samples/LocalMediaSamples/PolicyRecordingBot/README.md

Code Snippet

private void OnVideoMediaReceived(object sender, AudioMediaReceivedEventArgs 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: Policy Recording bots can record the Video here
    e.Buffer.Dispose();
}
private void OnAudioMediaReceived(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: Policy Recording bots can record the Video here
    e.Buffer.Dispose();
}

Expected behavior

The documentation uses Azure Classic Service which is depreciated unable to proceed with the deployment instructions and further can you please provide the details on how the application can store the video and audio data into wav and mp4 file format upon call being ended I am looking to upload this data to azure blob storage with some metadata any insights around this is appreciated.

InDieTasten commented 4 weeks ago

So your question comes out to being 2 separate things:

Files and formats

The sample code you linked is almost where you want to be. You can containerize the video frame buffers (which are h264 NAL units) into MP4, though you will likely run into synchronisation issues at playback, because these NAL units come at different frequencies over time (variable framerate / VAR).

The audio frames contain raw PCM buffers, which you can directly write into a Wave file. You just have to specify the correct wave header for the PCM signal you are receiving.

Infrastructure / Deployment

Regarding the infrastructure, I am also an advocate for there to be a sample that doesn't rely on Classic Cloud Service. It's not "deprecated" as you say, but it is in "extended support" and frankly, I don't enjoy working with these old cloud services. I want to use modern tooling and deployment strategies. Therefore, I am the maintainer of a sample that runs on Azure Kubernetes Service. It's built on the deprecated sample provided by Microsoft, but has been updated to run on Win22. It is currently the most up to date sample out there and it's sample implementation and docs revolve around compliance recording scenarios, though the use case can be swapped easily. The sample is in the process of being merged into this official sample collection. The issue is located at #673 and the PR is located here #722


For any further implementation details about your issue, I don't think this issue is a fitting space. Feel free to contact me personally for anything related to your exact needs (like more details around MP4, Wave Files and so on)

deshneni-akhil commented 4 weeks ago

@InDieTasten Thanks for quick response I appreciate that, I will use the AKS example and will get back to you on this