Skip to content

Instantly share code, notes, and snippets.

@mfd
Last active June 5, 2025 05:04
Show Gist options
  • Save mfd/c990a01d626847a6d7e823dceca598e1 to your computer and use it in GitHub Desktop.
Save mfd/c990a01d626847a6d7e823dceca598e1 to your computer and use it in GitHub Desktop.
Download any video from Microsoft Teams, SharePoint and OneDrive
2teams() {
NOW=$(date +"%Y-%m-%d_%H%M")
if [ ! -z $2 ] ; then
echo $NOW"_"$2.mp4
ffmpeg -i $1 -codec copy $NOW"_"$2.mp4
else
echo $NOW"_teamsvid".mp4
ffmpeg -i $1 -codec copy $NOW"_teamsvideo".mp4
fi
}

Download any video from Microsoft Teams, SharePoint and OneDrive

Videos like

- https://{ORGID}.sharepoint.com/personal/{USERID}/_layouts/15/stream.aspx?id={VIDEOID}%2Emp4&ga=1
- https://{ORGID}.sharepoint.com/:v:/p/{USERID}/{VIDEOID}
  1. Run video from SharePoint corporate account or OneDrive,
  2. In Chrome open Web inspector and in Network filter by videomanifest
  3. Copy this url
  4. Run ffmpeg -i "%URL%" -codec copy outputvideo.mp4

chrome

@grpatter
Copy link

grpatter commented Nov 1, 2024

If you search for streamContent?format=json in network assets, you can find the URL for the transcript. It's in a fully formatted json notation though, so you'd have to convert it if you intend to do any analysis or manipulation.

Ex:
image

@shebenu
Copy link

shebenu commented Nov 23, 2024

@ShaunMaher @rbp9802 Can it work for Microsoft stream / teams view-only recordings? how to rephrase link?

@Nehal16237
Copy link

@shebenu Yes, It can work for ms stream , just do those steps

  1. Run video from SharePoint corporate account or OneDrive,
  2. In Chrome open Web inspector and in Network filter by videomanifest
  3. Copy this url
  4. Go to notepad and paste this url
  5. Delete the section starts with "&alt...." till the end of the url
  6. Copy the new url
  7. Go to windows powershell and run it as admin..
  8. Write this command
    ffmpef -i "new url" - videoname.mp4
    AND JUST WAIT!

@coffee0818
Copy link

@shebenu Yes, It can work for ms stream , just do those steps

  1. Run video from SharePoint corporate account or OneDrive,
  2. In Chrome open Web inspector and in Network filter by videomanifest
  3. Copy this url
  4. Go to notepad and paste this url
  5. Delete the section starts with "&alt...." till the end of the url
  6. Copy the new url
  7. Go to windows powershell and run it as admin..
  8. Write this command
    ffmpef -i "new url" - videoname.mp4
    AND JUST WAIT!

Thank you for your summary. That works for me.

@thyarles
Copy link

thyarles commented Jan 7, 2025

I just tried with ffmpeg and it worked like a charm. You must keep the URL until de dash part.

Example of URL (this will not work as I changed the IDs and the host, get yours like explained before):

ffmpeg -i "https://host-mediap.svc.ms/transform/videomanifest?provider=spo&inputFormat=mp4&cs=fFNQTw&correlationId=024475a1-903a-5000-3ead-&docid=https%3A%2F%my.sharepoint.com%2F%2F01ULWEOFMXKBGYPXHCANH3U2Q4R4ZQOBD7%3Ftempauth%3Dv1.eyJzaXRlaWQiOiJkMTk3N2Y4Zi01ZjZhLTRkMTMtYTFjYS0zYmI0N2U2YWFiNjkiLCJhdWQiOiIwMDAwMDAwMy0wMDAwLTCmZjEtY2UwMC0wMDAwMDAwMDAwMDAvdW5iYnItbXkuc2hhcmVwb2ludC5jb21AZWMzNTliYTEtNjMwYi00ZDJiLWI4MzMtYzhlNmQ0OGY5MDU5IiwiZXhwIjoiMTczNjI5Njk0OCJ9.CgoKBHNuaWQSAjI5EgsIpNq4n6LV1z0QBRoNMTc3LjIwMS7yOC41OCIUbWljcm9zb2Z0LnNoYXJlcG9pbnQqLFB2QjBLRG9BRGZ4VS9JQzQ5czFvSGIwSjcwaXJUL2ZoejhpMEJjNGlPMTg9MLYBOAFCEKF1RAI6kABQPq1t6hwHA0lKEGhhc2hlZHByb29mdG9rZW5iBHRydWVqJGFjNmNlNWJhLWYwZTMtNGFkYi1hYmE0LTFiNGQ3MzI3NGI3OXIpMGguZnxtZW1iZXJzaGlwfDEwBBByMDAzZGE4ZDZjMjFAbGl2ZS5jd216ATDCASYwIy5mfG1lbWJlcnNoaXB8MjQyMTAxMjYzQGFsdW5vLnVuYi5icsgBAQ.PlMSwnjqzU42dB9MUrbJPTnnv9y2X3OLwlFiRJBgxF0%26version%3DPublished&psi=06b8256c-5d88-123b-99ac-e0098993ff6e&enhanceAudio=true&cTag=%22c%3A%7B874D5097-123-4F03-123-1C8F3307047F%7D%2C2%22&action=Access&part=index&format=dash" -codec copy output.mp4

Thanks for the tips.

@tigaszzz
Copy link

@shebenu Yes, It can work for ms stream , just do those steps

  1. Run video from SharePoint corporate account or OneDrive,
  2. In Chrome open Web inspector and in Network filter by videomanifest
  3. Copy this url
  4. Go to notepad and paste this url
  5. Delete the section starts with "&alt...." till the end of the url
  6. Copy the new url
  7. Go to windows powershell and run it as admin..
  8. Write this command
    ffmpef -i "new url" - videoname.mp4
    AND JUST WAIT!

perfect! tks

@MexxDirkx
Copy link

I created an extension (with ChatGPT) that generates an FFmpeg command for downloading videos from SharePoint. It also allows you to download the transcription file. You can try it out here: https://github.com/MexxDirkx/SharePoint-Video-Downloader-Extension.

@shebenu
Copy link

shebenu commented Mar 13, 2025 via email

@shebenu
Copy link

shebenu commented Mar 14, 2025 via email

@chrishuan9
Copy link

chrishuan9 commented Mar 25, 2025

Works beautifully. Remove everything from the URL after and including the & at ...format=dash&...

Paste the URL into yt-dlp 'URL' -o <your-destination-file-name>.mp4 .. without the -o option yt-dlp will complain about the filename being too long.

@ali-han
Copy link

ali-han commented Apr 2, 2025

I created an extension (with ChatGPT) that generates an FFmpeg command for downloading videos from SharePoint. It also allows you to download the transcription file. You can try it out here: https://github.com/MexxDirkx/SharePoint-Video-Downloader-Extension.

Working perfectly bro, thanks

@Jxck-S
Copy link

Jxck-S commented Apr 16, 2025

For anyone using ffmepg by default ffmpeg automatically picks the first or lowest index, stream. SharePoint has the lowest quality streams being the first index and the highest quality streams are the higher indexes.

If you'd like higher quality streams use ffprobe then ffmpeg.

ffprobe -i "VIDEO_MANIFEST_URL" -show_streams

Identify the best video and audio stream indexes

then
ffmpeg -i "VIDEO_MANIFEST_URL_HERE" -map 0:3 -map 0:7 -c copy output.mp4
(Replace 3 and 7 with your desired video and audio stream indexes)

@PrimusInt3rPar3s
Copy link

I created an extension (with ChatGPT) that generates an FFmpeg command for downloading videos from SharePoint. It also allows you to download the transcription file. You can try it out here: https://github.com/MexxDirkx/SharePoint-Video-Downloader-Extension.

Hello,
Unfortunately , Extension is not working

Perplexity Response after Checking the File :

You have provided the required icon images (icon16.jpg, icon48.jpg, icon128.jpg)[5][6][7], and your folder also includes all the necessary files (manifest.json, content.js, popup.html, popup.js). However, your manifest.json is malformed and will not load as-is.

