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

@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