AA,
HI,
Dear how r u?
I want to scroll / move an image horizontally as watermark over the video with smooth speed as long as the movie is running.
I am using wamp , php 5 , ffmpeg , imlib2.dll , windows xp ,
I am using code as under but image is scrolled with un smooth speed.I want to scroll the image smoothly from right to left:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Vid Encoding</title>
</head>
<body>
<?php
$water_mark='Muhammad Asim Dewan Relax Solutions';
$water_mark_width=strlen($water_mark);
$font_file="Fonts\\arial.ttf";
$font_size="15.0";
/// MAKE POINTS EQUAL TO THE PIXELS. WE ARE USING GD2 SO WE ARE USING POINTS. BUT OUTPUT WE NEED IN PIXELS AS IMAGREATE FUNCTION TAKES.
$font_size_in_pixels=($font_size/1.33);
// HANDLING IMAGE SIZE ACCORDING TO THE STRING OF CHARACTERS.
if($water_mark_width<30)
{
$image_width=($water_mark_width*$font_size_in_pixels)+22;
}
elseif($water_mark_width>=30 && $water_mark_width<50)
{
$image_width=($water_mark_width*$font_size_in_pixels)+27;
}
else
{
$image_width=($water_mark_width*$font_size_in_pixels)+30;
}
////////////////////////////
$image_height=50;
$image1=imagecreate($image_width,$image_height);
$image_background_color=imagecolorallocate($image1, 0, 0, 0);
$colorTransparent = imagecolortransparent($image1,$image_background_color); // transparent the given image for the specified color from background
$image_text_color=imagecolorallocate($image1,253,198,45);//text color which will be putting on image
imagettftext($image1,$font_size,0,0,30,$image_text_color,$font_file,$water_mark); /// used for putting text on image ie making image form the given text
//save image png
//$watermark_image=imagecreatefrompng($image1);
// imagestring() does not take font family or font file as parameter
$text_to_show="water_mark.png";
imagepng($image1,$text_to_show); // saving png image on the disk
//header ("Content-type: image/png"); // do not output an image over the browser while you are going to save that image.
?>
<?php
//phpinfo();
//include('ffmpeg_movie.php');
$ffmpegpath="ffmpeg\\ffmpeg";
$input_file="asimf.flv";
$output_file="water_c.flv";
$font_path="Fonts\\arial.ttf/20";
//$x_axis="W*(0.8-0.99*tan(N/50/15*PI))";
//$x_axis="W*(0.8-0.99*tan(N/50/25-PI))";
$x_axis="W*(0.8-0.80*tan(N/150*PI/4))";
//;$x_axis="W*(0.8-0.70*tan(N/150*PI/3.50))";
$y_axis="H*(0.75+0*cos(N/1*PI))";
//practice
//$x_axis="w+(0.8-1.0*tan(N))";
//$y_axis="H*(0.8+0*cos(N/1*PI))";
//
$output_width = "320";
$output_height = "240";
$ab = "128";
$r = "23";
$b="259000";
$ar="44100";
$color_r="210";
$color_g="155";
$color_b="200";
$space=" asim";
$font_family="Fonts\\arial.ttf/20";
//$texts_to_show="DEWANGUSENET"; FOR TEXT WATERMARK UNCOMMENT IT
//$text_to_show="dollarlarge.png";
/*
echo W*(0.5+0.25*sin(N/100*PI))-w/2;
echo $y_axis;
*/
//vhook for image water mark
$vhook_path='"'."vhook\\imlib2.dll"." -x ".$x_axis." -y ".$y_axis." -i ".$text_to_show.'"';
//vhook for text water mark
//$vhook_path='"'."/root/ffmpeg/ffmpeg/vhook/imlib2.so -R 210 -G 155 -B 200 "." -x ".$x_axis." -y ".$y_axis." -F ".$font_path." -t ".$texts_to_show.'"';
//echo $vhook_path."<br/>";
/// COMMAND EXECUTED IN DOS
/*C:\ffmpeg>ffmpeg -i Blaaskarwei.mpeg -ar 22050 -ab 32 -f flv -s 320x240 video.flv*/
/* FUNCTION PARAMETER DETAILS
-i input file name
-f output format
-ab audio bit rate in bit/s
-r frame rate in Hz for video
-s video output dimension / frame size / height and width / video resolution
-b video bit rate in kbit/s
-ar audio sampling rate (in Hz)
*/
// WORKING ENCODING COMMAND FOR ANY FORMATE FORMATE TO FLV (from AVI , from MPEG ) encoding:
//echo $ffmpegpath." -i ".$input_file." -r ".$r." -ab ".$ab." -ar ".$ar." -b ".$b." -f flv -s ".$output_width."x".$output_height." ".$output_file;
//exec($ffmpegpath." -i ".$input_file." -r ".$r." -ab ".$ab." -ar ".$ar." -b ".$b." -f flv -s ".$output_width."x".$output_height." ".$output_file);
// DOS WORKING watermark COMMAND FOR ANY FORMATE FORMATE TO FLV ( AVI , MPEG ) watermark image:
//C:\ffmpeg\bin>ffmpeg -i a.avi -vhook "c:/wamp/www/videos_proj/vid_encoding/ffmpeg/vhook/watermark.dll -m 1 -f logo.jpg" -ar 44100 testsss.flv
// DOS WO0RKING WATERMARK COMMAND FOR FLV TO FLV AND MPEG TO FLV watermark text:
//C:\ffmpeg\bin>ffmpeg -i asimkkk.flv -vhook "c:\wamp\www\videos_proj\vid_encoding\ffmpeg\vhook\imlib2.dll -R 210 -G 155 -B 200 -F arial.ttf/20 -x 10+0.5*N -y 10+0.25*N -t Hello" dewankkk.flv
// WORKING WATERMARK COMMAND FOR FLV TO FLV AND MPEG TO FLV watermark text:
//echo $ffmpegpath." -i ".$input_file." -vhook ".$vhook_path." ".$output_file;
exec($ffmpegpath." -i ".$input_file." -vhook ".$vhook_path." ".$output_file);
?>
</body>
</html>