FFMPEG already installed on my server LINUX but how to....

Started on the old forum in February 2011 · view the original in the archive · old links redirect here

10 replies · 1,651 views · started 15 years ago · 1 min read

TL;DR · summary of 10 replies
  • -leadiztah needed to find the correct path for ffmpeg on his Linux server and replace '/usr/local/bin/ffmpeg' with 'usr/bin/ffmpeg'.
  • -subzero advised reading PHP documentation, but leadiztah's code still didn't work.
  • -leadiztah provided more details about ffmpeg being enabled in phpinfo(), indicating it should be working but the script wasn't producing expected results.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

4 participants
leadiztah Developer · 55 posts #1

how to use it on my script?..

this script work with my XAMMP. this require FFMPEG.EXE but .exe is not working on linux, .exe is only for WINDOWS may panel is LINUX HERE's the CODE this script is to give SCREENSHOT on the video

<?php

    $ffmpeg = 'ffmpeg.exe';

    // change "demo.mpg" to your mpg file name!
    $video  = dirname(__FILE__) . "\demo.3gp";

    // change "demo.jpg" to whichever name you like or don't
    // for this example, the name of the output jpg file does not matter
    $image  = dirname(__FILE__) . "\demo.jpg";

    $second = 1;

    $cmd = "$ffmpeg -i $video 2>&1";
    if (preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) {
        $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
        $second = rand(1, ($total - 1));
    }

    $cmd = "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";
    $return = `$cmd`;

    echo 'done!';

?>

If ffMPEG is already installed on my server.. so how to use it on my given script?

PLEASE HELP ME!!!

subzero Super moderator Fellow · 3,954 posts #2

Code it next time !!!

$ffmpeg = '/usr/local/bin/ffmpeg';

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

morency Senior · 488 posts #3

replace ffmpeg.exe with path to ffmpeg on your server e.g. usr/bin/ffmpeg

Unamos los corazones,hoy todos somos multicolores!

leadiztah Developer · 55 posts #4

ok thx you so much 🙂

Added after 33 minutes:

your given location not work..

maybe i contact my host about this ffmpeg location of the server

leadiztah Developer · 55 posts #5

my host that the exact path is usr/bin/ffmpeg

so i try this code

<?php

    $ffmpeg = '/usr/bin/ffmpeg';

    // change "demo.mpg" to your mpg file name!
    $video  = dirname(__FILE__) . "\demo.3gp";

    // change "demo.jpg" to whichever name you like or don't
    // for this example, the name of the output jpg file does not matter
    $image  = dirname(__FILE__) . "\demo.jpg";

    $second = 1;

    $cmd = "$ffmpeg -i $video 2>&1";
    if (preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) {
        $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
        $second = rand(1, ($total - 1));
    }

    $cmd = "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";
    $return = `$cmd`;

    echo 'done!';    

?>

IT DOESN'T WORK 🙁

subzero Super moderator Fellow · 3,954 posts #6

Have you tryed

reading php ??

like for one

ffmpeg

<?php phpinfo(); ?>

go and see ffmpeg

if you see

ffmpegffmpeg-php version 0.6.3 ffmpeg-php built on Jan 23 2011 23:40:37 ffmpeg-php gd support disabled ffmpeg libavcodec version Lavc52.100.0 ffmpeg libavformat version Lavf52.88.0 ffmpeg swscaler version SwS0.12.0

Means you need to

exec("cmd");

Added after 2 minutes:

Last warning

Code or PHP CODE your inputs of a script !!

Or i will not help you any more !

i getting mad and madder each time i have to unnoob you from looking like a total idiot......

understand??

coding or php your script will make it easyer to read !!

UNDERSTAND !!

Visit: Chat4u.mobi - The New Lay Of being a site of your dreams! Visit: WapMasterz Coming Back Soon!


SCRIPTS FOR SALE BY SUBZERO Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders. FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others... _______…

leadiztah Developer · 55 posts #7

thx for that information subzero

sorry i dont know where is the code to input.. but i explore it next time

Added after 4 minutes:

ffmpeg

this is the FFMPEG information from phpinfo();

ffmpeg-php version 0.6.0-svn ffmpeg-php built on Aug 20 2010 22:46:56 ffmpeg-php gd support enabled ffmpeg libavcodec version Lavc52.20.1 ffmpeg libavformat version Lavf52.31.0 ffmpeg swscaler version SwS0.7.1

it says that it is enabled 🙁 so what should i do.

