Get the length of a video file using ffmpeg with php
FFmpeg is complete, cross platform solution to record, convert, stream audio and video. It has the leading libavcodec library. The good part is its an open source software. Here in this post, I am sharing you a php snippet which will use FFmpeg to get the length of a video file. If you have not installed FFmpeg then you can download from http://www.ffmpeg.org/download.html. This script should be easy to understand. It uses
ffmpeg -i file.mp4to extract the information of the video file and then uses regex to get the video length from the extracted information. The complete script is as follows:
Thank you very much. you saved a couple of days of mine.
ReplyDeleteI am glad, it was useful to you. :)
Delete