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.
Use exec function in php
http://www.longtailvideo.com/support/forums/jw-player/setup-issues-and-embedding/9448/how-to-get-video-duration-with-ffmpeg-and-php
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.
Related
The question is similar to: Is there any way to create a video thumbnail through PHP without ffmpeg?
However, that thread is 6-year old and technologies have evolved since then.
Any way to extract a thumbnail from uploaded MP4 file using PHP?
Ffmpeg is great, but unfortunately unsupported on shared hosting accounts, requiring a dedicated server. And it's a kinda overkill to use ffmpeg's power just to generate a video preview picture.
Any other simple solution?
I have a video and I want to play it in audio and video both format.
I did not want to convert it in mp3 and download it.
I want to run it online.
Can i do this. Remember, I have only one file which in video format.
Is there any way to achieve this.
You have to use http://ffmpeg.org/
This is a library that allows you to manipulate videos.
Ffmpeg is a shell tool, so if you want to run it from PHP script you have to follow this guide:
https://trac.ffmpeg.org/wiki/PHP
As we all know, it is possible to add/edit effect on a image using php. But can we also do the same thing for a video? I have done some searching for this but no results.
I am giving a link which shows how to show effects on an image and which is working fine, but what about video?
You can do this image effects with GD library.
PHP is not limited to creating just HTML output. It can also be used
to create and manipulate image files in a variety of different image
formats, including GIF, PNG, JPEG, WBMP, and XPM. Even more
convenient, PHP can output image streams directly to a browser. You
will need to compile PHP with the GD library of image functions for
this to work. GD and PHP may also require other libraries, depending
on which image formats you want to work with.
But unfortunately there is no library available in php to Video accessing and adding effects.
I'm developing a PHP application that uses FFMPEG-PHP to split videos and convert them to FLV. And I ran into this problem :
FFMPEG does not support G2M3 or G2M2 encoded videos, and I have to make the process of splitting and converting videos effortless for the client, I don't want him to convert the video locally before uploading to the server.
All I want to do is to find a way to convert the G2M3 encoded videos online to FLV or to any other video type that FFMPEG supports.
So, is there any way I can do that?
Can MEncoder handle this type of videos?
I tried doing something similar and could not find a solution. The only workaround I could get together was to use an older version of Windows Media Encoder (think it was version 9), which would let you convert to a different format.
The big hassle was that the GotoMeeting codec was only available on Windows (and maybe Mac). A possible workaround could be to setup GotoMeeting to record using standard WMV, which is not the default setting.
G2M3 is a proprietary codec, see this link on vlc-forum. As the thread says, you will not find a open-src implementation of it.
Google gives me this link for a conversion howto
I need a way to extract the audio from some video (in PHP). I have the video streaming in from YouTube, so I would really like it if it were on the fly streaming, not I have to save it to a temp directory and process it there (though that is acceptable.) Thanks, Isaac Waller
Edit: to be more specific, I have a MP4 and I want it to be a MP3.
You're going to want to use something like ffmpeg and call it using php's exec command. If you look around in the docs, I'm sure you can figure out what flag to use to only get the audio.
I've used this app before on a project for live transcoding of video, works like a charm. Just make sure your server has it correctly installed.
Mplayer should do this for you, and there are libraries and codecs that you can call (PHP supports C libraries) which will strip the video from the AV stream on the fly.
Given that you're targeting youttube your job is a bit easier because they use a very small subset of file encodings.
If you take the time to learn the format, you can very easily remove the video stream on the fly and return only the audio stream.
If you give a little more information, such as what you're encoding it to, or where it's going to end up we may be able to help more specifically.
-Adam