Problems in Your manifest.json

  • The icons and content_scripts fields are incorrectly nested inside the "action" block.
  • content_scripts is not formatted as an array of objects.
  • The file is missing closing braces and has improper structure.

Corrected manifest.json

Copy and replace your current manifest.json content with the following:

{
  "manifest_version": 3,
  "name": "SharePoint Video Downloader",
  "version": "1.0",
  "description": "Download videos from SharePoint and Microsoft Streams easily",
  "permissions": [
    "activeTab",
    "storage",
    "clipboardWrite"
  ],
  "host_permissions": [
    "*://*.sharepoint.com/*",
    "*://*.microsoftstream.com/*",
    "*://*.office.com/*"
  ],
  "action": {
    "default_popup": "popup.html",
    "default_icon": {
      "16": "images/icon16.png",
      "48": "images/icon48.png",
      "128": "images/icon128.png"
    }
  },
  "icons": {
    "16": "images/icon16.png",
    "48": "images/icon48.png",
    "128": "images/icon128.png"
  },
  "content_scripts": [
    {
      "matches": [
        "*://*.sharepoint.com/*",
        "*://*.microsoftstream.com/*",
        "*://*.office.com/*"
      ],
      "js": ["content.js"]
    }
  ]
}

What To Do Next

  1. Replace your current manifest.json with the corrected version above.
  2. Move your icon files (icon16.jpg, icon48.jpg, icon128.jpg) into an images folder inside your extension directory.
    • Your folder structure should look like this:
      extension-folder/
        manifest.json
        popup.html
        popup.js
        content.js
        images/
          icon16.png (rename .jpg to .png if possible)
          icon48.png
          icon128.png
      
    • If you keep them as .jpg, update the manifest to use .jpg instead of .png in the icon paths.
  3. Reload the extension in Chrome using "Load unpacked" and select your extension folder.

If Your Icons Are .jpg Instead of .png

If you want to keep the icons as .jpg, update the relevant lines in the manifest like this:

"default_icon": {
  "16": "images/icon16.jpg",
  "48": "images/icon48.jpg",
  "128": "images/icon128.jpg"
},
"icons": {
  "16": "images/icon16.jpg",
  "48": "images/icon48.jpg",
  "128": "images/icon128.jpg"
}

Summary:

  • Fix your manifest.json structure as above.
  • Place your icon files in the correct path and update the manifest if needed.
  • Reload the extension; it should now load without errors.

Answer from Perplexity: pplx.ai/share

@PrimusInt3rPar3s
Copy link

PrimusInt3rPar3s commented May 14, 2025

Works beautifully. Remove everything from the URL after and including the & at ...format=dash&...

Paste the URL into yt-dlp 'URL' -o <your-destination-file-name>.mp4 .. without the -o option yt-dlp will complain about the filename being too long.

Thanks Very Much

It's Finally Worked like a Charm

yt-dlp "The Manifest URL to ......&part=index&format=dash" -o DesiredVideoName.mp4

Note : You May Export and Get the Cookies File

And the Downloaded File Will be available at "C:\Users\Your_User_Folder"

@agaramja
Copy link

agaramja commented May 30, 2025

I created an extension (with ChatGPT) that generates an FFmpeg command for downloading videos from SharePoint. It also allows you to download the transcription file. You can try it out here: https://github.com/MexxDirkx/SharePoint-Video-Downloader-Extension.

How to use can you please guide in detail.

@vitkolar
Copy link

vitkolar commented Jun 4, 2025

@shebenu Yes, It can work for ms stream , just do those steps

  1. Run video from SharePoint corporate account or OneDrive,
  2. In Chrome open Web inspector and in Network filter by videomanifest
  3. Copy this url
  4. Go to notepad and paste this url
  5. Delete the section starts with "&alt...." till the end of the url
  6. Copy the new url
  7. Go to windows powershell and run it as admin..
  8. Write this command
    ffmpef -i "new url" - videoname.mp4
    AND JUST WAIT!

it still works ;-)

@agaramja
Copy link

agaramja commented Jun 5, 2025

2. videomanifest

But didn't find any URL to copy. The "videomanifest" is just an empty search.

Uhere is the URL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment