IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

utilisation de FFmpeg


Sujet :

Langage PHP

  1. #1
    Membre à l'essai
    Homme Profil pro
    Inscrit en
    Décembre 2012
    Messages
    27
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Décembre 2012
    Messages : 27
    Points : 11
    Points
    11
    Par défaut utilisation de FFmpeg
    Bonjour,
    J'essaye d'utiliser ffmpeg pour simplement pour obtenir la duré de fichier, pour l'installation j'ai mis ffmpeg.exe dans mon system32 et sa a l'air de fonctionner en ligne de commande

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    C:\Users\xxx>ffmpeg.exe -i C:\\wamp\\www\\1.avi
    ffmpeg version N-49746-gda726a8-Sherpya Copyright (c) 2000-2013 the FFmpeg devel
    opers
      built on Feb  9 2013 16:31:31 with gcc 4.6 (GCC)
      configuration: --cross-prefix=i686-w64-mingw32- --arch=x86 --target-os=mingw32
     --enable-cross-compile --extra-version=Sherpya --enable-gpl --enable-version3 -
    -disable-ffplay --disable-ffserver --enable-postproc --enable-avfilter --enable-
    pthreads --enable-runtime-cpudetect --enable-hardcoded-tables --enable-memalign-
    hack --enable-avisynth --enable-libopencore-amrnb --enable-libopencore-amrwb --e
    nable-libtheora --enable-libfreetype --enable-libmp3lame --enable-libtwolame --e
    nable-libvorbis --enable-zlib --enable-bzlib --enable-libxvid --enable-libx264 -
    -enable-libspeex --enable-libfaac --enable-libvpx
      libavutil      52. 17.101 / 52. 17.101
      libavcodec     54. 91.102 / 54. 91.102
      libavformat    54. 61.104 / 54. 61.104
      libavdevice    54.  3.103 / 54.  3.103
      libavfilter     3. 36.100 /  3. 36.100
      libswscale      2.  2.100 /  2.  2.100
      libswresample   0. 17.102 /  0. 17.102
      libpostproc    52.  2.100 / 52.  2.100
    Input #0, avi, from 'C:\\wamp\\www\\1.avi':
      Metadata:
        encoder         : MEncoder 1.0rc2-4.2.4
      Duration: 00:42:31.32, start: 0.000000, bitrate: 1337 kb/s
        Stream #0:0: Video: mpeg4 (Simple Profile) (XVID / 0x44495658), yuv420p, 640
    x480 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
        Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 112 k
    b/s
    At least one output file must be specified
    Maintenant pour l'utiliser avec php je n'y arrive pas :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    echo var_dump(exec('ffmpeg.exe -i C:\\wamp\\www\\1.avi',$output,$var));
     
    echo var_dump($output); // Retourne rien
    echo '<br>';
    echo var_dump($var); // Retourne 1

  2. #2
    Membre expérimenté
    Homme Profil pro
    Développeur C++
    Inscrit en
    Avril 2012
    Messages
    771
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur C++
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2012
    Messages : 771
    Points : 1 631
    Points
    1 631
    Par défaut
    Bonsoir,

    essaye en donnant le chemin complet de ton fichier ffmpeg.exe :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    exec('C:\\path\\to\\ffmpeg.exe -i C:\\wamp\\www\\1.avi',$output,$var);
    une réponse vous a permis d'avancer ?

  3. #3
    Membre à l'essai
    Homme Profil pro
    Inscrit en
    Décembre 2012
    Messages
    27
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Décembre 2012
    Messages : 27
    Points : 11
    Points
    11
    Par défaut
    Sa me retourne la même chose.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    array
      empty
     
    int 1

  4. #4
    Membre averti

    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2011
    Messages
    205
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juin 2011
    Messages : 205
    Points : 409
    Points
    409
    Billets dans le blog
    1
    Par défaut
    Le code de retour 1 stocké dans $var signifie que ta commande génère une erreur.

    2>&1 permet de rediriger la sortie d'erreur vers la sortie standard, tu devrais donc avoir sur la raison du plantage avec ce code là :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
    $cmd = 'C:\\ton_chemin_vers\\ffmpeg.exe -i C:\\wamp\\www\\1.avi 2>&1';
    echo var_dump(exec($cmd, $output, $var));
    echo var_dump($output);
    si ce post vous a été utile, si votre problème est résolu.
    Pensez-y !
    __________________________________
    Doc officielle PHP | FAQ PHP | Cours PHP

  5. #5
    Membre à l'essai
    Homme Profil pro
    Inscrit en
    Décembre 2012
    Messages
    27
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Décembre 2012
    Messages : 27
    Points : 11
    Points
    11
    Par défaut
    Voila ce que cela m'affiche :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    string 'At least one output file must be specified' (length=42)
    array
      0 => string 'ffmpeg version N-49746-gda726a8-Sherpya Copyright (c) 2000-2013 the FFmpeg developers' (length=85)
      1 => string '  built on Feb  9 2013 16:31:31 with gcc 4.6 (GCC)' (length=50)
      2 => string '  configuration: --cross-prefix=i686-w64-mingw32- --arch=x86 --target-os=mingw32 --enable-cross-compile --extra-version=Sherpya --enable-gpl --enable-version3 --disable-ffplay --disable-ffserver --enable-postproc --enable-avfilter --enable-pthreads --enable-runtime-cpudetect --enable-hardcoded-tables --enable-memalign-hack --enable-avisynth --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libfreetype --enable-libmp3lame --enable-libtwolame --enable-libvorbis --enable-zlib --'... (length=609)
      3 => string '  libavutil      52. 17.101 / 52. 17.101' (length=40)
      4 => string '  libavcodec     54. 91.102 / 54. 91.102' (length=40)
      5 => string '  libavformat    54. 61.104 / 54. 61.104' (length=40)
      6 => string '  libavdevice    54.  3.103 / 54.  3.103' (length=40)
      7 => string '  libavfilter     3. 36.100 /  3. 36.100' (length=40)
      8 => string '  libswscale      2.  2.100 /  2.  2.100' (length=40)
      9 => string '  libswresample   0. 17.102 /  0. 17.102' (length=40)
      10 => string '  libpostproc    52.  2.100 / 52.  2.100' (length=40)
      11 => string '[mp3 @ 0216CA40] max_analyze_duration 5000000 reached at 5015510 microseconds' (length=77)
      12 => string '[mp3 @ 0216CA40] Estimating duration from bitrate, this may be inaccurate' (length=73)
      13 => string 'Input #0, mp3, from 'C:\wamp\www\1.mp3':' (length=40)
      14 => string '  Metadata:' (length=11)
      15 => string '    encoded_by      : Lavf52.16.0' (length=33)
      16 => string '  Duration: 00:03:11.01, start: 0.000000, bitrate: 127 kb/s' (length=59)
      17 => string '    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s' (length=61)
      18 => string 'At least one output file must be specified' (length=42)

  6. #6
    Membre averti

    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2011
    Messages
    205
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Juin 2011
    Messages : 205
    Points : 409
    Points
    409
    Billets dans le blog
    1
    Par défaut
    Bon bah voilà, tu as ton erreur maintenant
    string 'At least one output file must be specified' (length=42)
    A toi de faire des tests / voir pourquoi il ne trouve pas le fichier.
    Tu as aussi de la doc sur le site officiel de FFmpeg => http://ffmpeg.org/trac/ffmpeg/wiki/U...0PHP%20scripts
    si ce post vous a été utile, si votre problème est résolu.
    Pensez-y !
    __________________________________
    Doc officielle PHP | FAQ PHP | Cours PHP

  7. #7
    Membre à l'essai
    Homme Profil pro
    Inscrit en
    Décembre 2012
    Messages
    27
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Décembre 2012
    Messages : 27
    Points : 11
    Points
    11
    Par défaut
    Donc a chaque fois que je dois utiliser ffmpeg je dois spécifié un fichier de sortie , même si je ne souhaite que avoir des informations sur celui-ci ?

Discussions similaires

  1. Utilisation de FFMPEG avec Tcl
    Par AlexDD dans le forum Tcl/Tk
    Réponses: 2
    Dernier message: 06/12/2012, 02h59
  2. Utilisation de FFMPEG
    Par Electroniktor dans le forum Bibliothèques
    Réponses: 4
    Dernier message: 22/06/2011, 10h35
  3. utilisation ffmpeg site web
    Par asus02 dans le forum Débuter
    Réponses: 0
    Dernier message: 31/01/2011, 18h04
  4. [FFmpeg] Comment l'utiliser avec visual studio
    Par ilovechocolat dans le forum Bibliothèques
    Réponses: 0
    Dernier message: 26/11/2009, 20h48
  5. [Newbie] utilisation de ffmpeg
    Par grabriel dans le forum API graphiques
    Réponses: 13
    Dernier message: 11/06/2008, 21h09

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo