Skip to content

Instantly share code, notes, and snippets.

@mfd
Last active May 21, 2026 18:38
Show Gist options
  • Select an option

  • Save mfd/c990a01d626847a6d7e823dceca598e1 to your computer and use it in GitHub Desktop.

Select an option

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

@dsmabulage
Copy link
Copy Markdown

Is there a method to speed up the download

@yousaf2k
Copy link
Copy Markdown

yousaf2k commented Nov 8, 2025

I created a desktop application in C# WPF for easy downloading.
https://github.com/yousaf2k/SharepointVideoDownloader

@kumarvivek1752
Copy link
Copy Markdown

kumarvivek1752 commented Nov 18, 2025

@Nehal16237 i faced this error:

ERROR 403: Time-Limited URL validation failed

i used this > Delete the section starts with "&alt...." till the end of the url

my origial url :

https://southindia1-mediap.svc.ms/transform/videotranscode/df217e30782960a66e6b8dce95125da0a0c224678a61565da14be5a75c7f7edc?provider=Spo&docId=https%3a%2f%2fcciitpatna-my.sharepoint.com%2fpersonal%2femc5103_iitp_ac_in%2f_api%2fv2.0%2fdrives%2fb!rT3m56SsrkK-voUIpU3ic6IrFD5JNDBBmP155eYKqH74DomZoVaATIfMpmdj0LZY%2fitems%2f01QOVS3O2U2VBM72VLDFDYCNRFV436WKRJ%3fversion%3dPublished%26VroomTakeover%3d1&cTag=%22c%3a%7bcf42d554-abea-4719-8136-25af37eb2a29%7d%2c2%22&format=fmp4&InputFormat=mp4&correlationid=59a0daa1-4078-5000-2571-479d53a39741.351e5a84-a768-447b-bb81-41a88be55335&cs=fFNQTw&psi=487977a4-6dca-4479-9379-3acfef82ea2c&pn=hostApp-OnePlayer-Web&ccat=1&PlaybackSessionData=eyJDYW5Vc2VJdGVyYXRpdmVTZWVrRm9yTWV0YWRhdGFEZXJpdmF0aW9uIjpmYWxzZSwiRnJhbWVSYXRlMTAwMEZwcyI6MTU5OTksIklucHV0RnJhbWVIZWlnaHRQaXhlbHMiOjEwODAsIklucHV0RnJhbWVXaWR0aFBpeGVscyI6MTkyMCwiVmlkZW9CaXRyYXRlQnBzIjoxMjIxOTh9&headerOffset=24&headerSize=4066008&msvb=4294967295&altTranscode=1&enableEncryption=1&kid=b3dcd4795e4.891352.66422&enableCdn=1&p1=1763566956&p2=10&p3=1&p4=G1edlwP0sTybE2K%2BfdV779o2h1EhuHlmerKU9XRE767tiZHHIyD3WHZ70%2FTotyJiPwkS041UQcDEaXbVhAaPcg%3D%3D&part=mediasegment&track=video&quality=vcopy&segmentTime=40512000&wsd=96000&ppd=62400000&ppst=0&tempauth=v1.eyJzaXRlaWQiOiJlN2U2M2RhZC1hY2E0LTQyYWUtYmViZS04NTA4YTU0ZGUyNzMiLCJhdWQiOiIwMDAwMDAwMy0wMDAwLTBmZjEtY2UwMC0wMDAwMDAwMDAwMDAvY2NpaXRwYXRuYS1teS5zaGFyZXBvaW50LmNvbUBhNTdmN2Q5Mi0wMzhlLTRkNGMtODI2NS03Y2QyYmViMzNiMzQiLCJleHAiOiIxNzYzNTA1NzU1In0.CgoKBHNuaWQSAjQ5EgsIwvbgrPCy0z4QBRonMjQwMTo0OTAwOjFjYTk6ZTliNzoxZjU2OmJlNTA6YjIwODo1NTllIhRtaWNyb3NvZnQuc2hhcmVwb2ludCosYVJkRXdvcWxTMEE2ZE5OSUFJL2pUMVdkNk5QQU8xYmgzKzJ6Q2xuL0dvRT0wvQE4AUIQodqgWXhAAFAlcUedU6OXQUoQaGFzaGVkcHJvb2Z0b2tlbmIEdHJ1ZWokMDBhYTlmYzktNzVlYS0yNThiLTExZmQtMzNlYTdiYTc0ODI1cikwaC5mfG1lbWJlcnNoaXB8MTAwMzIwMDUwODUwYTcxZEBsaXZlLmNvbXoBMMIBLDAjLmZ8bWVtYmVyc2hpcHx2aXZla19wYTI1MTFhaWg3MUBpaXRwLmFjLmluyAEB4gEWbHhGcUdvZHpBRUM1UjJZVHR5aUdBQeoBB1siQ1AxIl3yAQEx.rZ02b9i_XCggdDbn85wU9l-JaOKT1iR7mDNOnM8wqco

