Aaron Gadberry

Help – v. helped, help·ing, helps

Was this site helpful?
My Amazon.com Wishlist

How To: Convert audio to another format on a web page

16th December 2005 - By Aaron Gadberry

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!

49 Responses to “How To: Convert audio to another format on a web page”

  1. Rudolf Says:

    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!

  2. Stucco Says:

    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.

    <?php
     $encode_cmd = "/usr/bin/ffmpeg -i short.mp3 -f flv short.flv";
     exec( $encode_cmd );
    ?>

    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 > outfile in the shell.

    Then look at the contents of outfile. That is probably about what php gets back. Not the output you are looking for.

  3. rudolf Says:

    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!

  4. Stucco Says:

    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?

  5. rudolf Says:

    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!

  6. joe Says:

    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.

  7. Stucco Says:

    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.

  8. brian Says:

    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.

  9. Stucco Says:

    You need to be more descriptive. Error messages and such.

  10. mohit Says:

    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…

  11. Kani Says:

    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

  12. Steve Says:

    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

  13. Stucco Says:

    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

  14. Sandeep Says:

    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.

  15. sharad Says:

    hi
    can u tell me code how convert a wmv file into flv file.
    i think code give by u run on linux

  16. mugugu Says:

    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??

  17. khaled Says:

    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

  18. Daniel Tome Says:

    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,

  19. Auroborus Says:

    # /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

  20. jbanks Says:

    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?

  21. Reuven Says:

    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%

    ——————-^

  22. JB Says:

    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);

  23. Adam Prall Says:

    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??

  24. Fawad Says:

    hy joe can u give me exact code of conversion wmv to flv?

    my code is converting avi to flv only please help me….

  25. FLV converter Says:

    FFMpeg now supports FLV 1.1, so you don’t need the FLVTool2 part anymore.. I wrote a small entry about this

  26. barbie oyunları Says:

    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

  27. Turnips Says:

    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

  28. Adi Says:

    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

  29. Aaron Says:

    Use passthru command

  30. Aaron Says:

    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);

  31. freddy Says:

    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?

  32. Michael Says:

    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!

  33. zouhair Says:

    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… .

  34. zouhair Says:

    i need it high resolution and maximum quality

  35. Zehra Says:

    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.

  36. Cube Says:

    @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”

  37. rowery Says:

    Do you know how to get the output from: exec( $encode_cmd ); ?

  38. domeny Says:

    FFMpeg now supports FLV 1.1, so you don’t need the FLVTool2 part anymore.. I wrote a small entry about this

  39. Bruce Says:

    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!

  40. Zaman Says:

    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:)

  41. bedava oyunlar Says:

    Use passthru command

  42. Dog B. Says:

    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 :)

  43. kız oyunları Says:

    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:)

  44. gecko Says:

    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?

  45. gecko Says:

    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!

  46. sim Says:

    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

  47. sim Says:

    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

  48. metin Says:

    thank you

  49. Fareler Says:

    Nice information.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>