firemax Developer · 221 posts #8
<?php 

    $ffmpeg = '/usr/bin/ffmpeg'; 

    // change "demo.mpg" to your mpg file name! 
    $video  = dirname(__FILE__) . "/demo.3gp"; 

    // change "demo.jpg" to whichever name you like or don't 
    // for this example, the name of the output jpg file does not matter 
    $image  = dirname(__FILE__) . "/demo.jpg"; 

    $second = 1; 

    $cmd = "$ffmpeg -i $video 2> 'testlog_1.txt'"; 
    if (preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) { 
        $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4]; 
        $second = rand(1, ($total - 1)); 
    } 

    $cmd = "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2> 'testlog_2.txt'"; 
    $return = `$cmd`; 

    echo 'done!';     

?>

this script will write a ffmpeg log file in current directory. run this code, then check for 'testlog_1.txt' and 'testlog_2.txt' files & post them here.

External image (may be gone) Free Mobile Web Scripts by me: Free Youtube Downloader, Tweets Reader, Facebook Wall Posts Reader PHP Tutorials: [How to Secure Your PHP Script (PHP SECURITY)](http://coding-talk.com/f14/how-to-secure-you…

leadiztah Developer · 55 posts #9
<?php 

    $ffmpeg = '/usr/bin/ffmpeg'; 

    // change "demo.mpg" to your mpg file name! 
    $video  = dirname(__FILE__) . "\demo.3gp"; 

    // change "demo.jpg" to whichever name you like or don't 
    // for this example, the name of the output jpg file does not matter 
    $image  = dirname(__FILE__) . "\demo.jpg"; 

    $second = 1; 

    $cmd = "$ffmpeg -i $video 2>&1"; 
    if (preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time)) { 
        $total = ($time[2] * 3600) + ($time[3] * 60) + $time[4]; 
        $second = rand(1, ($total - 1)); 
    } 

    $cmd = "$ffmpeg -i $video -deinterlace -an -ss $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2> 'testlog.txt'"; 
    $return = `$cmd`; 

    echo 'done!';     

?>

no LOG FILE created on that directory :((

please help me..

i installed that script in /public_html/ffmpeg of my HOST as index.php

when you go to that directory you will see a text "DONE!!";

and the script will run according to its FUNCTION..

they have a demo.3gp on that directory.

the result: it will produce demo.jpg on that directory..

HELP!!!!!!!!!!!!!!!!!!

leadiztah Developer · 55 posts #10

I noticed that they produced textlog if they produce DEMO.JPG

here is the example DEMO from my LOCALHOST server on my computer

FFmpeg version SVN-r12665, Copyright (c) 2000-2008 Fabrice Bellard, et al. configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilter-lavf --enable-pthreads --enable-liba52 --enable-avisynth --enable-libfaac --enable-libfaad --enable-libgsm --enable-memalign-hack --enable-libmp3lame --enable-libnut --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --cpu=i686 --extra-ldflags=-static libavutil version: 49.6.0 libavcodec version: 51.54.0 libavformat version: 52.13.0 libavdevice version: 52.0.0 built on Apr 2 2008 22:35:11, gcc: 4.2.3 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\xampp\htdocs\ffmpeg/demo.3gp': Duration: 00:00:07.6, start: 0.000000, bitrate: 144 kb/s Stream #0.0(eng): Video: h263, yuv420p, 176x144 [PAR 12:11 DAR 4:3], 29.97 tb(r) Stream #0.1(eng): Audio: samr / 0x726D6173, 8000 Hz, mono Must supply at least one output file

and here is textlog_2.txt

FFmpeg version SVN-r12665, Copyright (c) 2000-2008 Fabrice Bellard, et al. configuration: --enable-gpl --enable-postproc --enable-swscale --enable-avfilter-lavf --enable-pthreads --enable-liba52 --enable-avisynth --enable-libfaac --enable-libfaad --enable-libgsm --enable-memalign-hack --enable-libmp3lame --enable-libnut --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --cpu=i686 --extra-ldflags=-static libavutil version: 49.6.0 libavcodec version: 51.54.0 libavformat version: 52.13.0 libavdevice version: 52.0.0 built on Apr 2 2008 22:35:11, gcc: 4.2.3 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C:\xampp\htdocs\ffmpeg/demo.3gp': Duration: 00:00:07.6, start: 0.000000, bitrate: 144 kb/s Stream #0.0(eng): Video: h263, yuv420p, 176x144 [PAR 12:11 DAR 4:3], 29.97 tb(r) Stream #0.1(eng): Audio: samr / 0x726D6173, 8000 Hz, mono Output #0, mjpeg, to 'C:\xampp\htdocs\ffmpeg/demo.jpg': Stream #0.0(eng): Video: mjpeg, yuvj420p, 176x144 [PAR 12:11 DAR 4:3], q=2-31, 200 kb/s, 1.00 tb(c) Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop encoding frame= 1 fps= 0 q=3.1 Lsize= 4kB time=1.0 bitrate= 29.4kbits/s

video:4kB audio:0kB global headers:0kB muxing overhead 0.000000%

That is from my XAMMP server.

but how on my server LINUX? 🙁

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close