after deletion:

https://southindia1-mediap.svc.ms/transform/videotranscode/df217e30782960a66e6b8dce95125da0a0c224678a61565da14be5a75c7f7edc?provider=Spo&docId=https%3a%2f%2fcciitpatna-my.sharepoint.com%2fpersonal%2femc5103_iitp_ac_in%2f_api%2fv2.0%2fdrives%2fb!rT3m56SsrkK-voUIpU3ic6IrFD5JNDBBmP155eYKqH74DomZoVaATIfMpmdj0LZY%2fitems%2f01QOVS3O2U2VBM72VLDFDYCNRFV436WKRJ%3fversion%3dPublished%26VroomTakeover%3d1&cTag=%22c%3a%7bcf42d554-abea-4719-8136-25af37eb2a29%7d%2c2%22&format=fmp4&InputFormat=mp4&correlationid=59a0daa1-4078-5000-2571-479d53a39741.351e5a84-a768-447b-bb81-41a88be55335&cs=fFNQTw&psi=487977a4-6dca-4479-9379-3acfef82ea2c&pn=hostApp-OnePlayer-Web&ccat=1&PlaybackSessionData=eyJDYW5Vc2VJdGVyYXRpdmVTZWVrRm9yTWV0YWRhdGFEZXJpdmF0aW9uIjpmYWxzZSwiRnJhbWVSYXRlMTAwMEZwcyI6MTU5OTksIklucHV0RnJhbWVIZWlnaHRQaXhlbHMiOjEwODAsIklucHV0RnJhbWVXaWR0aFBpeGVscyI6MTkyMCwiVmlkZW9CaXRyYXRlQnBzIjoxMjIxOTh9&headerOffset=24&headerSize=4066008&msvb=4294967295

am i doing anything wrong?

@shebenu
Copy link
Copy Markdown

shebenu commented Dec 10, 2025

Still works but what about adding an extension to limit a part of file to be downloaded like this?
https://www.reddit.com/r/youtubedl/wiki/howdoidownloadpartsofavideo/

@patelriki13
Copy link
Copy Markdown

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.

Thanks... Its working for me... I would suggest people to use this extension easy to use....

@cypher-256
Copy link
Copy Markdown

This is my Python script using yt_dlp to download Microsoft Teams / SharePoint recordings from a videomanifest URL.

videomanifest.txt must contain the URL obtained from Chrome DevTools → Network tab, filtering by videomanifest.

Setup

python -m venv .venv
source .venv/bin/activate   # Linux / macOS
pip install yt-dlp

Usage

python download.py videomanifest.txt -o <OUTPUT_PATH>

The script automatically trims the URL to &part=index&format=dash and merges audio and video into an MP4 container.

#!/usr/bin/env python3
#./download.py
import argparse
from pathlib import Path
from urllib.parse import urlparse
import yt_dlp

def shorten_url(url: str) -> str:
    key = 'index&format=dash'
    idx = url.find(key)
    if idx == -1:
        raise ValueError("No se encontró 'index&format=dash' en la URL.")
    return url[:idx + len(key)]

def build_downloader_opts(fast: bool):
    opts = {
        'format': 'vcopy+audcopy/best',
        'merge_output_format': 'mp4',
        'ignoreerrors': False,

        'retries': 20,
        'fragment_retries': 20,
        'retry_sleep_functions': {'fragment': lambda n: min(2**n, 10)},

        'nopart': True,

        # timeouts para evitar colgados por fragmento
        'socket_timeout': 30,
    }

    if not fast:
        return opts
    
    
    opts['concurrent_fragments'] = 4
    opts['prefer_insecure'] = False
    opts['enable_file_urls'] = False
    opts['http_client'] = 'curl_cffi'
    opts['verbose'] = True

    return opts

def download_with_yt_dlp(url: str, output: str, opts: dict):
    opts = opts | {'outtmpl': output}
    with yt_dlp.YoutubeDL(opts) as ydl:
        ydl.download([url])

