How to Track and Report Video Uploads to Stream (Classic)

Many Ways to Get a Video Into Stream

Equipped with a suitable license, Office 365 users can upload content (in supported formats) to Stream in various ways:

Apart from people with frontline licenses, licensed users can upload a video to Stream. To accommodate uploads, Office 365 enterprise tenants are assigned 500 GB of video storage plus 0.5 GB of extra storage for every licensed user (except frontline users). You can discover how much Stream storage your tenant has consumed through the Stream admin settings (Figure 1).

Viewing Stream storage consumption
Figure 1: Viewing Stream storage consumption

All uploaded videos count against the overall quota for the tenant. The exact size of a video depends on its format, quality, and length. As a guide, expect to use approximately 7.5 MB per minute of 1080p MP4 video with smaller amounts consumed for lower-quality video. Stream counts the original file size of the uploaded video against the quota and doesn’t take other factors such as the size of transcoded videos and caption files into account.

Demand for Teams Recordings

When Microsoft originally created Stream, they probably anticipated that most videos uploaded would be high-quality corporate videos produced using professional equipment. Today, the reality is different and many organizations find that the demand for Stream recordings comes from Teams meetings.

Although it’s easy to discover how much of the assigned storage has been consumed, it’s harder to get other information out of Stream, like the size of an individual video. Without that information, you can’t discover who is uploading the big videos which consume all the storage without downloading the videos to note their size on disk.

Use the Audit Log

What you can do is use the Office 365 audit log to track who’s uploading videos to Stream. This example shows how to run the Search-UnifiedAuditLog cmdlet to find video upload events. The returned set are then analyzed to extract information about the video.

$StartDate = (Get-Date).AddDays(-90); $EndDate = (Get-Date) #Maximum search range for audit log for E3 users
$Records = (Search-UnifiedAuditLog -Operations StreamInvokeVideoUpload -StartDate $StartDate -EndDate $EndDate -ResultSize 2000)
If ($Records.Count -eq 0) {
    Write-Host "No audit records for Stream video uploads found." }
Else {
    Write-Host "Processing" $Records.Count "audit records..."
    $Report = [System.Collections.Generic.List[Object]]::new() # Create output file for report
    # Scan each audit record to extract information
    ForEach ($Rec in $Records) {
      $AuditData = ConvertFrom-Json $Rec.Auditdata
        $ReportLine = [PSCustomObject] @{
           TimeStamp = Get-Date($AuditData.CreationTime) -format g
           User      = $AuditData.UserId
           Action    = $AuditData.Operation
           VideoURL  = $AuditData.ResourceURL
           VideoName = $AuditData.ResourceTitle }
      $Report.Add($ReportLine) } }

Remember that Office 365 only stores 90 days of audit data for E3 accounts, so if you want to go back further, you’ll need to either extract and store information on an ongoing basis or use a third-party reporting app. For output, you could pipe the data to the Out-GridView cmdlet or create a CSV file:

$Report | Sort {$_.TimeStamp -as [DateTime]} -Unique -Descending | Out-GridView

Report | Sort {$_.TimeStamp -as [DateTime]} -Unique -Descending | Export-CSV -NoTypeInformation c:\temp\ExportStreamVideos.csv

Using a figure for video storage of 400 MB/hour, you could even calculate how much of the tenant’s Stream quota is being consumed by each user.

The report data also allows us to do some basic analysis, such as finding out who uploads most videos:

$Report | Group User | Sort Count -Descending | Format-Table Name, Count

Name                               Count
----                               -----
Jane.Nix@office365itpros.com          74
James.Ryan@office365itpros.com        22
John.Hubbard@office365itpros.com      17
James.Joyce@office365itpros.com       15
Ben.Owens@office365itpros.com          9

Reporting Video Views

If you replace StreamInvokeVideoUpload (upload a video event) with StreamInvokeVideoUpView (view a video event) in the Search-UnifiedAuditLog command, you’ll create a report of Stream view events to know who’s looking at videos and what the most popular videos are. To see a summary, you change the Group command slightly to:

$Report | Group-Object Property VideoName | Sort Count -Descending |Format-Table Name, Count
Name                                     Count
----                                     -----
Microsoft 365 Groups and Teams Activity     19
Call with Kim Akers                          7
Successfully Manage Microsoft Teams          7
Troubleshooting PowerShell                   4
Have you seen my Exchange server             3

The Office 365 for IT Pros eBook is full of bright ideas like this. Subscribe now and make sure you’re not left behind by the rapid pace of change in Office 365.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.