Skip to content

Instantly share code, notes, and snippets.

@mfd
Last active February 23, 2025 20:28
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

@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

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