Recherche avancée

Médias (91)

Autres articles (68)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (6271)

  • When using ffmpeg to create mp4 video file from batch of images the whole process is very slow how can i make it faster ?

    29 juin 2015, par Brubaker Haim

    The whole process is slow and also in the end the video file when playing it the frames moving very slow.

    ffmpeg -framerate 1/5 -i screenshot%06d.jpg -c:v libx264 -r 30 -p
    ix_fmt yuv420p out2.mp4

    Is that mean 1 frames each 5 seconds ?
    So if i will make 5/1 it will be 5 frames in a second ?
    What should be the best result ?

    And the second problem is that for testing i have 70 images but in the original i have over 1000 images is there any way to make all this process faster ?

  • Transcoding audio using xuggler

    23 juin 2014, par amd

    I am trying to convert an audio file with the header

    Opening audio decoder: [pcm] Uncompressed PCM audio decoder
    AUDIO: 44100 Hz, 2 ch, s16le, 1411.2 kbit/100.00% (ratio: 176400->176400)
    Selected audio codec: [pcm] afm: pcm (Uncompressed PCM)

    I want to transcode this file to mp3 format. I have following code snippet but its not working well. I have written it using XUGGLER code snippet for transcoding audio and video.

    Audio decoder is

       audioDecoder = IStreamCoder.make(IStreamCoder.Direction.DECODING, ICodec.findDecodingCodec(ICodec.ID.CODEC_ID_PCM_S16LE));
       audioDecoder.setSampleRate(44100);
       audioDecoder.setBitRate(176400);
       audioDecoder.setChannels(2);
       audioDecoder.setTimeBase(IRational.make(1,1000));
       if (audioDecoder.open(IMetaData.make(), IMetaData.make()) < 0)
           return false;
       return true;

    Audio encoder is

       outContainer = IContainer.make();
       outContainerFormat = IContainerFormat.make();
       outContainerFormat.setOutputFormat("mp3", urlOut, null);
       int retVal = outContainer.open(urlOut, IContainer.Type.WRITE, outContainerFormat);
       if (retVal < 0) {
           System.out.println("Could not open output container");
           return false;
       }
       outAudioCoder = IStreamCoder.make(IStreamCoder.Direction.ENCODING, ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_MP3));
       outAudioStream = outContainer.addNewStream(outAudioCoder);
       outAudioCoder.setSampleRate(new Integer(44100));
       outAudioCoder.setChannels(2);
       retVal = outAudioCoder.open(IMetaData.make(), IMetaData.make());
       if (retVal < 0) {
           System.out.println("Could not open audio coder");
           return false;
       }
       retVal = outContainer.writeHeader();
       if (retVal < 0) {
           System.out.println("Could not write output FLV header: ");
           return false;
       }
       return true;

    And here is encode method where i send packets of 32 byte to transcode

    public void encode(byte[] audioFrame){
       //duration of 1 video frame
       long lastVideoPts = 0;

       IPacket packet_out = IPacket.make();
       int lastPos = 0;
       int lastPos_out = 0;

       IAudioSamples audioSamples = IAudioSamples.make(48000, audioDecoder.getChannels());
       IAudioSamples audioSamples_resampled = IAudioSamples.make(48000, audioDecoder.getChannels());

       //we always have 32 bytes/sample
       int pos = 0;
       int audioFrameLength = audioFrame.length;
       int audioFrameCnt = 1;
       iBuffer = IBuffer.make(null, audioFrame, 0, audioFrameLength);
       IPacket packet = IPacket.make(iBuffer);
       //packet.setKeyPacket(true);
       packet.setTimeBase(IRational.make(1,1000));
       packet.setDuration(20);
       packet.setDts(audioFrameCnt*20);
       packet.setPts(audioFrameCnt*20);
       packet.setStreamIndex(1);
       packet.setPosition(lastPos);
       lastPos+=audioFrameLength;
       int pksz = packet.getSize();
       packet.setComplete(true, pksz);
       /*
       * A packet can actually contain multiple samples
       */
       int offset = 0;
       int retVal;
       while(offset < packet.getSize())
       {
           int bytesDecoded = audioDecoder.decodeAudio(audioSamples, packet, offset);
           if (bytesDecoded < 0)
               throw new RuntimeException("got error decoding audio ");
           offset += bytesDecoded;
           if (audioSamples.isComplete())
           {
               int samplesConsumed = 0;
               while (samplesConsumed < audioSamples.getNumSamples()) {
                   retVal = outAudioCoder.encodeAudio(packet_out, audioSamples, samplesConsumed);
                   if (retVal <= 0)
                       throw new RuntimeException("Could not encode audio");
                   samplesConsumed += retVal;
                   if (packet_out.isComplete()) {
                       packet_out.setPosition(lastPos_out);
                       packet_out.setStreamIndex(1);
                       lastPos_out+=packet_out.getSize();
                       retVal = outContainer.writePacket(packet_out);
                       if(retVal < 0){
                           throw new RuntimeException("Could not write data packet");
                       }
                   }
               }
           }

       }

    }

    I get an output file but it doesnt get played. I have very little experience of audio encoding and sampling. Thanks in advance.

  • libavcodec get video duration and framerate

    17 septembre 2013, par Tishu

    I have a video encoded in .3gp h.264 and I am looking to get its framerate and duration in C. Here is the code I use after opening the file and finding the appropriate codecs :

    AVRational rational = gVideoCodecCtx->time_base;

    LOGI(10, "numerator is %i", rational.num);
    LOGI(10, "denominator is %i", rational.den);
    LOGI(10, "duration is %d", gFormatCtx->duration);
    LOGI(10, "fps is %d", (double)av_q2d(rational));

    And here is the output :

    12-02 12:30:19.819: I/FFmpegTest(23903): numerator is 1
    12-02 12:30:19.819: I/FFmpegTest(23903): denominator is 180000
    12-02 12:30:19.819: I/FFmpegTest(23903): duration is 6594490
    12-02 12:30:19.819: I/FFmpegTest(23903): fps is 1692926992

    From the documentation I understand that the duration is meant to be "duration/time_base" which gives me 6594490 / 180000 = 36.6. The duration of my video file is 6 seconds and I do not know where this factor of 6 would come from.

    Also the framerate seems to be completely off.

    It is currenlty hard to find help as a lot of tutorials use deprecated methods and the documentation does not give examples.

    Any help would be appreciated.

    Thanks

    Edit :
    Thanks to the comment below I managed to print the following

    12-02 18:59:36.279: I/FFmpegTest(435): numerator is 1
    12-02 18:59:36.279: I/FFmpegTest(435): denominator is 180000
    12-02 18:59:36.279: I/FFmpegTest(435): duration is 6594490
    12-02 18:59:36.279: I/FFmpegTest(435): fps is 0.000006

    I also managed to find out a frame's timestamp in msec with this :

    int msec = 1000*(packet.pts * timeBase * gVideoCodecCtx->ticks_per_frame);

    This returns me something that's roughly 33fps (I expect 30). But I can't figure out how to retrieve the duration. The documentation says "duration of the stream, in AV_TIME_BASE fractional seconds" but 6594490 * 0.000006 = 39.5 - the correct duration is 6.3 seconds). Also the exact fps is 30 but nor sure how to get from 0.000006 to 30 with the above figures)

    Thanks