1

I want to check the audio or video file duration in python. Basically I am working on a platform similar to TikTok, where the user has restrictions for uploading the video or audio of a specific duration. I need to develop a web API that will access the file posted and check first of all, whether the uploaded file is a video or audio, I have achieved this using the library https://pypi.org/project/filetype/ Now I want to check whether the uploaded content has the time duration less than or equal to 1 minute and 30 seconds. How can I achieve this?

Thanks in advance.

Hafiz Siddiq
  • 671
  • 3
  • 9
  • 23
  • https://stackoverflow.com/questions/3844430/how-to-get-the-duration-of-a-video-in-python/38042336 is this the answer to your question? – Madiyor Jun 30 '20 at 09:30

1 Answers1

0

There is a library called Mutagen https://github.com/quodlibet/mutagen

https://mutagen.readthedocs.io/en/latest/api/base.html

Ashoka
  • 101
  • 5