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

Bibliothèques Discussion :

installation de ffmpeg


Sujet :

Bibliothèques

  1. #1
    Membre habitué Avatar de Watier_53
    Profil pro
    Étudiant
    Inscrit en
    Novembre 2007
    Messages
    469
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2007
    Messages : 469
    Points : 140
    Points
    140
    Par défaut installation de ffmpeg
    Bonjour, je veux utiliser ffmpeg j'ai donc télécharger les sources sur http://ffmpeg.mplayerhq.hu/ et ensuite j'ai fait les 3 étapes suivantes :

    ./configure
    make
    make install

    ffmpeg fonctionne en ligne de commande mais qd je me fait un petit programme en c avec la ligne de compilation suivante :

    g++ -o avcodec_sample avcodec_sample.cpp -lavformat -lavcodec -lz

    il me trouve pas le header avcodec.h et avformat.h

    je ne sais pas comment faire pour avoir accès à cette librairie

  2. #2
    Membre habitué Avatar de Watier_53
    Profil pro
    Étudiant
    Inscrit en
    Novembre 2007
    Messages
    469
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2007
    Messages : 469
    Points : 140
    Points
    140
    Par défaut
    j'ai ma réponse ffmpeg/avicodec.h et ça marche
    Par contre je suis perdu avec cette librairie quelqu'un aurait-il des infos ?

    Je veux a partir d'uneliste d'image de type Image de la librairie imageMagick créer une vidéo à l'aide de ffmpeg. Mais je vois pas ce que je dis utiliser l'api est tres difficilement compréhensible !!!

    http://cekirdek.pardus.org.tr/~ismai...ocs/index.html

    Merci

  3. #3
    Membre éclairé
    Avatar de mamelouk
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    867
    Détails du profil
    Informations personnelles :
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Mai 2005
    Messages : 867
    Points : 810
    Points
    810
    Par défaut
    salut,

    essaye de décomposer ton problème: charge des images depuis une vidéo à l'aide de ffmpeg, puis cree une vidéo à partir de ces images.

    et enfin, ton second problème c'est de creer une image dans le format ffmpeg avec une image au format imagemagick.

    y'a un très bon tutorial de l'utilisation de ffmpeg sur le net (utilise google pour le retrouver). j'ai récupéré l'exemple et j'en ai fait une classe c++ :

    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
    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
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    // A small sample program that shows how to use libavformat and libavcodec to
    // read video from a file.
     
    #include <string>
    #include <iostream>
    #include <stdexcept>
     
    #include <ffmpeg/avcodec.h>
    #include <ffmpeg/avformat.h>
     
    #include <Data/VideoParser.hpp>
     
    using namespace std;
    using namespace caviar;
     
    string VideoParser::SaveFrame(AVFrame *pFrame, int width, int height) {
        FILE *pFile;
        char szFilename[32];
        int y;
     
        // Open file
        sprintf(szFilename, "frame.ppm");
        pFile=fopen(szFilename, "wb");
        if (pFile==NULL)
            throw runtime_error("Could not open file (VideoParser::SaveFrame)");
     
        // Write header
        fprintf(pFile, "P6\n%d %d\n255\n", width, height);
     
        // Write pixel data
        for (y=0; y<height; y++)
            fwrite(pFrame->data[0]+y*pFrame->linesize[0], 1, width*3, pFile);
     
        // Close file
        fclose(pFile);
        return szFilename;
    }
     
    VideoParser::VideoParser(const string& filename) {
     
        // Register all formats and codecs
        av_register_all();
     
        // Open video file
        if (av_open_input_file(&pFormatCtx, filename.c_str(), NULL, 0, NULL)!=0)
            throw runtime_error("Couldn't open file");
     
        // Retrieve stream information
        if (av_find_stream_info(pFormatCtx)<0)
            throw runtime_error("Couldn't find stream information");
     
        // Dump information about file onto standard error
        dump_format(pFormatCtx, 0, filename.c_str(), 0);
     
        // Find the first video stream
        videoStream=-1;
        for (int i=0; i<pFormatCtx->nb_streams; i++)
            if (pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) {
                videoStream=i;
                break;
            }
        if (videoStream==-1)
            throw runtime_error("Didn't find a video stream");
     
        // Get a pointer to the codec context for the video stream
        pCodecCtx=pFormatCtx->streams[videoStream]->codec;
     
        // Find the decoder for the video stream
        pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
        if (pCodec==NULL) {
            cerr << "Unsupported codec!\n";
            throw runtime_error("Codec not found");
        }
        // Open codec
        if (avcodec_open(pCodecCtx, pCodec)<0)
            throw runtime_error("Could not open codec");
     
        // Allocate video frame
        pFrame=avcodec_alloc_frame();
     
        // Allocate an AVFrame structure
        pFrameRGB=avcodec_alloc_frame();
        if (pFrameRGB==NULL)
            throw runtime_error("Allocation problem");
     
        // Determine required buffer size and allocate buffer
        numBytes=avpicture_get_size(PIX_FMT_RGB24, pCodecCtx->width,
                pCodecCtx->height);
        buffer=(uint8_t *)av_malloc(numBytes*sizeof(uint8_t));
     
        // Assign appropriate parts of buffer to image planes in pFrameRGB
        // Note that pFrameRGB is an AVFrame, but AVFrame is a superset
        // of AVPicture
        avpicture_fill((AVPicture *)pFrameRGB, buffer, PIX_FMT_RGB24,
                pCodecCtx->width, pCodecCtx->height);
    }
     
    string VideoParser::getFrame() {
        int frameFinished=0;
        string frameFilename("");
     
        while (!frameFinished) {
            if (av_read_frame(pFormatCtx, &packet)>=0) {
                // Is this a packet from the video stream?
                if (packet.stream_index==videoStream) {
                    // Decode video frame
                    avcodec_decode_video(pCodecCtx, pFrame, &frameFinished,
                            packet.data, packet.size);
     
                    // Did we get a video frame?
                    if (frameFinished) {
                        // Convert the image from its native format to RGB
                        img_convert((AVPicture *)pFrameRGB, PIX_FMT_RGB24,
                                (AVPicture*)pFrame, pCodecCtx->pix_fmt,
                                pCodecCtx->width, pCodecCtx->height);
     
                        // Save the frame to disk
                        frameFilename = SaveFrame(pFrameRGB, pCodecCtx->width,
                                pCodecCtx->height);
                    }
                }
     
                // Free the packet that was allocated by av_read_frame
                av_free_packet(&packet);
            }
        }
        return frameFilename;
    }
     
    /**
     * Free the RGB image
     * Free the YUV frame
     * Close the codec
     * Close the video file
     * */
    VideoParser::~VideoParser() {
        av_free(buffer);
        av_free(pFrameRGB);
        av_free(pFrame);
        avcodec_close(pCodecCtx);
        av_close_input_file(pFormatCtx);
    }

    Débugger du code est deux fois plus dur que d'en écrire.
    Donc, si vous écrivez votre code aussi intelligemment que vous le pouvez, vous n'etes, par définition, pas assez intelligent pour le débugger.

  4. #4
    Membre habitué Avatar de Watier_53
    Profil pro
    Étudiant
    Inscrit en
    Novembre 2007
    Messages
    469
    Détails du profil
    Informations personnelles :
    Âge : 39
    Localisation : France, Maine et Loire (Pays de la Loire)

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Novembre 2007
    Messages : 469
    Points : 140
    Points
    140
    Par défaut
    je crois plutot que je vais l'utiiser en ligne de commande c'est pas très propre mais je suis un peu à court de temps !

  5. #5
    Membre du Club
    Profil pro
    Inscrit en
    Octobre 2004
    Messages
    129
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2004
    Messages : 129
    Points : 68
    Points
    68
    Par défaut
    Moi je le cherche toujours le très bon tutorial , le seul que j'ai trouvé me donne des milliers d'erreurs à la compil :

    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
    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
    tuto1.c: In function ‘main’:
    tuto1.c:133: warning: ‘img_convert’ is deprecated (declared at /usr/local/include/libavcodec/avcodec.h:2504)
    Undefined symbols:
      "_NeAACDecInit2", referenced from:
          _NeAACDecInit2$non_lazy_ptr in libavcodec.a(libfaad.o)
      "_lame_close", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
          _MP3lame_encode_close in libavcodec.a(libmp3lame.o)
      "_lame_get_framesize", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_NeAACDecGetCurrentConfiguration", referenced from:
          _NeAACDecGetCurrentConfiguration$non_lazy_ptr in libavcodec.a(libfaad.o)
      "_lame_set_num_channels", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_BZ2_bzDecompressInit", referenced from:
          _matroska_decode_buffer in libavformat.a(matroskadec.o)
      "_lame_init_params", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_NeAACDecInit", referenced from:
          _NeAACDecInit$non_lazy_ptr in libavcodec.a(libfaad.o)
      "_lame_encode_buffer_interleaved", referenced from:
          _MP3lame_encode_frame in libavcodec.a(libmp3lame.o)
      "_lame_set_VBR_q", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_NeAACDecOpen", referenced from:
          _NeAACDecOpen$non_lazy_ptr in libavcodec.a(libfaad.o)
      "_lame_set_VBR", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_lame_set_brate", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_lame_encode_buffer", referenced from:
          _MP3lame_encode_frame in libavcodec.a(libmp3lame.o)
      "_BZ2_bzDecompressEnd", referenced from:
          _matroska_decode_buffer in libavformat.a(matroskadec.o)
      "_lame_set_out_samplerate", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_lame_encode_flush", referenced from:
          _MP3lame_encode_frame in libavcodec.a(libmp3lame.o)
      "_lame_init", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_NeAACDecGetErrorMessage", referenced from:
          _NeAACDecGetErrorMessage$non_lazy_ptr in libavcodec.a(libfaad.o)
      "_NeAACDecDecode", referenced from:
          _NeAACDecDecode$non_lazy_ptr in libavcodec.a(libfaad.o)
      "_NeAACDecClose", referenced from:
          _NeAACDecClose$non_lazy_ptr in libavcodec.a(libfaad.o)
      "_lame_set_quality", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_NeAACDecSetConfiguration", referenced from:
          _NeAACDecSetConfiguration$non_lazy_ptr in libavcodec.a(libfaad.o)
      "_lame_set_in_samplerate", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_BZ2_bzDecompress", referenced from:
          _matroska_decode_buffer in libavformat.a(matroskadec.o)
      "_lame_set_bWriteVbrTag", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_lame_set_disable_reservoir", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
      "_lame_set_mode", referenced from:
          _MP3lame_encode_init in libavcodec.a(libmp3lame.o)
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    Si quelqu'un a une traduction française à ce problème ??

Discussions similaires

  1. Installation librairie FFMPEG
    Par isitien dans le forum Langage
    Réponses: 7
    Dernier message: 20/05/2012, 15h26
  2. Installation impossible avec ffmpeg
    Par lilington dans le forum OpenCV
    Réponses: 0
    Dernier message: 22/11/2010, 05h17
  3. installation de ffmpeg
    Par asma.r dans le forum Applications et environnements graphiques
    Réponses: 4
    Dernier message: 01/01/2010, 10h24
  4. Installer OpenCV avec ffmpeg
    Par melissouille dans le forum OpenCV
    Réponses: 2
    Dernier message: 25/03/2009, 12h15
  5. instalation ffmpeg sur wamp
    Par matcullen dans le forum Bibliothèques et frameworks
    Réponses: 5
    Dernier message: 14/02/2007, 13h42

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