Php-ffmpeg: How to get the length of a video

Created on 12 Apr 2017  路  2Comments  路  Source: PHP-FFMpeg/PHP-FFMpeg

Expected Behavior

Sorry, I made a mistake just now and my English is really poor.
I want to get the length(xxx seconds) of a video but cannot find a appropriate way to do. I find a way on the Internet that need to execute a Linux command but I think maybe there is a better way. So I want to ask that whether FFMpeg provide a interface to do it?

Steps to Reproduce

What are the steps to reproduce this bug? Please add code examples,
screenshots or links to GitHub repositories that reproduce the problem.

Possible Solutions

If you have already ideas how to solve the issue, add them here.
Otherwise remove this section.

Most helpful comment

Ah. That makes sense, you can do it like this:

$ffprobe = FFMpeg\FFProbe::create();
$length = $ffprobe
    ->format('/path/to/video/mp4') // extracts file informations
    ->get('duration');             // returns the duration property

All 2 comments

Sorry, I do not understand what "澶╂渤" means. Could you explain it, please?

Ah. That makes sense, you can do it like this:

$ffprobe = FFMpeg\FFProbe::create();
$length = $ffprobe
    ->format('/path/to/video/mp4') // extracts file informations
    ->get('duration');             // returns the duration property
Was this page helpful?
0 / 5 - 0 ratings

Related issues

boomuo picture boomuo  路  3Comments

aminyazdanpanah picture aminyazdanpanah  路  6Comments

miraklo picture miraklo  路  6Comments

datangkang123 picture datangkang123  路  7Comments

Mahdi-Mohammadi picture Mahdi-Mohammadi  路  4Comments