Help!, I need somebody

32 views
Skip to first unread message

clark...@googlemail.com

unread,
Apr 21, 2008, 3:45:13 AM4/21/08
to ffmpeg-php
My command line is looking like this. I have not got the greatest
experience with Linux so any advice would be handy.

======[root@vps1384 ffmpeg-php-0.5.1]# /usr/local/bin/ffmpeg -i /var/
www/vhosts/<myurl>/httpdocs/ffmpeg/robot.avi -ar 32000 -ab 32 -f flv -
s 160x112 /var/www/vhosts/<myurl>k/httpdocs/ffmpeg/overview.flv | /usr/
local/bin/flvtool2 -U stdin /var/www/vhosts/<myurl>/httpdocs/ffmpeg/
overview.flv
/usr/local/bin/ffmpeg: error while loading shared libraries:
libavdevice.so.52: cannot open shared object file: No such file or
directory
ERROR: undefined method `timestamp' for nil:NilClass
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:285:in
`lasttimestamp'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flv/stream.rb:274:in
`duration'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:
181:in `add_meta_data_tag'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:
137:in `update'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:
47:in `send'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:
47:in `execute!'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:
46:in `each'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:
46:in `execute!'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:
206:in `process_files'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2/base.rb:
44:in `execute!'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2.rb:168:in
`execute!'
ERROR: /usr/local/cpffmpeg/lib/ruby/site_ruby/1.8/flvtool2.rb:228
ERROR: /usr/local/bin/flvtool2:2:in `require'
ERROR: /usr/local/bin/f

Todd Kirby

unread,
Apr 21, 2008, 4:54:17 AM4/21/08
to ffmpe...@googlegroups.com
Try first running:

export LD_LIBRARY_PATH=/usr/local/lib/

Then rerun your ffmpeg command and see if that gets rid of the..


/usr/local/bin/ffmpeg: error while loading shared libraries:
libavdevice.so.52: cannot open shared object file: No such file or
directory

...portion of the error.

-T-

clark...@googlemail.com

unread,
Apr 22, 2008, 3:36:41 AM4/22/08
to ffmpeg-php
Thanks Todd,

The following is the new output. It appears to have outputed a FLV
file from the command line which produces sound etc. Which is good.
The response was as below, however I still am confused why FLV tool is
still throwing errors.

[root@vps1384 ~]# /usr/local/bin/ffmpeg -i /var/www/vhosts/<my-url>/
httpdocs/ffmpeg/robot.avi -ar 44100 -ab 32 -f flv -s 160x112 /var/www/
vhosts/<my-url>/httpdocs/ffmpeg/overview.flv | /usr/local/bin/flvtool2
-U stdin /var/www/vhosts/<my-url>/httpdocs/ffmpeg/overview.flv
FFmpeg version SVN-r12891, Copyright (c) 2000-2008 Fabrice Bellard, et
al.
configuration: --enable-libmp3lame --enable-libvorbis --enable-
libxvid --enable-shared --enable-libfaac --enable-libfaad --enable-gpl
--enable-libtheora --enable-libx264 --enable-avfilter-lavf
libavutil version: 49.6.0
libavcodec version: 51.55.0
libavformat version: 52.13.0
libavdevice version: 52.0.0
built on Apr 18 2008 20:13:03, gcc: 3.4.6 20060404 (Red Hat 3.4.6-9)
Compiler did not align stack variables. Libavcodec has been
miscompiled
and may be very slow or crash. This is not a bug in libavcodec,
but in the compiler. You may try recompiling using gcc >= 4.2.
Do not report crashes to FFmpeg developers.
Input #0, mpeg, from '/var/www/vhosts/<my-url>/httpdocs/ffmpeg/
robot.avi':
Duration: 00:00:09.60, start: 0.177778, bitrate: 183 kb/s
Stream #0.0[0x1c0]: Audio: mp2, 32000 Hz, mono, 32 kb/s
Stream #0.1[0x1e0]: Video: mpeg1video, yuv420p, 160x112 [PAR 1:1
DAR 10:7], 104857 kb/s, 25.00 tb(r)
WARNING: The bitrate parameter is set too low. It takes bits/s as
argument, not kbits/s
File '/var/www/vhosts/<my-url>/httpdocs/ffmpeg/overview.flv' already
exists. Overwrite ? [y/N] y
Output #0, flv, to '/var/www/vhosts/<my-url>/httpdocs/ffmpeg/
overview.flv':
Stream #0.0: Video: flv, yuv420p, 160x112 [PAR 1:1 DAR 10:7],
q=2-31, 200 kb/s, 25.00 tb(c)
Stream #0.1: Audio: libmp3lame, 44100 Hz, mono, 0 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Press [q] to stop encoding
frame= 243 fps= 0 q=2.0 Lsize= 449kB time=9.7 bitrate=
378.2kbits/s
video:362kB audio:76kB global headers:0kB muxing overhead 2.257578%
ERROR: /usr/local/bin/flvtool2:2
====


The problem I have now is when I try and run it from my PHP script it
returns an empty flv. Any ideas


On Apr 21, 9:54 am, "Todd Kirby" <ffmpeg....@gmail.com> wrote:
> Try first running:
>
> export LD_LIBRARY_PATH=/usr/local/lib/
>
> Then rerun your ffmpeg command and see if that gets rid of the..
>
> /usr/local/bin/ffmpeg: error while loading shared libraries:
> libavdevice.so.52: cannot open shared object file: No such file or
> directory
>
> ...portion of the error.
>
> -T-
>
> On Sun, Apr 20, 2008 at 9:45 PM, clarkeym...@googlemail.com <

Todd Kirby

unread,
Apr 22, 2008, 5:44:10 AM4/22/08
to ffmpe...@googlegroups.com
Try this:

/usr/local/bin/ffmpeg -y  -i /var/www/vhosts/<my-url>/httpdocs/ffmpeg/robot.avi -ar 44100 -ab 32000 -f flv -s 160x112 - | /usr/local/bin/flvtool2 -U stdin /var/www/vhosts/<my-url>/httpdocs/ffmpeg/overview.flv

clark...@googlemail.com

unread,
Apr 22, 2008, 8:27:45 AM4/22/08
to ffmpeg-php
Still no joy when running it through a php script I am still getting
errors returned from FLV Tool. Here is the script I am running

<?php

ini_set('display_errors','1');
ini_set('display_startup_errors','1');
error_reporting (E_ALL);
$php_errormsg = "";


// Set our source file
echo dirname(__FILE__);
$srcFile = "/var/www/vhosts/<myurl>/httpdocs/ffmpeg/robot.avi";
$destFile = "/var/www/vhosts/<myurl>/httpdocs/ffmpeg/bugger.flv";
$ffmpegPath = "/usr/local/bin/ffmpeg";
$flvtool2Path = "/usr/local/bin/flvtool2";
// Create our FFMPEG-PHP class
$ffmpegObj = new ffmpeg_movie($srcFile);
// Save our needed variables
$srcWidth = makeMultipleTwo($ffmpegObj->getFrameWidth());
$srcHeight = makeMultipleTwo($ffmpegObj->getFrameHeight());
$srcFPS = $ffmpegObj->getFrameRate();
$srcAB = intval($ffmpegObj->getAudioBitRate()/1000);
$srcAR = $ffmpegObj->getAudioSampleRate();
// Call our convert using exec()

$command = $ffmpegPath . " -y -i " . $srcFile . " -ar " . $srcAR . " -
ab " . $srcAB . " -f flv -s " . $srcWidth . "x" . $srcHeight . " " .
$destFile . " | " . $flvtool2Path . " -U stdin " . $destFile;
echo $command . "<br/>";

exec($command, $output);
print_r($output);

// Make multiples function
function makeMultipleTwo ($value)
{
$sType = gettype($value/2);
if($sType == "integer")
{
return $value;
} else {
return ($value-1);
}
}
print_r($php_errormsg);
?>


On Apr 22, 10:44 am, "Todd Kirby" <ffmpeg....@gmail.com> wrote:
> Try this:
>
> /usr/local/bin/ffmpeg -y -i
> /var/www/vhosts/<my-url>/httpdocs/ffmpeg/robot.avi -ar 44100 -ab 32000 -f
> flv -s 160x112 - | /usr/local/bin/flvtool2 -U stdin
> /var/www/vhosts/<my-url>/httpdocs/ffmpeg/overview.flv
>
> On Mon, Apr 21, 2008 at 9:36 PM, clarkeym...@googlemail.com <

clark...@googlemail.com

unread,
Apr 22, 2008, 8:36:44 AM4/22/08
to ffmpeg-php
I have just seen that when my PHP script creates the FLV's (empty
ones) it creates them as user apache and group apache. Will this stop
the process from working?. If so how do I set the script up to use a
different privelage group?.

On Apr 22, 1:27 pm, "clarkeym...@googlemail.com"

Todd Kirby

unread,
Apr 22, 2008, 3:04:29 PM4/22/08
to ffmpe...@googlegroups.com
The problem is that you are specifying to ffmpeg to write a destination file but you are also trying to pipe the output to flvtool. You can do one or the other. Flvtool is not getting any output from ffmpeg the way you are running it. Replace the destfile in your php command with a dash '-'. (See my command below)

-T-

Todd Kirby

unread,
Apr 22, 2008, 3:04:56 PM4/22/08
to ffmpe...@googlegroups.com
Oops:

Replace the destfile in your FFMPEG command with a dash '-'

clark...@googlemail.com

unread,
Apr 23, 2008, 3:55:04 AM4/23/08
to ffmpeg-php
OK Todd, cheers for all the help and advice thus far. I replaced
ffmpeg dest file with a dash

/var/www/vhosts/<mydomain>/httpdocs/ffmpeg/usr/local/bin/ffmpeg -y -i /
var/www/vhosts/<mydomain>/httpdocs/ffmpeg/robot.avi -ar 32000 -ab 32 -
f flv -s 160x112 - | /usr/local/bin/flvtool2 -U stdin /var/www/vhosts/
<mydomain>/httpdocs/ffmpeg/anotherthing.flv

Still no joy

Any ideas

I am still getting an empty flv outputting.

On Apr 22, 8:04 pm, "Todd Kirby" <ffmpeg....@gmail.com> wrote:
> Oops:
>
> Replace the destfile in your *FFMPEG* command with a dash '-'
>
> On Tue, Apr 22, 2008 at 9:04 AM, Todd Kirby <ffmpeg....@gmail.com> wrote:
> > The problem is that you are specifying to ffmpeg to write a destination
> > file but you are also trying to pipe the output to flvtool. You can do one
> > or the other. Flvtool is not getting any output from ffmpeg the way you are
> > running it. Replace the destfile in your php command with a dash '-'. (See
> > my command below)
>
> > -T-
>
> ...
>
> read more »

Todd Kirby

unread,
Apr 23, 2008, 4:45:49 PM4/23/08
to ffmpe...@googlegroups.com
What is the output when run from the command line?

clark...@googlemail.com

unread,
Apr 24, 2008, 7:36:03 AM4/24/08
to ffmpeg-php
Here is the response

[root@vps1384 ffmpeg]# /usr/local/bin/ffmpeg -y -i /var/www/vhosts/
<mydomain>/httpdocs/ffmpeg/robot.avi -ar 32000 -ab 32 -f flv -s
160x112 - | /usr/local/bin/flvtool2 -U stdin /var/www/vhosts/
<mydomain>/httpdocs/ffmpeg/anotherthing.flv
FFmpeg version SVN-r12891, Copyright (c) 2000-2008 Fabrice Bellard, et
al.
configuration: --enable-libmp3lame --enable-libvorbis --enable-
libxvid --enable-shared --enable-libfaac --enable-libfaad --enable-gpl
--enable-libtheora --enable-libx264 --enable-avfilter-lavf
libavutil version: 49.6.0
libavcodec version: 51.55.0
libavformat version: 52.13.0
libavdevice version: 52.0.0
built on Apr 18 2008 20:13:03, gcc: 3.4.6 20060404 (Red Hat 3.4.6-9)
Compiler did not align stack variables. Libavcodec has been
miscompiled
and may be very slow or crash. This is not a bug in libavcodec,
but in the compiler. You may try recompiling using gcc >= 4.2.
Do not report crashes to FFmpeg developers.
Input #0, mpeg, from '/var/www/vhosts/<mydomain>/httpdocs/ffmpeg/
robot.avi':
Duration: 00:00:09.60, start: 0.177778, bitrate: 183 kb/s
Stream #0.0[0x1c0]: Audio: mp2, 32000 Hz, mono, 32 kb/s
Stream #0.1[0x1e0]: Video: mpeg1video, yuv420p, 160x112 [PAR 1:1
DAR 10:7], 104857 kb/s, 25.00 tb(r)
WARNING: The bitrate parameter is set too low. It takes bits/s as
argument, not kbits/s
Output #0, flv, to 'pipe:':
Stream #0.0: Video: flv, yuv420p, 160x112 [PAR 1:1 DAR 10:7],
q=2-31, 200 kb/s, 25.00 tb(c)
Stream #0.1: Audio: libmp3lame, 32000 Hz, mono, 0 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
[libmp3lame @ 0x2a95de64c0]flv does not support that sample rate,
choose from (44100, 22050, 11025).
Could not write header for output file #0 (incorrect codec
parameters ?)
===============

On Apr 23, 9:45 pm, "Todd Kirby" <ffmpeg....@gmail.com> wrote:
> What is the output when run from the command line?
>
> On Tue, Apr 22, 2008 at 9:55 PM, clarkeym...@googlemail.com <
> ...
>
> read more »

clark...@googlemail.com

unread,
Apr 24, 2008, 7:38:09 AM4/24/08
to ffmpeg-php
Also there was an empty FLV outputted. The previous commmand executed
from the command line was outputting a fully converted FLV.

Todd Kirby

unread,
Apr 24, 2008, 3:32:07 PM4/24/08
to ffmpe...@googlegroups.com
-ab 32

should be

-ab 32000

clark...@googlemail.com

unread,
Apr 25, 2008, 11:53:26 AM4/25/08
to ffmpeg-php
Ok I fired the command off with the -ab 3200 and got the following. It
saying my avi file cannot be found, but it renders it from the command
line if i put a destination file in there instead of a hyphen.

Any ideas

[root@vps1384 ~]# /usr/local/bin/ffmpeg -y -i /var/www/vhosts/<myurl>/
httpdocs/ffmpeg/robot.avi -ar 32000 -ab 32000 -f flv -s
FFmpeg version SVN-r12891, Copyright (c) 2000-2008 Fabrice Bellard, et
al.
configuration: --enable-libmp3lame --enable-libvorbis --enable-
libxvid --enable-shared --enable-libfaac --enable-libfaad --enable-gpl
--enable-libtheora --enable-libx264 --enable-avfilter-lavf
libavutil version: 49.6.0
libavcodec version: 51.55.0
libavformat version: 52.13.0
libavdevice version: 52.0.0
built on Apr 18 2008 20:13:03, gcc: 3.4.6 20060404 (Red Hat 3.4.6-9)
/var/www/vhosts/<myurl>/httpdocs/ffmpeg/robot.avi: no such file or
directory
[root@vps1384 ~]# 160x112 - | /usr/local/bin/flvtool2 -U stdin /var/
www/vhosts/<myurl>/httpdocs/ffmpeg/anotherthing.flv
-bash: 160x112: command not found
On Apr 24, 8:32 pm, "Todd Kirby" <ffmpeg....@gmail.com> wrote:
> -ab 32
>
> should be
>
> -ab 32000
>
> On Thu, Apr 24, 2008 at 1:38 AM, clarkeym...@googlemail.com <

clark...@googlemail.com

unread,
Apr 25, 2008, 12:12:39 PM4/25/08
to ffmpeg-php
Could this all be a permissions thing?. I am firing the command using
the command line and it seems to work (if i but the dest file in the
ffmpeg output) but using the ffmpeg-php the same command returns an
empty FLV. If i do it from the command line the owner comes up as
root, if I do it through my php script the owner of the empty flv is
apache. I am not a linux user and am not sure how its permissions
work. I should probably point out that the site was set up through
Plesk, so I am not sure if that has any affect.


On Apr 25, 4:53 pm, "clarkeym...@googlemail.com"

Todd Kirby

unread,
Apr 25, 2008, 4:38:31 PM4/25/08
to ffmpe...@googlegroups.com
Not sure. There's too many variables at this point. Get the command working correctly from the command line and then you can debug running it thru php.

-T-

clark...@googlemail.com

unread,
Apr 28, 2008, 3:35:13 AM4/28/08
to ffmpeg-php
OK,

The above command still returend the FLV tool errors. Is FLV tool
required to do straight conversions of FLV's.

Steve

On Apr 25, 9:38 pm, "Todd Kirby" <ffmpeg....@gmail.com> wrote:
> Not sure. There's too many variables at this point. Get the command working
> correctly from the command line and then you can debug running it thru php.
>
> -T-
>
> On Fri, Apr 25, 2008 at 6:12 AM, clarkeym...@googlemail.com <

Todd Kirby

unread,
Apr 28, 2008, 4:08:18 PM4/28/08
to ffmpe...@googlegroups.com
No. It add metadata that allow duration display and seeking. You don't need it while you are debugging.

clark...@googlemail.com

unread,
Apr 29, 2008, 6:01:42 AM4/29/08
to ffmpeg-php
Ok So I have now rolled it back to no FLV tool manipulation. I am
running the following command

/usr/local/bin/ffmpeg -y -i /var/www/vhosts/<my-url>/httpdocs/ffmpeg/
robot.avi -ar 32000 -ab 32000 -f flv -s 160x112 /var/www/vhosts/<my-
url>/httpdocs/ffmpeg/anotherthing.flv

And get the following response

/usr/local/bin/ffmpeg -y -i /var/www/vhosts/<my-url>//httpdocs/ffmpeg/
robot.avi -ar 32000 -ab 32000 -f flv -s 160x112 /var/www/vhosts/<my-
url>//httpdocs/ffmpeg/anotherthing.flv
FFmpeg version SVN-r12891, Copyright (c) 2000-2008 Fabrice Bellard, et
al.
configuration: --enable-libmp3lame --enable-libvorbis --enable-
libxvid --enable-shared --enable-libfaac --enable-libfaad --enable-gpl
--enable-libtheora --enable-libx264 --enable-avfilter-lavf
libavutil version: 49.6.0
libavcodec version: 51.55.0
libavformat version: 52.13.0
libavdevice version: 52.0.0
built on Apr 18 2008 20:13:03, gcc: 3.4.6 20060404 (Red Hat 3.4.6-9)
Compiler did not align stack variables. Libavcodec has been
miscompiled
and may be very slow or crash. This is not a bug in libavcodec,
but in the compiler. You may try recompiling using gcc >= 4.2.
Do not report crashes to FFmpeg developers.
Input #0, mpeg, from '/var/www/vhosts/<my-url>/httpdocs/ffmpeg/
robot.avi':
Duration: 00:00:09.60, start: 0.177778, bitrate: 183 kb/s
Stream #0.0[0x1c0]: Audio: mp2, 32000 Hz, mono, 32 kb/s
Stream #0.1[0x1e0]: Video: mpeg1video, yuv420p, 160x112 [PAR 1:1
DAR 10:7], 104857 kb/s, 25.00 tb(r)
Output #0, flv, to '/var/www/vhosts/<my-url>/httpdocs/ffmpeg/
anotherthing.flv':
Stream #0.0: Video: flv, yuv420p, 160x112 [PAR 1:1 DAR 10:7],
q=2-31, 200 kb/s, 25.00 tb(c)
Stream #0.1: Audio: libmp3lame, 32000 Hz, mono, 32 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
[libmp3lame @ 0x2a95de64c0]flv does not support that sample rate,
choose from (44100, 22050, 11025).
Could not write header for output file #0 (incorrect codec
parameters ?)


However no I am getting

On Apr 28, 9:08 pm, "Todd Kirby" <ffmpeg....@gmail.com> wrote:
> No. It add metadata that allow duration display and seeking. You don't need
> it while you are debugging.
>
> On Sun, Apr 27, 2008 at 9:35 PM, clarkeym...@googlemail.com <

clark...@googlemail.com

unread,
Apr 29, 2008, 7:33:44 AM4/29/08
to ffmpeg-php
OK,

I have run the following command in the command line

/usr/local/bin/ffmpeg -y -i /var/www/vhosts/<myurl>/httpdocs/ffmpeg/
robot.avi -ar 22050 -f flv -s 160x112 /var/www/vhosts/<myurl>/httpdocs/
ffmpeg/anotherthing.flv

This does the conversion I had to set the ar to 22050.

When I run the command in my php script uisng ffmpeg-php. Nothing




On Apr 29, 11:01 am, "clarkeym...@googlemail.com"
Reply all
Reply to author
Forward
0 new messages