I'm building a script that executes ffmpeg. I use the system() code which executes the command properly, however it does not return a value.

I attribute this to being the fact that the ffmpeg command has a dymanic output that shows the conversion progress and then gives a result.

I'd like to be able to pull that dynamic content into a variable if possible. Is there a way?

In this case, I cannot run ffmpeg-php on this server (I don't have admin rights, nor can I get them)

Thanks.

    If you need to execute a command and have all the data from the command passed directly back without any interference, use the passthru() function.

    that or redirect the output to a file and read it on completion

      I tried both ways and I'm still not getting output (although the script is running properly)

      I tried

      $result = passthru('ffmpeg -i test.mov Test2.flv', $retval);

      as well as

      $result = passthru('ffmpeg -i test.mov Test2.flv > output.txt', $retval);

      The output.txt was created, but it was empty.

        what does it return when done on the command line?

          dagon;10898154 wrote:

          what does it return when done on the command line?

          $ ffmpeg -i test.mov Test2.flv
          FFmpeg version SVN-r7231, Copyright (c) 2000-2006 Fabrice Bellard, et al.
            configuration:  --prefix=/usr --mandir=${prefix}/share/man --enable-gpl --enable-pp --enable-pthreads --enable-vorbis --enable-faac --enable-libogg --enable-a52 --enable-dts --enable-libgsm --disable-debug --enable-mp3lame --enable-faad 
            libavutil version: 49.1.0
            libavcodec version: 51.25.0
            libavformat version: 51.6.0
            built on May  4 2007 15:46:52, gcc: 3.3.5 (Debian 1:3.3.5-13)
          Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mov':
            Duration: 00:00:03.0, start: 0.000000, bitrate: 28779 kb/s
            Stream #0.0(eng): Video: dvvideo, yuv411p, 720x480, 29.97 fps(r)
          Output #0, flv, to 'Test2.flv':
            Stream #0.0: Video: flv, yuv420p, 720x480, q=2-31, 200 kb/s, 29.97 fps(c)
          Stream mapping:
            Stream #0.0 -> #0.0
          Press [q] to stop encoding
          frame=   91 q=31.0 Lsize=     504kB time=3.0 bitrate=1358.9kbits/s    
          video:502kB audio:0kB global headers:0kB muxing overhead 0.315135%

          Starting at the "Press [q] to stop encoding" is when the output becomes dynamic. It updates the status as it works its way through the file. Once that's done the last line of the code is outputted.

            $result = passthru('dir', $retval);
            echo $retval;
            

            does that produce anything?

              dagon;10898157 wrote:

              does that produce anything?

              TestGetDir.php useraccess 0

              Yup, outputs correctly.

                well then i 'blame' ffmpeg

                  Write a Reply...