def main():
    p = argparse.ArgumentParser(description="Descarga grabaciones Teams/Stream")
    p.add_argument("manifest_file")
    p.add_argument("-o", "--output", default="output.mp4")
    p.add_argument("--no-fast", action="store_true")
    args = p.parse_args()

    raw_url = Path(args.manifest_file).read_text().strip()
    short_url = shorten_url(raw_url)

    # Solo aplicamos modo rápido si el host es *.svc.ms
    host = urlparse(short_url).hostname or ''
    fast_mode = (not args.no_fast) and host.endswith('svc.ms')

    print(f"Descargando desde: {short_url}")
    opts = build_downloader_opts(fast_mode)
    download_with_yt_dlp(short_url, args.output, opts)
    print(f"Descarga completada: {args.output}")

if __name__ == "__main__":
    main()

https://github.com/cypher-256/py-sharepoint-video-downloader here is my new repo

@cypher-256
Copy link
Copy Markdown

cypher-256 commented Dec 12, 2025

Is there a method to speed up the download

That’s the main problem I’m trying to solve. Microsoft applies aggressive server-side throttling, especially on audio DASH streams.

@poopseecheque
Copy link
Copy Markdown

Seems like teams added some authorization check. Has anyone had the following problem?: I'm trying to download read-only recording, followed all the recommendations, but i get the following error: Error opening input: Server returned 401 Unauthorized (authorization failed)
image

@shebenu
Copy link
Copy Markdown

shebenu commented Feb 6, 2026

Seems like teams added some authorization check. Has anyone had the following problem?: I'm trying to download read-only recording, followed all the recommendations, but i get the following error: Error opening input: Server returned 401 Unauthorized (authorization failed) image

You selected a wrong url
usually 3 links appears , selected one of the others

@brendangooden
Copy link
Copy Markdown

brendangooden commented Feb 12, 2026

You can also try this extension which I made for downloading transcripts, including grouped by speaker for LLM ingest.
https://github.com/brendangooden/ms-teams-transcript-downloader
https://chromewebstore.google.com/detail/MS%20Teams%20Transcript%20Downloader/hmljlkhcebhkkhbbafiheolbneecoinp

i will be adding video and audio download support soon!
[Edit - added now!]

modal_popup_download_options
Example_Video_Audio_Ytdlp

@howardataBIM
Copy link
Copy Markdown

Seems like teams added some authorization check. Has anyone had the following problem?: I'm trying to download read-only recording, followed all the recommendations, but i get the following error: Error opening input: Server returned 401 Unauthorized (authorization failed) image

It happens to me too, any help?

@howardataBIM
Copy link
Copy Markdown

Seems like teams added some authorization check. Has anyone had the following problem?: I'm trying to download read-only recording, followed all the recommendations, but i get the following error: Error opening input: Server returned 401 Unauthorized (authorization failed) image

You selected a wrong url usually 3 links appears , selected one of the others

image

I use 4 of videomanifest but i still cant download any video and this message shows to me "Error opening input files: Server returned 401 Unauthorized (authorization failed)"

@poptropica12
Copy link
Copy Markdown

poptropica12 commented Apr 16, 2026

Seems like teams added some authorization check. Has anyone had the following problem?: I'm trying to download read-only recording, followed all the recommendations, but i get the following error: Error opening input: Server returned 401 Unauthorized (authorization failed) image

You selected a wrong url usually 3 links appears , selected one of the others

image

I use 4 of videomanifest but i still cant download any video and this message shows to me "Error opening input files: Server returned 401 Unauthorized (authorization failed)"

Same here. Everything worked fine last month, but I keep getting Error opening input files: Server returned 401 Unauthorized (authorization failed) today no matter which videomanifest link I chose. Some additional authentications are likely being implemented on the server side. Hopefully someone could find a new way to get ourselves in.

Update

After some digging, the error message seems to be due to a missing access token in the URL, the query parameter access_token has to be present in the URL, which is usually missing now when we use the traditional way to retrieve, resulting in Error opening input files: Server returned 401 Unauthorized (authorization failed).

Workaround (What is currently work for me)

  1. Navigate to the directory of the video
  2. Open "Developer Tools" and navigate to the "Network" tab
  3. Use the Preview feature to preview the desired video
  4. Filter out the entry with the keyword videomanifest like before
  5. Copy the respective URL
  6. Examine the URL to check whether the access_token query parameter exists
  7. Remove the rest of the query parameters starting from altManifestMetadata
  8. Execute the FFMPEG command
ffmpeg -i "<YOUR_RESPECTIVE_URL>" -codec copy "C:\Your\Destination\Path\Video.mp4"

@BorjaMeloRamos
Copy link
Copy Markdown

