Play audio from any video using php - php

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

Related

how can I convert mp3 to wav using php code without external library or application

I am trying to generate waveform for mp3 files, and found that it is possible using php code to generate waveform for wav files, but not mp3. I need to convert mp3 to wav, but also it is not possible to install ffmpeg or lame on shared hosting, is there any other solutions like php based conversion?
I don't think this is possible. But you can use a SAAS platform to help you with that. maybe you can try http://www.encoding.com/ or http://aws.amazon.com/elastictranscoder/.

Obtaining video information using FFMPEG, or possibly HTML5

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.

Best way to add image to mp3 file with PHP?

I am looking for a way to embed album art in a mp3 file with PHP, either through a some kind of PHP script or through exec() and a Linux command.
PHP supports setting ID3 tags, but it looks like it does not support images.
If you want to add image you can make use of the eyeD3 Linux command with --add-image option.

Convert FLV to MP4 or 3GP

Can I convert videos with PHP or do I have to use some library?
You'll need to use some libraries to achieve this.
The Wordpress video solutions framework already does video conversion; is written in PHP and uses FFMPEG and other tools to do the conversion. This may be a good starting point for you.

PHP Extract audio from video

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

Categories