Skip to content

Instantly share code, notes, and snippets.

@mfd
Last active December 17, 2025 18:03
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

Is there a method to speed up the download

@yousaf2k
Copy link

yousaf2k commented Nov 8, 2025

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

@kumarvivek1752
Copy link

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

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

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

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

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.

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