4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
August 18, 2018, 01:57:51 PM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Requests & Discussions) (Moderators: mawenzi, Rembrandt)
| | |-+  Using ffmpeg to generate uploaded video thumbnails
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 5 6 » »» Print
Author Topic: Using ffmpeg to generate uploaded video thumbnails  (Read 90102 times)
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« on: March 24, 2006, 10:39:55 AM »

Hello All !!

Let me start my first post with a Congratulations on a fantastic system... I Have performed various mods and on the most part they were quite easy to configure.

There is one item missing for me which is the generation of thumbnails from video files. Searching through the forum has lead to a couple posts about this topic, but none that actually suggest the use of ffmpeg as the tool to save the day  Laughing

I've tried to investigate the ImageMagick and GD2 solutions but both of them appear to not really support video too well.

From analyzing ffmpeg and testing it from the command line - it appears to generate a thumbnail from quite a range of different video sources.

Here is where i need help. i have the command required to generate the thumbnail - BUT i don't know where to put it. Rolling Eyes


The command i use is

1
ffmpeg -i 1.mpg -f singlejpeg -t 0.001 1.jpg

The only variables that would need to pass to it are the exe location, source video file & destination thumbnail name

I think the best implementation of it would be the same way that ImageMagick is handled in the system:
1. Control panel asks for the location of the .exe
2. extensions are associated to it
3. the command gets executed the same time as normal images are handled.

Considdering the great demand for video these days, i think it should be considdered as a standard feature of 4Images (Just like Imagemagick).

I Am using 4I 1.7.2 (with a couple cool mods  Cool )

Can anybody do this?

Cheers,
WeZ
Logged
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #1 on: March 27, 2006, 01:23:18 PM »

Hi All,

I think to acheive this i need to modify the admin/checkimages.php file?

Has anybody got a clue on where i can even start?

Thanks
Logged
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: March 27, 2006, 09:41:17 PM »

Hi All,

Please can someone help me...

I placed the ffmpeg binary into the system32 dir and also the 4images root.

I created this code
1
2
3
4
5
6
7
function Generate_VideoThumb($src, $dest) {
  global $convert_options;

  $command = "ffmpeg -i ".$src." -f singlejpeg -t 0.001 ".$dest;
  system($command);
  return (file_exists($dest)) ? 1 : 0;
}

and placed it into image_utils.php

i also changed

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22

function create_thumbnail($src, $dest, $quality, $dimension, $resize_type) {
  global $convert_options;

  if (file_exists($dest)) {
    @unlink($dest);
  }
  $image_info = (defined("IN_CP")) ? getimagesize($src) : @getimagesize($src);
 if (!$image_info) {
    return false;
  }
  $width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
  $resize_handle = "resize_image_".$convert_options['convert_tool'];
  if ($resize_handle($src, $dest, $quality, $width_height['width'], $width_height['height'], $image_info)) {
    @chmod($dest, CHMOD_FILES);
    return true;
  }
  else {
    return false;
  }
}


to

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function create_thumbnail($src, $dest, $quality, $dimension, $resize_type) {
  global $convert_options;

  if (file_exists($dest)) {
    @unlink($dest);
  }
  $image_info = (defined("IN_CP")) ? getimagesize($src) : @getimagesize($src);
   if (!$image_info) {
  if ($Generate_VideoThumb($src, $dest)) {
return true;
}
else {
    return false;
    }
  }
  $width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
  $resize_handle = "resize_image_".$convert_options['convert_tool'];
  if ($resize_handle($src, $dest, $quality, $width_height['width'], $width_height['height'], $image_info)) {
    @chmod($dest, CHMOD_FILES);
    return true;
  }
  else {
    return false;
  }
}

Please can someone tell me why it is not working??
Logged
IcEcReaM
Hero Member
*****
Offline Offline

Posts: 714

Thank You
-Given: 0
-Receive: 3


View Profile WWW
« Reply #3 on: March 27, 2006, 10:48:36 PM »

try to replace this:
1
if ($Generate_VideoThumb($src, $dest)) {

with this
1
if (Generate_VideoThumb($src, $dest)) {

in your image_utils.php

Logged

Coding is a everlasting competition between programmers who tries to write larger, better and idiot-safe programs and the universe producing larger and stupider idiots...
...so far the universe won
bump
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« Reply #4 on: March 28, 2006, 04:05:16 AM »

and unless ffmpeg is registered in the system, you will need add full path to it. i.e. C:\\WINDOWS\\SYSTEM32\\ffmpeg.exe
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #5 on: March 28, 2006, 09:34:56 AM »

Hello  IcEcReaM and V@no !!

From all the posts i've read on this forum, my help could'nt have come in a better form than you 2...


From both of your valuable Input I have changed the blocks of code to read:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function create_thumbnail($src, $dest, $quality, $dimension, $resize_type) {
  global $convert_options;

  if (file_exists($dest)) {
    @unlink($dest);
  }
  $image_info = (defined("IN_CP")) ? getimagesize($src) : @getimagesize($src);
  if (!$image_info) {
  if (Generate_VideoThumb($src, $dest)) {
return true;
}
else {
    return false;
    }
  }
  $width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
  $resize_handle = "resize_image_".$convert_options['convert_tool'];
  if ($resize_handle($src, $dest, $quality, $width_height['width'], $width_height['height'], $image_info)) {
    @chmod($dest, CHMOD_FILES);
    return true;
  }
  else {
    return false;
  }
}

and

1
2
3
4
5
6
7
function Generate_VideoThumb($src, $dest) {
  global $convert_options;

  $command = "C:\\WINDOWS\\SYSTEM32\\ffmpeg.exe -i ".$src." -f singlejpeg -t 0.001 ".$dest;
  system($command);
  return (file_exists($dest)) ? 1 : 0;
}

I Have a feeling that there is someplace else that needs a little code because right now, I'm not even sure if it is being executed as i'm not getting any errors or anything...

hang on... Let me check the logs...

ok, I've attached a text file of what was found in my server logs...

There is no Line 223 in my image_utils.php and i have attached my admin_functions for your perusal...

How can i debug this Function? Rolling Eyes


Once again, thanks for your help...

WeZ

* log-errors.txt (3.38 KB - downloaded 371 times.)
* admin_functions.php.txt (25.76 KB - downloaded 383 times.)
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« Reply #6 on: March 28, 2006, 09:42:02 AM »

debug is easy:
instead of system($command); use: echo $command;
then if it print something on the screen copy it and then paste it in the command prompt (you might need replace \\ with only single back slash)
and see if it create the screenshot.
If it didnt print anything, then you know the function wasnt executed.

as of errors, you must have added a space/newline, whatever before <?php or after ?> in image_utils.php
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #7 on: March 28, 2006, 10:37:38 AM »

Hi V@no,

thanks for the speedy reply...

debug is easy:
instead of system($command); use: echo $command;
then if it print something on the screen copy it and then paste it in the command prompt (you might need replace \\ with only single back slash)
and see if it create the screenshot.
If it didnt print anything, then you know the function wasnt executed.

Correct, it did not print anything...

as of errors, you must have added a space/newline, whatever before <?php or after ?> in image_utils.php

This this i did by mistake yesterday - I used the section after the "?>" as a scratchpad to write my code before inserting it into the function... this was rectified yesterday already so i guess these errors are old...

not sure if i'm happy or sad to not get any errors...  Neutral

Anyway... i did some more testing and found that if i put echo code into the  if (!$image_info) query:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
function create_thumbnail($src, $dest, $quality, $dimension, $resize_type) {
  global $convert_options;

  if (file_exists($dest)) {
    @unlink($dest);
  }
  $image_info = (defined("IN_CP")) ? getimagesize($src) : @getimagesize($src);
  if (!$image_info) {
  if (Generate_VideoThumb($src, $dest)) {
echo $src.$dest;
return true;
}
else {
echo $src.$dest;
    return false;
    }
  }
  $width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
  $resize_handle = "resize_image_".$convert_options['convert_tool'];
  if ($resize_handle($src, $dest, $quality, $width_height['width'], $width_height['height'], $image_info)) {
    @chmod($dest, CHMOD_FILES);
    return true;
  }
  else {
    return false;
  }
}

it still did not output anything... so i put an echo outside the query as well like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
function create_thumbnail($src, $dest, $quality, $dimension, $resize_type) {
  global $convert_options;

  if (file_exists($dest)) {
    @unlink($dest);
  }
  $image_info = (defined("IN_CP")) ? getimagesize($src) : @getimagesize($src);
  if (!$image_info) {
  if (Generate_VideoThumb($src, $dest)) {
echo $src.$dest;
return true;
}
else {
echo $src.$dest;
    return false;
    }
  }
  echo $src.$dest;
  $width_height = get_width_height($dimension, $image_info[0], $image_info[1], $resize_type);
  $resize_handle = "resize_image_".$convert_options['convert_tool'];
  if ($resize_handle($src, $dest, $quality, $width_height['width'], $width_height['height'], $image_info)) {
    @chmod($dest, CHMOD_FILES);
    return true;
  }
  else {
    return false;
  }
}

and my results were that i did not get an output for video files but on an uploaded image i got this echoed output:
Quote  [Expand]
./data/media/1/alpha9.jpg./data/thumbnails/1/alpha9.jpg

so i would say that when uploading a video it is not even calling the "create_thumbnail" function at all?

Anyplace else i should be editing code?

Kind Regards,
Wesley.
« Last Edit: March 28, 2006, 11:22:20 AM by WeZ » Logged
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #8 on: March 28, 2006, 03:51:06 PM »

Hello All,

Bit of a breakthrough, but not there yet...

If i changed this code on member.php

from

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    // Uplad thumb file
    $new_thumb_name = "";
    if (!empty($HTTP_POST_FILES['thumb_file']['tmp_name']) && $HTTP_POST_FILES['thumb_file']['tmp_name'] != "none" && !$uploaderror) {
      $new_thumb_name = $site_upload->upload_file("thumb_file", "thumb", $upload_cat, basename($new_name));
      if (!$new_thumb_name) {
        $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['thumb_upload_error'].": ".$new_thumb_name."</b><br />".$site_upload->get_upload_errors();
        @unlink(MEDIA_TEMP_PATH."/".$new_name);
        $uploaderror = 1;
      }
    }
    elseif (check_remote_thumb($remote_thumb_file)) {
      $new_thumb_name = $remote_thumb_file;
    }
    elseif ($config['auto_thumbnail'] == 1 && !empty($HTTP_POST_FILES['media_file'.$fileext]['tmp_name']) && $HTTP_POST_FILES['media_file'.$fileext]['tmp_name'] != "none" && !$uploaderror) {
      if ($direct_upload) {
        $src = MEDIA_PATH."/".$cat_id."/".$new_name;
        $dest = THUMB_PATH."/".$cat_id."/".$new_name;
      }
      else {
        $src = MEDIA_TEMP_PATH."/".$new_name;
        $dest = THUMB_TEMP_PATH."/".$new_name;
      }
      $do_create = 0;
      if ($image_info = @getimagesize($src)) {
        if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {
          $do_create = 1;
        }
      }
      if ($do_create) {
        require_once(ROOT_PATH.'includes/image_utils.php');
        $convert_options = init_convert_options();
        if (!$convert_options['convert_error']) {
          $dimension = (intval($config['auto_thumbnail_dimension'])) ? intval($config['auto_thumbnail_dimension']) : 100;
          $resize_type = (intval($config['auto_thumbnail_resize_type'])) ? intval($config['auto_thumbnail_resize_type']) : 1;
          $quality = (intval($config['auto_thumbnail_quality']) && intval($config['auto_thumbnail_quality']) <= 100) ? intval($config['auto_thumbnail_quality']) : 100;

          if (create_thumbnail($src, $dest, $quality, $dimension, $resize_type)) {
            $new_thumb_name = $new_name;
          }
        }
      }
    }

    if (!$uploaderror) {
      $additional_field_sql = "";
      $additional_value_sql = "";
      if (!empty($additional_image_fields)) {
        $table = ($direct_upload) ? IMAGES_TABLE : IMAGES_TEMP_TABLE;
        $table_fields = $site_db->get_table_fields($table);
        foreach ($additional_image_fields as $key => $val) {
          if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
            $additional_field_sql .= ", $key";
            $additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
          }
        }
      }

to

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
    // Uplad thumb file
    $new_thumb_name = "";
    if (!empty($HTTP_POST_FILES['thumb_file']['tmp_name']) && $HTTP_POST_FILES['thumb_file']['tmp_name'] != "none" && !$uploaderror) {
      $new_thumb_name = $site_upload->upload_file("thumb_file", "thumb", $upload_cat, basename($new_name));
      if (!$new_thumb_name) {
        $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['thumb_upload_error'].": ".$new_thumb_name."</b><br />".$site_upload->get_upload_errors();
        @unlink(MEDIA_TEMP_PATH."/".$new_name);
        $uploaderror = 1;
      }
    }
    elseif (check_remote_thumb($remote_thumb_file)) {
      $new_thumb_name = $remote_thumb_file;
    }
    elseif ($config['auto_thumbnail'] == 1 && !empty($HTTP_POST_FILES['media_file'.$fileext]['tmp_name']) && $HTTP_POST_FILES['media_file'.$fileext]['tmp_name'] != "none" && !$uploaderror) {
      if ($direct_upload) {
        $src = MEDIA_PATH."/".$cat_id."/".$new_name;
        $dest = THUMB_PATH."/".$cat_id."/".$new_name;
      }
      else {
        $src = MEDIA_TEMP_PATH."/".$new_name;
        $dest = THUMB_TEMP_PATH."/".$new_name;
      }
      $do_create = 0;
      if ($image_info = @getimagesize($src)) {
        if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {
          $do_create = 1;
        }
      }
      require_once(ROOT_PATH.'includes/image_utils.php');
      $convert_options = init_convert_options();
      if ($do_create) {
        if (!$convert_options['convert_error']) {
          $dimension = (intval($config['auto_thumbnail_dimension'])) ? intval($config['auto_thumbnail_dimension']) : 100;
          $resize_type = (intval($config['auto_thumbnail_resize_type'])) ? intval($config['auto_thumbnail_resize_type']) : 1;
          $quality = (intval($config['auto_thumbnail_quality']) && intval($config['auto_thumbnail_quality']) <= 100) ? intval($config['auto_thumbnail_quality']) : 100;

          if (create_thumbnail($src, $dest, $quality, $dimension, $resize_type)) {
            $new_thumb_name = $new_name;
          }
          }
        }
      else {
if (Generate_VideoThumb($src, $dest)) {
return true;
}
else {
return false;
}
      }
  }

    if (!$uploaderror) {
      $additional_field_sql = "";
      $additional_value_sql = "";
      if (!empty($additional_image_fields)) {
        $table = ($direct_upload) ? IMAGES_TABLE : IMAGES_TEMP_TABLE;
        $table_fields = $site_db->get_table_fields($table);
        foreach ($additional_image_fields as $key => $val) {
          if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
            $additional_field_sql .= ", $key";
            $additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
          }
        }
      }

And It WORKS!! however as you can see from my server logs (and checking on the disk verifies this):
1
2
3
4
5
6
7
8
9
frame= 1 q=1.6 Lsize= 2kB time=0.0 bitrate= 426.6kbits/s
Stream #0.0 -> #0.0
Stream mapping:
Stream #0.0: Video: mjpeg, 352x288, 25.00 fps, q=2-31, 200 kb/s
Output #0, singlejpeg, to './data/thumbnails/4/gymnastics_3.mpg':
Stream #0.1: Audio: mp2, 44100 Hz, stereo, 128 kb/s
Stream #0.0: Video: mpeg1video, 352x288, 25.00 fps
Duration: 00:00:23.4, bitrate: 674 kb/s
Input #0, mpeg, from './data/media/4/gymnastics_3.mpg':

The problem as you can see is that the "$dest" variable i am passing the command has an extension of the file i.e. in this case $dest = "/data/thumbnails/4/gymnastics_3.mpg" and hence ffmpeg created a thumbnail with an mpg extension.

I think the best option would be in my code below:
1
2
3
4
5
6
7
function Generate_VideoThumb($src, $dest) {
  global $convert_options;

  $command = "C:\\WINDOWS\\SYSTEM32\\ffmpeg.exe -i ".$src." -f singlejpeg -t 0.001 ".$dest;
  system($command);
  return (file_exists($dest)) ? 1 : 0;
}
to insert a line of code that replaces the last 3 chars of $dest with "jpg"

Somebody able to help me with this?
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« Reply #9 on: March 28, 2006, 03:59:34 PM »

ok, first of all, there is no return in member.php
second, try replace
1
2
3
4
5
6
if (Generate_VideoThumb($src, $dest)) {
return true;
}
else {
return false;
}
with:
1
2
3
if (in_array(get_file_extension($new_name), array("mpg", "mpeg", "avi")) && Generate_VideoThumb($src, $dest.".jpg")) {
  $new_thumb_name = $new_name.".jpg";
}
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #10 on: March 28, 2006, 04:51:14 PM »

Hi V@no,

ok, first of all, there is no return in member.php

What do you mean?
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« Reply #11 on: March 29, 2006, 02:05:23 AM »

I ment, you have return true; / return false; in member.php. where were you trying to return? its not a function Wink and theoreticaly it should be equal to exit or die()...(I might be wrong about the last Wink)
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #12 on: March 29, 2006, 07:56:54 PM »

Hey V@no,

Just an update - thanks to your code you gave me (without the return  Wink) ... things have been moving smoothly...

i got it all to work quite nicely, however ffmpeg seems to be really short on codecs. what makes it more difficult is that it does not use the built in codec staore that windows media player would use...

it has to be built with all codecs availalbe etc etc etc... what a mission...

i have changed to use mplayer and that seems to work quite nicely... so far it has converted every video i have thrown at it...

it's a bit of a hack, but here is the code:
1
2
3
4
5
6
7
8
9
function Generate_VideoThumb($src, $dest) {
  global $convert_options;
  $command = "C:\\mplayer\\mplayer.exe ".$src." -ss 00:00:05 -nosound -vo jpeg:smooth=75 -vop scale=120:80 -frames 1 > imagegenoutput.txt";
  system($command);
  unlink("00000001.jpg");
  unlink("imagegenoutput.txt");
  rename("00000002.jpg",$dest);
  return (file_exists($dest)) ? 1 : 0;
}

the reason i output to imagegenoutput.txt is coz the bloody program echo's the result regardless of how i try and beat it to submission...

i also can't get it to only generate 1 thumbnail - hence the unlink on 00000001.jpg

also you can't specify the file name (it creates it for you) - hence why i do this rename buggerup...


as i said, it's a bit of a hack, but at least my video's are coming in nicely  Very Happy  Very Happy  Very Happy

my upload and multiupload is working fine, I am currently tackling the batch import mod to cater for video (i might be out my depth here  Confused )

Anyway, just my .02 worth...

Cheers
WeZ
Logged
WeZ
Jr. Member
**
Offline Offline

Posts: 72

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #13 on: April 13, 2006, 07:10:35 PM »

Hi All,

Just a quick one from a newbie...

with my command below, how to i place a " around the $src ?

1
$command = "C:\\mplayer\\mplayer.exe ".$src." -ss 00:00:05 -nosound -vo jpeg:smooth=75 -vop scale=120:80 -frames 1 > imagegenoutput.txt";

The code above works for any file without any spaces, but how to i put a " in the command string without it terminating the string?

hope you get what im on about?

Cheers
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 577

mmm PHP...


View Profile WWW
« Reply #14 on: April 14, 2006, 01:01:25 AM »

just escape them with a backslash:[qcode]$command = "C:\\mplayer\\mplayer.exe \"".$src."\" -ss 00:00:05 -nosound -vo jpeg:smooth=75 -vop scale=120:80 -frames 1 > imagegenoutput.txt";[/qcode]
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
Pages: [1] 2 3 4 5 6 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.057 seconds with 19 queries.
Post your comments here