문제

I'm making a video gallery and would like to pull some info about the video for displaying. Does anyone know how I would go about retrieving the video duration using ffmpeg? Is it possible to get this info using HTML5?

Thanks.

다른 팁

What I do (on Linux) is this:

tcprobe -i $FILE | tail -n1 | cut -d '=' -f3

tcprobe is from the transcode Debian package.

If you're on Windows there's a tool called MediaInfo, but I haven't tried it so I can't remark on its effectiveness.

I would recommend PHPVideoToolkit...

This class is a wrapper around the FFmpeg, FLVTools2 and Mencoder programs to allow PHP developers to manipulate and convert video files in any easy to use object oriented way. It also currently provides FFmpeg-PHP emulation in pure PHP so you wouldn't need to compile and install the module. Note, it isn't intended as a FFmpeg-PHP replacement, only an alternative solution and it is recommended that if you make heavy use of the FFmpeg-PHP functionality you should install the module as it is more efficient.

PHPVideoToolkit is pretty much the only video/audio class that you will need from now on. It performs several types of manipulation operations that include video format conversion, extract video frames into separate image files, assemble a video stream from a set of separate video images, extract audio from video, watermark videos and extracted frames. Several parameters can also be configured like the output video file format (which can be Flash video or any other supported by ffmpeg), video and audio bit rate and sample rate, video dimensions and aspect ratio. It can also retrieve information about the media file, such as duration, bitrate, framerate, format, dimensions, display aspect ratio, pixel aspect ratio, audio stereo, audio frequency and audio format, without any other additional library such as ffmpeg-php.

  • Note, I wrote it so ask any questions you want about using it.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top