Workaround (What is currently work for me)
Navigate to the directory of the video
Open "Developer Tools" and navigate to the "Network" tab
Use the Preview feature to preview the desired video
Filter out the entry with the keyword videomanifest like before
Copy the respective URL
Examine the URL to check whether the access_token query parameter exists
Remove the rest of the query parameters starting from altManifestMetadata
Execute the FFMPEG command

@poptropica12
Could you please explain point 3 and 4 in more detail?

I'm not sure if the preview option I'm using is the one I should be using.

@poptropica12
Copy link
Copy Markdown

Workaround (What is currently work for me)
Navigate to the directory of the video
Open "Developer Tools" and navigate to the "Network" tab
Use the Preview feature to preview the desired video
Filter out the entry with the keyword videomanifest like before
Copy the respective URL
Examine the URL to check whether the access_token query parameter exists
Remove the rest of the query parameters starting from altManifestMetadata
Execute the FFMPEG command

@poptropica12 Could you please explain point 3 and 4 in more detail?

I'm not sure if the preview option I'm using is the one I should be using.

When you navigate to the video directory, right-click on the particular video you desire, which should open a context menu, and on the context menu, you should see a Preview option available (It is recommended to turn on "Developer Tools" right before this step).
image

@BorjaMeloRamos
Copy link
Copy Markdown

@poptropica12 Thank you very much for the help. It really worked for me.
I download the videos from Teams and I just need to watch the video preview, and then it works as usual.
I was looking for the preview option in the ‘Developer Tools’ menu.

@LuqmanAlattas
Copy link
Copy Markdown

Seems like teams added some authorization check. Has anyone had the following problem?: I'm trying to download read-only recording, followed all the recommendations, but i get the following error: Error opening input: Server returned 401 Unauthorized (authorization failed) image

You selected a wrong url usually 3 links appears , selected one of the others

image I use 4 of videomanifest but i still cant download any video and this message shows to me "Error opening input files: Server returned 401 Unauthorized (authorization failed)"

Same here. Everything worked fine last month, but I keep getting Error opening input files: Server returned 401 Unauthorized (authorization failed) today no matter which videomanifest link I chose. Some additional authentications are likely being implemented on the server side. Hopefully someone could find a new way to get ourselves in.

Update

After some digging, the error message seems to be due to a missing access token in the URL, the query parameter access_token has to be present in the URL, which is usually missing now when we use the traditional way to retrieve, resulting in Error opening input files: Server returned 401 Unauthorized (authorization failed).

Workaround (What is currently work for me)

  1. Navigate to the directory of the video
  2. Open "Developer Tools" and navigate to the "Network" tab
  3. Use the Preview feature to preview the desired video
  4. Filter out the entry with the keyword videomanifest like before
  5. Copy the respective URL
  6. Examine the URL to check whether the access_token query parameter exists
  7. Remove the rest of the query parameters starting from altManifestMetadata
  8. Execute the FFMPEG command
ffmpeg -i "<YOUR_RESPECTIVE_URL>" -codec copy "C:\Your\Destination\Path\Video.mp4"

I followed the steps and got this error

Error opening input: Invalid data found when processing input
Error opening input file https://northeurope1-mediap.svc.ms/transform/videomanifest?provider=spo&farmid=.....
Error opening input files: Invalid data found when processing input

@LuqmanAlattas
Copy link
Copy Markdown

nvm I used the same url with yt-dlp and it works. Don't know what the issue with ffmpeg

@yadav-Krishna7117
Copy link
Copy Markdown

yadav-Krishna7117 commented Apr 24, 2026

nvm I used the same url with yt-dlp and it works. Don't know what the issue with ffmpeg

can you share me the steps how to download with yt-dlp

@fernandohenriquecm-ops
Copy link
Copy Markdown

Error opening input: Server returned 401 Unauthorized (authorization failed)
Error opening input file https:// ...

@Mohamed-Tawfik-DS
Copy link
Copy Markdown

any update regarding this issue ? is there any other way

@dsmabulage
Copy link
Copy Markdown

any update

@majid3612
Copy link
Copy Markdown

I fixed error 401 in this branch:
https://github.com/majid3612/SharePointVideoDownloader/tree/feature/already-installed-browser-support

dotnet run -- --browser-path "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -v -u "https://your-tenant-my.sharepoint.com/.../stream.aspx?id=..." --capture -o "meeting.mp4" --ffmpeg-path "PATH-TO-YOUR-ffmpeg.exe"

@shebenu
Copy link
Copy Markdown

