Question Video to image
Question Video to image
I am working on a script that lets you upload all kinds of video and images. I am wornding if ImageMagick can be used to take a snapshoot of the video and then display it as a image. showing the image on main page.
the script I am using is wrote in php. also my hosting company has imagemagick installed.
thanks for any information . if a script has been written you someone tell me where to get it and if not any information link would be great!
the script I am using is wrote in php. also my hosting company has imagemagick installed.
thanks for any information . if a script has been written you someone tell me where to get it and if not any information link would be great!
Re: Question Video to image
ffmpeg does the job
especially if you have multiple video formats i would doubt magicks ability to extract (key) frames
ffmpeg has lots of filters for almost every possible codec
especially if you have multiple video formats i would doubt magicks ability to extract (key) frames
ffmpeg has lots of filters for almost every possible codec
Re: Question Video to image
I think it can and would search the user section as this would have come up before.
Re: Question Video to image
blatant wrote:ffmpeg does the job
especially if you have multiple video formats i would doubt magicks ability to extract (key) frames
ffmpeg has lots of filters for almost every possible codec
thanks my hosting company does not support ffmpeg that is why I am looking to program something different
Re: Question Video to image
Bonzo wrote:I think it can and would search the user section as this would have come up before.
I searched and did not see a answer. I guess I could have mist it. thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Question Video to image
I believe that IM uses ffmpeg to do its work on video. That delegate library is needed with IM.
Re: Question Video to image
I found this
http://www.imagemagick.org/Usage/video/
and using below code and it will not create a .gif file any thoughts?
<?php
$name = 'cat.avi';
$new_name = 'cat.gif';
$max_width = "90";
$max_height = "90";
exec("convert -quiet -delay 1 $name $max_widthx$max_height $new_name");
print("<b>New image size:</b>".$new_name.$name."<br>");
echo "<img src=\"".$name."\">";
echo "<img src=\"".$new_name."\">";
?>
http://www.imagemagick.org/Usage/video/
and using below code and it will not create a .gif file any thoughts?
<?php
$name = 'cat.avi';
$new_name = 'cat.gif';
$max_width = "90";
$max_height = "90";
exec("convert -quiet -delay 1 $name $max_widthx$max_height $new_name");
print("<b>New image size:</b>".$new_name.$name."<br>");
echo "<img src=\"".$name."\">";
echo "<img src=\"".$new_name."\">";
?>
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Question Video to image
you probably need the full path to convert, usually at /usr/local/bin or /usr/bin
try this
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
or
in command line try
find /usr | grep "convert"
or
sudo find / | grep "convert"
try this
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
or
in command line try
find /usr | grep "convert"
or
sudo find / | grep "convert"
Re: Question Video to image
fmw42 wrote:you probably need the full path to convert, usually at /usr/local/bin or /usr/bin
try this
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
or
in command line try
find /usr | grep "convert"
or
sudo find / | grep "convert"
my paths are
ImageMagick /usr/bin/
ImageMagick (C) /usr/local/bin/convert
I tried this and still will not work
<?php
$name = 'cat.avi';
$new_name = 'cat.gif';
$max_width = "90";
$max_height = "90";
exec(" /usr/local/bin/convert -quiet -delay 1 $name $max_widthx$max_height $new_name");
print("<b>Names:</b>".$new_name.$name."<br>");
echo "<img src=\"".$name."\">";
echo "<img src=\"".$new_name."\">";
?>
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Question Video to image
see if it runs from the command line or what errors it tells you and report back.
On the surface this makes no sense for correct syntax:
convert -quiet -delay 1 $name $max_widthx$max_height $new_name
to what does the WidthxHeight refer?
Is that a subsection of the image or a crop or a resize? If the latter two, then you need some operator such as -crop or -resize, if the former, then the size must be specified as image.png[WidthxHeight+xoffset+yoffset] the brackets are important as are the offsets
On the surface this makes no sense for correct syntax:
convert -quiet -delay 1 $name $max_widthx$max_height $new_name
to what does the WidthxHeight refer?
Is that a subsection of the image or a crop or a resize? If the latter two, then you need some operator such as -crop or -resize, if the former, then the size must be specified as image.png[WidthxHeight+xoffset+yoffset] the brackets are important as are the offsets
Re: Question Video to image
fmw42 wrote:see if it runs from the command line or what errors it tells you and report back.
On the surface this makes no sense for correct syntax:
convert -quiet -delay 1 $name $max_widthx$max_height $new_name
to what does the WidthxHeight refer?
Is that a subsection of the image or a crop or a resize? If the latter two, then you need some operator such as -crop or -resize, if the former, then the size must be specified as image.png[WidthxHeight+xoffset+yoffset] the brackets are important as are the offsets
thanks
I changed to
http://www.imagemagick.org/Usage/video/
<?php
$name = 'cat.avi';
$new_name = 'cat.gif';
exec(" /usr/local/bin/convert -quiet -delay 1 $name $new_name");
print("<b>Names:</b>".$new_name.$name."<br>");
echo "<img src=\"".$name."\">";
echo "<img src=\"".$new_name."\">";
?>
but still do not get a cat.gif I can not run from command line. is there away to output error message to screen?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Question Video to image
try adding the returnval and print_r as in
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
Re: Question Video to image
fmw42 wrote:try adding the returnval and print_r as in
<?php
exec("/usr/local/bin/convert -version",$out,$returnval);
print_r($out[0]);
?>
when I add
<?php
exec("convert -version",$out,$returnval);
print_r($out[0]);
?>[/quote]
I get
Version: ImageMagick 6.3.9 12/10/08 Q16 http://www.imagemagick.org
Re: Question Video to image
Try:
When I run this I get:
Code: Select all
<?php
$name = 'cat.avi';
$new_name = 'cat.gif';
$array=array();
echo "<pre>";
exec(" /usr/local/bin/convert $name -quiet -delay 1 $new_name 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
print("<b>Names:</b>".$new_name.$name."<br>");
echo "<img src=\"".$name."\">";
echo "<img src=\"".$new_name."\">";
?>
Array
(
[0] => convert: no tag found `avi:decode' @ delegate.c/InvokeDelegate/863.
[1] => convert: missing an image filename `cat.gif' @ convert.c/ConvertImageCommand/2822.
)
1
Re: Question Video to image
[quote="Bonzo"]Try:
When I run this I get:
thanks I get this error any thoughts?
Array
(
[0] => convert: Not enough pixel data `cat.avi'.
[1] => convert: missing an image filename `cat.gif'.
)
1
Code: Select all
<?php
$name = 'cat.avi';
$new_name = 'cat.gif';
$array=array();
echo "<pre>";
exec(" /usr/local/bin/convert $name -quiet -delay 1 $new_name 2>&1", $array);
echo "<br>".print_r($array)."<br>";
echo "</pre>";
print("<b>Names:</b>".$new_name.$name."<br>");
echo "<img src=\"".$name."\">";
echo "<img src=\"".$new_name."\">";
?>
When I run this I get:
thanks I get this error any thoughts?
Array
(
[0] => convert: Not enough pixel data `cat.avi'.
[1] => convert: missing an image filename `cat.gif'.
)
1