How To: Convert audio to another format on a web page
16th December 2005 - By Aaron
You must have permissions to install software on your server.
First you will need to install and test ffmpeg. There are several ways of doing this. The way I accomplished this was using yum. If you’ve never used yum before then a different way might be easier.
I edited /etc/yum.conf to include the DAG repository by adding the following code
[dag]
name=Dag RPM Repository for Fedora Core
baseurl=http://apt.sw.be/fedora/$releasever/en/$basearch/dag
gpgcheck=1
enabled=1
Then you must import DAG’s GPG key, by running this rpm --import http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
After that you can run yum install ffmpeg
Yum should take care of any additional dependencies, which there probably will be.
If you prefer an alternative install method, you could
- Download ffmpeg from the main site, make, and makeinstall it.
- Download a premade ffmpeg rpm
After that install process is over, you will need to test ffmpeg. The executable should be installed to /usr/bin/ffmpeg. To test it, just run /usr/bin/ffmpeg -version and check that the output has no errors. Then run a simple, short audio file through it. Upload it via ftp, then run ffmpeg on it. Look lower for an explanation of args.
Next you will need to create a web form with the ability to upload a file. This isn’t particularly difficult, an example is below.
<form action="upload.php" method="post" enctype="multipart/form-data">
<input type="file" name="audio" size="42">
<input type="submit" name="audio_submit" value="Submit">
</form>
You will also need an upload.php to receive the file. This page is quite a bit more complicated, but is mostly copy and paste, so don’t get too worried. Here is an example of an upload.php.
<?php
ini_set( "max_execution_time", "3600" ); // sets the maximum execution time of this script to 1 hour.
$fileName = $_FILES['message']['name']; // get client side file name
if( $fileName ) {
// Check File Type
$fileNameParts = explode( ".", $fileName ); // seperate the name from the ext
$fileExtension = end( $fileNameParts ); // part behind last dot
$fileExtension = strtolower( $fileExtension ); // reduce to lower case
if( !$fileExtension == "mp3" ) {
die( "$fileName is not an mp3 file." );
}
// Check File Size
$fileSize = $_FILES['message']['size']; // size of uploaded file
if( $fileSize == 0 ) {
die( "Sorry. The upload of $fileName has failed. The file size is 0." );
} else if( $fileSize > 10240000 ) { //10 MB
die( "Sorry. The file $fileName is larger than 10MB. Advice: reduce the file quality and upload again." );
} else {
$uploadDir = '/var/www/vhosts/yourdomain.com/httpdocs/audio/audio_to_encode/'; // Where the temp file will go
$uploadFile = str_replace( " ", "", $uploadDir . $_FILES['message']['name'] ); // Get rid of spaces in the filename
$finalDir = '/var/www/vhosts/yourdomain.com/httpdocs/audio/flv_files/'; // Where the final file will go
$finalFile = str_replace( " ", "", $finalDir . $fileNameParts[0] . ".flv" ); // Get rid of spaces in the filename
if ( !move_uploaded_file( $_FILES['message']['tmp_name'], $uploadFile ) ) {
echo "Possible file upload attack! Here's some debugging info:\n";
echo( $_FILES );
}
$encode_cmd = "/usr/bin/ffmpeg -i $uploadFile -f flv -acodec mp3 -ab 64 -ac 1 -title \"Clip Title\" -author \"Clip Author\" -copyright \"Clip Copyright\" $finalFile";
exec( $encode_cmd );
unlink( $uploadFile );
chmod( $finalFile, 0644 );
}
}
?>
There are several areas you will need to edit. You will need to change the maximum upload file size, the type of files allowed, along with various locations of the temporary and permenant files.
You need to change the permissions on the directories you will be using to allow writing for everyone. I used my ftp program to accomplish this.
The ffmpeg options are very numerous, so they may require a bit of explanation. For a complete list go here, but I will list the ones I used.
-i is the input file
-f is output format
-acodec is audio codec (I am creating a video file, flv, but with an embeded mp3)
-ab is audio bitrate
-ac is audio channels (I did mono)
You will also probably need to change your php.ini to allow larger file uploads, because the default is set to 2MB.
My configuration file is located at /etc/php.ini
Change the following values in that file.
file_uploads = On
post_max_size = 32M
upload_max_filesize = 30M
That should be all you need to get this conversion going. Mine will convert files regardless of size and time, within the hour time limit of course. I have converted 25MB stereo MP3s to flv without a problem.
Leave a comment if you have anything to add!
January 20th, 2006 at 9:46 am
thank you for the code example!
i face a problem when executing ffmpeg, even if all permissions are set proberly. i also tried to output the return string of shell_exec, but it returns nothing. so i have no idea why ffmpeg works fine on shell but the same commandline won’t work when executed in the PHP-script.
thank you for any useful help!
January 20th, 2006 at 1:03 pm
Things to consider…
Is the output directory writable?
Is the input directory readable to your web server? (A problem with open_basedir)
Is the input file readable to your web server?
Are you including the path to your files and ffmpeg?
First try debugging by echoing your $encode_cmd and then running it in shell. Keep in mind you may need to change directories to the location of the php if you haven’t included absolute file references.
If that fails, you will probably get an error that tells you why, if it succeeds…
Try a test with minimal functionality. Just start with a basic php script and short mp3 file already on the server, like 500kb.
Then check your directory to make sure that the file appeared. If it did, commence debugging your script for permissions and locations. If it didn’t, then you probably have a problem with permissions. Perhaps safe_mode is on with php? Maybe you should test with an easier exec to get results from, like ls.
It is difficult to get proper output from ffmpeg because of the nature of that output. The output returned to php is not the same as what you see in the shell. Run
ffmpeg -i short.mp3 -f flv short.flv > outfilein the shell.Then look at the contents of outfile. That is probably about what php gets back. Not the output you are looking for.
January 26th, 2006 at 9:32 am
It works, but there is a general problem with audio files (MP3) or audio tracks in videos. They cannot be converted to FLV:
“No audio of video streams available”
Maybe a problem with the MP3 codec?
I thought the MPEG-codecs come by default with ffmpeg?
Thank you for help!
January 26th, 2006 at 11:26 am
The most common causes of this error are an unsupported codec or incorrect use of the program. Some codecs are not supported, although MPEG should be by default. Certain PCM codecs also give this error if not entered exactly correctly.
I suggest trying different files created by different programs. If you use iMovie, try making one with TMPGenc, Pinnacle Studio, Adobe Premiere, whatever.
What command are you using exactly?
January 30th, 2006 at 2:53 am
I installed LAME MP3-codec and afterwards FFMPEG with LAME enabled. Then I tried coverting an MP3 file again:
linux:/usr/local/bin # ffmpeg -i song.mp3 -f flv song.flv
ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory
I also tried a movie:
linux:/usr/local/bin # ffmpeg -i gates.mpeg -f flv -acodec mp3 -ab 64 -ac l gates.flv
ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory
here is the procedure:
> cd /usr/local/src
> tar xzvf lame-X.X.X.tgz
> cd lame-X.X.X
> ./configure
> make
> make install
> cd /usr/local/src
> tar xzvf ffmpeg-X.X.X.tar.gz
> cd ffmpeg-X.X.X
> ./configure –enable-mp3lame
> make
> make install
Is LAME necessary for FFMPEG to convert MP3 files?
Vie
Thank you for any help!
January 30th, 2006 at 2:49 pm
I’m having the same issue - converting any video file into flv with audio/video.
- I’m able to convert mp3 to flv no problem
- Able to convert wmv to mpg no problem
I just cant get mpg/wmv to convert to flv. The video works, no sound.
January 30th, 2006 at 5:22 pm
I have LAME, lame-3.96.1-2.1.fc3.rf, installed on my box, and it handles the mp3 to flv conversion perfectly. I do not know if it is necessary.
When I’m searching for the error I find a lot of information on “/etc/ld.so.conf”.
I remember back when I was trying to figure this whole ffmpeg thing out seeing some posts on ffmpeg working for the video but having no sound. I didn’t solve the problem myself, never tried because I wasn’t using video. Please come back and post it when you find the solution.
February 12th, 2006 at 7:23 pm
Hi,
I have a problem using ffmpeg, I was able to convert wmv to mpg but I cannot convert from any format to flv. Am I missing codec or something. I install ffmpeg using CVS source.
February 12th, 2006 at 7:52 pm
You need to be more descriptive. Error messages and such.
February 17th, 2006 at 7:07 am
I’m also facing the same problem ffmpeg. i’m able to convert avi,mpg,mov,wmv to flv format but all the output flv files are without audio.
i’ve installed lame on my system and compiled ffmpeg with lame support enabled but still not getting any audio in flv files.
when i try to convert mp3 file to flv using follwing command i.e
ffmpeg -i abc.mp3 xyz.flv
it gives me “No audio of video streams availableâ€
can any one please tell me how to rectify this problem.
any kind of help will be highly appreciated…
March 19th, 2006 at 12:41 am
can you please help me find the most commonly used video formats (like avi,mpeg, wmv etc)
so that i can code based on these extension for my site.
i see the command line parameters are not same for all the video formats to flv. my aim is to convert everyting into flv. so i would like to know what are the formats (i see many in the document) but not sure how many people use all. i need to convert only most commonly used and reject the least famous types. do you think ffmpeg convert all the formats to FLV well?
please advice.
thanks
Kani
March 24th, 2006 at 9:45 am
To Rudolf:
You probably want to add /usr/local/lib to /etc/ld.so.conf and run
ldconfig. Then the libmp3lame.so.0 file should be correctly detected.
this will fix your error! IT worked for me
March 24th, 2006 at 9:50 am
I believe ffmpeg is your best bet. The only competition is MPlayer, another open source app.
If you are talking video, in order of popularity…
avi (Xvid, DivX)
mpg
rm
mov
—–I would cut it here
mp4, rmvb, flv, and many others
May 5th, 2006 at 2:05 am
Hi,
I am trying to convert flv to any audio format but getting no results, do any body have any solution for this?
please post the reply as soon as possible.
thanks.
May 6th, 2006 at 1:54 am
hi
can u tell me code how convert a wmv file into flv file.
i think code give by u run on linux
May 24th, 2006 at 1:12 pm
hi i have the same issue
./ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory
why?
what can i do??
June 1st, 2006 at 10:10 am
Hi,I’m working on a web client that record a sppech and send it to a speech processing application…So, I must convert the flv file recorded to any other audio format..
I tried to use ffmpeg but it doesn t work,I got this message:
bash-3.00$ ffmpeg -f flv -i foo.flv foo1.wav
FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
configuration: –prefix=/usr/local –enable-mp3lame –enable-vorbis –enable-a52 –enable-shared –enable-gpl –enable-pp –enable-pthreads –enable-libogg
libavutil version: 49.0.0
libavcodec version: 51.7.0
libavformat version: 50.3.0
built on Mar 17 2006 09:26:37, gcc: 3.4.5
[flv @ 0xb7fa1fc8]Unsupported audio codec (5)
Input #0, flv, from ‘foo.flv’:
Duration: 00:00:03.6, bitrate: N/A
Stream #0.0: Audio: 0×0005, 8000 Hz, mono
Output #0, wav, to ‘foo1.wav’:
Stream #0.0: Audio: pcm_s16le, 8000 Hz, mono, 128 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Unsupported codec (id=0) for input stream #0.0
what can do?
is there any other solution to convert the flv file on linux??
any help will be appreciated
thanks
June 29th, 2006 at 11:01 pm
Hi,
Do you know how to get the output from: exec( $encode_cmd ); ?
I was able to output it to a file: exec( $encode_cmd . “2>file.txt”);
But i would like to read it directly in PHP.
Let me know if you found a way to do this.
khaled, what speech processing application are you using? I am working on a project that also needs to convert the video than run a voice recognition software.
For encoding:
I’m using mencoder for the videos that ffmpeg doesn’t support.
cheers,
August 25th, 2006 at 3:05 pm
# /usr/local/bin/ffmpeg -i /tmp/test.mpg -acodec mp3 -ab 128 -ar 44100 -s 320×240 /tmp/test.flv
FFmpeg version SVN-r6034, Copyright (c) 2000-2004 Fabrice Bellard
configuration: –enable-mp3lame
libavutil version: 49.0.0
libavcodec version: 51.11.0
libavformat version: 50.5.0
built on Aug 26 2006 03:39:33, gcc: 3.4.3 20050227 (Red Hat 3.4.3-22.1)
Input #0, mpeg, from ‘/tmp/test.mpg’:
Duration: 00:00:18.3, start: 0.177778, bitrate: 826 kb/s
Stream #0.0[0x1c0]: Audio: mp2, 32000 Hz, mono, 32 kb/s
Stream #0.1[0x1e0]: Video: mpeg1video, yuv420p, 320×240, 104857 kb/s, 25.00 fps(r)
Output #0, flv, to ‘/tmp/test.flv’:
Stream #0.0: Video: flv, yuv420p, 320×240, q=2-31, 200 kb/s, 25.00 fps(c)
Stream #0.1: Audio: mp3, 44100 Hz, mono, 128 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Unsupported codec for input stream #0.1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
If anyone else get this really annoying “Unsupported codec” error that won’t seem to go away, even after correctly installing Lame MP3 and recompiling FFMPEG, try this very simple fix…
When you recompile FFMPEG, you need to do a ***CLEAN*** recompile, as follows:
./configure –enable-mp3lame
make clean; make
make install
September 11th, 2006 at 7:36 am
no sound after successfull converting of moviefiles into flv files
After installing and configuring mp3lame, FAAC, FAAD2, libogg, libvorbis, and some other codec packages I end up with the following error:
# /usr/bin/ffmpeg -i /home/admin/public_html/videoportal/original_videos/20060911100412War3-Movie-Trailer.avi -acodec mp3 /home/admin/public_html/videoportal/compressed_videos/20060911102853demovideo_peijenburgt1.flv
FFmpeg version SVN-r5829, Copyright (c) 2000-2004 Fabrice Bellard
configuration: –prefix=/usr –enable-mp3lame –enable-a52 –enable-dts –enable-libogg –enable-vorbis –enable-faad –enable-gpl –enable-memalign-hack –enable-pp –enable-pthreads –enable-gprof –enable-faadbin –enable-shared –disable-mmx –enable-xvid –enable-a52bin –enable-faac
libavutil version: 49.0.0
libavcodec version: 51.14.0
libavformat version: 50.5.0
built on Sep 11 2006 12:23:46, gcc: 3.4.6 20060404 (Red Hat 3.4.6-3)
Seems that stream 0 comes from film source: 30000.00 (30000/1) -> 24.00 (24/1)
Input #0, avi, from ‘/home/admin/public_html/videoportal/original_videos/20060911100412War3-Movie-Trailer.avi’:
Duration: 00:00:29.9, start: 0.000000, bitrate: 1040 kb/s
Stream #0.0: Video: mpeg4, yuv420p, 800×340, 24.00 fps(r)
Stream #0.1: Audio: mp3, 44100 Hz, stereo, 128 kb/s
File ‘/home/admin/public_html/videoportal/compressed_videos/20060911102853demovideo_peijenburgt1.flv’ already exists. Overwrite ? [y/N] y
Output #0, flv, to ‘/home/admin/public_html/videoportal/compressed_videos/20060911102853demovideo_peijenburgt1.flv’:
Stream #0.0: Video: flv, yuv420p, 800×340, q=2-31, 200 kb/s, 24.00 fps(c)
Stream #0.1: Audio: 0×0000, 44100 Hz, stereo, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Stream #0.1 -> #0.1
Unsupported codec for output stream #0.1
While I installed MP3Lame with:
1
./configure –prefix=/usr –enable-shared
Can anyone tell me what I am doing wrong, since mp3lame is compiled, installed as a shared component and compiled with FFMPEG shouldn’t FFMPEG be able to encode the MP3 along with the FLV movie?
ps. and does it matter if I installed LAME later than ffmmpeg?
November 27th, 2006 at 1:32 am
how to force ffmpeg to output audio track for wmv->flv conversion?
ffmpeg -i input.wmv -s 320×240 output.flv
FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2004 Fabrice Bellard
configuration: –enable-gpl –enable-pp –enable-pthreads –enable-vorbis –enable-libogg –enable-a52 –enable-dts –enable-libgsm –enable-dc1394 –disable-debug –enable-shared –prefix=/usr
libavutil version: 0d.49.0.0
libavcodec version: 0d.51.11.0
libavformat version: 0d.50.5.0
built on Sep 25 2006 13:00:42, gcc: 4.1.2 20060901 (prerelease) (Debian 4.1.1-13)
Seems that stream 1 comes from film source: 1000.00 (1000/1) -> 29.97 (30000/1001)
Input #0, asf, from ‘input.wmv’:
Duration: 00:02:36.5, start: 3.000000, bitrate: 100 kb/s
Stream #0.0: Audio: wmav2, 16000 Hz, mono, 16 kb/s
Stream #0.1: Video: wmv1, yuv420p, 320×240, 29.97 fps(r)
File ‘output.flv’ already exists. Overwrite ? [y/N] y
Output #0, flv, to ‘output.flv’:
Stream #0.0: Video: flv, yuv420p, 320×240, q=2-31, 200 kb/s, 29.97 fps(c)
Stream mapping:
Stream #0.1 -> #0.0
Press [q] to stop encoding
frame= 4676 q=8.7 Lsize= 4200kB time=156.0 bitrate= 220.5kbits/s
video:1035kB audio:0kB global headers:0kB muxing overhead 305.820952%
——————-^
January 19th, 2007 at 1:41 am
I needed 2 days to figure out how to read ffmpeg output to php.
This is very usefull to test ang get a normal error/flaw of actions in php..
You need to do somenthing like this:
exec (”(ffmpeg -i $video_file_path > /dev/null) 3>&1 1>&2 2>&3″,$my_out);
print_r ($my_out);
January 24th, 2007 at 11:53 pm
I’ve been searching high and low for a solution to ffmpeg’s horrible “Unsupported codec” problem - all documentation points to making sure that (1) LAME is installed (2) ffmpeg is configured correctly and is made cleanly (3) that the rest of your conversion is operating correctly (i.e. the video stream). All is as required, yet MP3 sound still fails to work, and I’ve just about given up on this avenue. Has anyone had any luck with this whatsoever??
February 8th, 2007 at 3:16 am
hy joe can u give me exact code of conversion wmv to flv?
my code is converting avi to flv only please help me….
March 16th, 2007 at 7:46 am
FFMpeg now supports FLV 1.1, so you don’t need the FLVTool2 part anymore.. I wrote a small entry about this
April 28th, 2007 at 10:22 am
To Rudolf:
You probably want to add /usr/local/lib to /etc/ld.so.conf and run
ldconfig. Then the libmp3lame.so.0 file should be correctly detected.
this will fix your error! IT worked for me
May 21st, 2007 at 1:53 pm
EVERYONE WITH A FLV SOUND PROBLEM TRY THIS OPTION:
-ar 22050
FOR EXAMPLE:
ffmpeg -i test.avi -f flv -acodec mp3 -ab 64 -ac 1 -ar 22050 test-stream.flv
It’s the audio rate, when I defined an audio rate the sound works on my FLV files.
Hope this helps,
Turnips
May 23rd, 2007 at 5:47 am
conversion code for flv is working in the shell but not in the php, what may be the problem?
$ffmpeg_opts =”-ar 22050 -s 320×240″;
$fmt = “flv”;
$cmd=”/usr/bin/ffmpeg -i $uploadedfile -f $fmt $ffmpeg_opts $newfile”;
$exec=exec($cmd);
sleep(5);
@chmod($new_video_path,0755);
Looking forward to reply
Adi
June 22nd, 2007 at 11:00 pm
Use passthru command
June 22nd, 2007 at 11:02 pm
header(”Content-type: video/flv”);
header(”Content-Disposition: attachment; filename=\”video.flv\”;” );
$exec_string = “/usr/bin/ffmpeg -i $uploadedfile -f $fmt $ffmpeg_opts -”;
passthru($exec_string);
July 5th, 2007 at 2:05 pm
hi,
ffmpeg works fine on the shell.
if i try to convert a avi to flv with php
the outpute file in empty, no video an no audio.
anyone knows why?
July 13th, 2007 at 10:45 am
give thanks you for the inscribe deterrent example! i present a trouble once capital punishment ffmpeg, level if each permissions are lot proberly. i besides well-tried to end product the deliver string of words of shell_exec, only it returns cypher. true i need nobelium melodic theme wherefore ffmpeg whole kit okay happening carapace only the one and the same commandline south korean won’t work on once dead inch the PHP-script. give thanks you for whatsoever functional serve!
July 13th, 2007 at 3:11 pm
hi i want to change the video frame rate.
when i convert any video the frame rate is: 0 frames/second
and the data rate is: 0 kbps
i want the frame rate: 25 frame / second
and the data rate: 114kbps
so please help me… .
July 13th, 2007 at 5:41 pm
i need it high resolution and maximum quality
July 30th, 2007 at 7:47 am
Hi,
I want to convert .avi to .flv
For that i have used following commandline
ffmpeg -y -i “Video.avi” -r 5 -b 512000 -g 15 -ar 44100 -ab 224k -f flv “Video.flv”
My problem is that the video quality of “video.flv” is not same as “video.avi”.
plz note that video.avi is screen captured video(The current activity of desktop)and resolution is current system’s resolution(i.e 1024×768)
Image in my output FLV file is blurred(Text is not clearly readable,but picture quality is good).
Can anyone help me in this regard?
Which parameters i should pass to FFMPEG to get better video quality?
I have also tried with -b 2496..but there is not much diffrence.
August 3rd, 2007 at 6:39 am
@Zehra: Have you tried to add the -s parameter to force the video size?
For example:
ffmpeg -y -i “Video.avi” -r 5 -b 512000 -g 15 -ar 44100 -ab 224k -f flv -s 1024×768 “Video.flv”
August 15th, 2007 at 1:16 am
Do you know how to get the output from: exec( $encode_cmd ); ?
September 24th, 2007 at 12:04 am
FFMpeg now supports FLV 1.1, so you don’t need the FLVTool2 part anymore.. I wrote a small entry about this
November 5th, 2007 at 3:46 pm
I have seen this question posed on several sites, but no answers…
I’m having problems like so many other people getting audio to convert over. Here is what I’m typing in the shell
ffmpeg -i test.wmv -s 320×240 -aspect 4:3 -ab 16 -ar 11025 test.flv
and I tried a diff audio bit rate
ffmpeg -i test.wmv -s 320×240 -aspect 4:3 -ab 8 -ar 11025 test.flv
and I get
FFmpeg version SVN-r10657, Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: –cc=cc –prefix=/usr/local –make=gmake –disable-debug –enable-memalign-hack –enable-shared –enable-pp –extra-cflags=-I/usr/local/include/vorbis -I/usr/local/include –extra-ldflags=-L/usr/local/lib -la52 –extra-libs=-pthread –enable-gpl –mandir=/usr/local/man –enable-liba52 –enable-liba52bin –enable-libfaad –enable-libfaadbin –disable-mmx –enable-libogg –disable-ffplay –enable-libtheora –enable-libvorbis –enable-libx264
libavutil version: 49.5.0
libavcodec version: 51.44.0
libavformat version: 51.14.0
built on Nov 1 2007 07:32:33, gcc: 3.4.6 [FreeBSD] 20060305
Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 15.00 (15/1)
Input #0, asf, from ‘Anna354.wmv’:
Duration: 00:06:06.4, start: 3.000000, bitrate: 436 kb/s
Stream #0.0: Audio: wmav2, 8000 Hz, mono, 8 kb/s
Stream #0.1: Video: wmv3, yuv420p, 420×314, 425 kb/s, 15.00 fps(r)
File ‘test.flv’ already exists. Overwrite ? [y/N] y
Output #0, flv, to ‘test.flv’:
Stream #0.0: Video: flv, yuv420p, 320×240, q=2-31, 200 kb/s, 15.00 fps(c)
Stream mapping:
Stream #0.1 -> #0.0
Press [q] to stop encoding
frame= 5496 fps= 57 q=9.4 Lsize= 9215kB time=366.4 bitrate= 206.0kbits/s
video:7635kB audio:0kB global headers:0kB muxing overhead 20.702541%
is this a problem with the audio codec of wmav2?
Any help would be great, and thanks in advance!
December 6th, 2007 at 12:55 pm
hi there can sum one explain to me how i can just convert a video file WMV which is 75 megb to a 75mb avi file
i cant do this and it is piss taking plz help thnx agian:)
December 25th, 2007 at 2:02 pm
Use passthru command
January 2nd, 2008 at 11:23 am
Passthru might work for output capturing in *nix env, but it does not work in Windows. I was thinking of using something like this to capture file info:
exec(”ffmpeg.exe -i… >tmp.txt”);
All of the output should be in tmp.txt. Open the tmp.txt file, parse it for data, and delete it. However, I wouldn’t do this if you are making the end-user wait for conversion to take place. It might take quite some time to get your results :)
April 12th, 2008 at 3:42 am
hi there can sum one explain to me how i can just convert a video file WMV which is 75 megb to a 75mb avi file
i cant do this and it is piss taking plz help thnx agian:)
July 16th, 2008 at 8:36 am
hi all,
running a media-temple (dv) dedicated virtual server, with a full root-access. I installed the ffmpeg, and some codecs, etc. I can run the ffmpeg from bash, and it converts the requested wmv/avi/mpg to flv, but through php’s exec/shell_exec/passthru the same command doesnt want to work. No file is created in the given folder…
Safe_mode is off, no disabled functions, 777 permissions on the folders, but the file is not created…
Interesting thing that i can run a simple exec() like , this works…
any ideas?
July 16th, 2008 at 9:06 am
forget the previous post, i managed to got it working:)
ill post here my solution, maybe will be helpful: try to use absolute path to the ffmpeg command, 4 xmpl: “$encode_cmd = “/usr/local/bin/ffmpeg…”
on my server this path is /usr/local/bin/ffmpeg…
this way i was able to do the converting.
many thanks!
August 7th, 2008 at 5:16 pm
I was having trouble getting useful output from
exec($encode_cmd, $output, $retval);
$output always contained an empty array
then i discovered this snippet of BASH
2>&1
# Redirects stderr to stdout.
# Error messages get sent to same place as standard output.
if i use a command like
$encode_cmd =”ffmpeg -i test.mp3 test2.mp3 2>&1″;
exec($encode_cmd, $output, $retval);
then $array will contain all the output from ffmpeg
see http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html for more info
hope this helps someone
KUDOS to Aaron Gadberry for this very helpful webpage
August 7th, 2008 at 5:21 pm
forgot to mention
exec($encode_cmd, $output, $retval);
$retval will be 0 if command succeeds
$retval will be 1 (or some other integer) if command fails
$output will contain an array of the output from ffmpeg -as seen when accessing it directly from the command line
December 14th, 2008 at 12:53 pm
thank you