Skip to content

Instantly share code, notes, and snippets.

@mfd
Last active December 10, 2025 04:43
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

@haskyhub-ctrl
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.

Is there any way to download other files like pdf, word?

@diegofenner
Copy link

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)

Great answer! I hope it reduces the downloaded file, since my specific situation has 3 video and 4 audio streams. Testing it right now. Thanks!

image image

@diegofenner
Copy link

update:
Despite the error at the end, I can watch the video.
image

@JavierSolis
Copy link

until dash work for me

@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....

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