shebenu commented May 17, 2026

I fixed error 401 in this branch: https://github.com/majid3612/SharePointVideoDownloader/tree/feature/already-installed-browser-support

dotnet run -- --browser-path "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -v -u "https://your-tenant-my.sharepoint.com/.../stream.aspx?id=..." --capture -o "meeting.mp4" --ffmpeg-path "PATH-TO-YOUR-ffmpeg.exe"

Capture: no video element appeared within 30 s.

@majid3612
Copy link
Copy Markdown

I fixed error 401 in this branch: https://github.com/majid3612/SharePointVideoDownloader/tree/feature/already-installed-browser-support
dotnet run -- --browser-path "C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe" -v -u "https://your-tenant-my.sharepoint.com/.../stream.aspx?id=..." --capture -o "meeting.mp4" --ffmpeg-path "PATH-TO-YOUR-ffmpeg.exe"

Capture: no video element appeared within 30 s.

Elaborate more on the issue. Logs, screenshots, etc. of what you get...

@LuqmanAlattas
Copy link
Copy Markdown

LuqmanAlattas commented May 19, 2026

nvm I used the same url with yt-dlp and it works. Don't know what the issue with ffmpeg

can you share me the steps how to download with yt-dlp

sorry for the late reply, First I used homebrew on my Mac to download yt-dlp here

then I used this command

yt-dlp "<YOUR_VIDEO_URL>" -o "C:\Your\Destination\Path\Video.mp4"

to get the video link, follow the steps from @poptropica12 above

@fernandohenriquecm-ops
Copy link
Copy Markdown

any update?

@shebenu
Copy link
Copy Markdown

shebenu commented May 21, 2026

Workaround (What is currently work for me)
Navigate to the directory of the video
Open "Developer Tools" and navigate to the "Network" tab
Use the Preview feature to preview the desired video
Filter out the entry with the keyword videomanifest like before
Copy the respective URL
Examine the URL to check whether the access_token query parameter exists
Remove the rest of the query parameters starting from altManifestMetadata
Execute the FFMPEG command

@poptropica12 Could you please explain point 3 and 4 in more detail?
I'm not sure if the preview option I'm using is the one I should be using.

When you navigate to the video directory, right-click on the particular video you desire, which should open a context menu, and on the context menu, you should see a Preview option available (It is recommended to turn on "Developer Tools" right before this step). image

that's working for me (yt-dlp + teams for web)

@brendangooden
Copy link
Copy Markdown

brendangooden commented May 21, 2026

Anyone having issues with 401 could checkout my Chrome Extension as I recently fixed this.

https://github.com/brendangooden/ms-teams-sharepoint-downloader

https://teamsvideotranscriptexporter.com/

Video / Audio download

  • In-browser download — Video+Audio (MP4), Audio Only (M4A), or Video Only. No extra tools needed.
  • Editable filename — auto-derived from the page title.
  • Floating banner widget as a fallback for when the SharePoint command bar re-renders or hides the button.

Transcript download

  • Automatic detection — the extension watches for the transcript metadata call and adds a Download Transcript button.
  • Three formats — RAW JSON, standard WebVTT, or Grouped VTT (consecutive lines from the same speaker collapsed into a block).
  • Live preview of each format in the modal.
  • Last-used format remembered across sessions.
  • Clear dialog if the meeting was never transcribed, instead of a silent failure.
{78F4CBE1-75D2-4EFB-AA87-14BCE0517283} Screenshot 2026-05-21 142245

@majid3612
Copy link
Copy Markdown

Anyone having issues with 401 could checkout my Chrome Extension as I recently fixed this.

https://github.com/brendangooden/ms-teams-sharepoint-downloader

https://teamsvideotranscriptexporter.com/

Video / Audio download

  • In-browser download — Video+Audio (MP4), Audio Only (M4A), or Video Only. No extra tools needed.
  • Editable filename — auto-derived from the page title.
  • Floating banner widget as a fallback for when the SharePoint command bar re-renders or hides the button.

Transcript download

  • Automatic detection — the extension watches for the transcript metadata call and adds a Download Transcript button.
  • Three formats — RAW JSON, standard WebVTT, or Grouped VTT (consecutive lines from the same speaker collapsed into a block).
  • Live preview of each format in the modal.
  • Last-used format remembered across sessions.
  • Clear dialog if the meeting was never transcribed, instead of a silent failure.

{78F4CBE1-75D2-4EFB-AA87-14BCE0517283} Screenshot 2026-05-21 142245

Great job!
Thanks!

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