Recherche avancée

Médias (91)

Autres articles (41)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

Sur d’autres sites (7627)

  • FFMPEG providing support for HEVC decoding

    28 novembre 2013, par sam

    FFMPEG v2.1 onwards is providing support for HEVC Decoding. I tried an elementary input bin stream as an input for it and yes i got a corresponding YUV file.

    Now my question is, since i'm just passing an elementary stream as an input, how is the decoder parsing it ?

    I have gone through the /libavformat/hevcdec.c which is supposed to be a demuxer for HEVC.
    I know hevc_probe() is the function in hevcdec.c where it detects if the file can be decoded by the HEVC decoder.

    The definition of hevc_probe() function is given below :

    static int hevc_probe(AVProbeData *p)
    {
       uint32_t code = -1;
       int vps = 0, sps = 0, pps = 0, irap = 0;
       int i;

       for (i = 0; i < p->buf_size - 1; i++) {
           code = (code << 8) + p->buf[i];
           if ((code & 0xffffff00) == 0x100) {
               uint8_t nal2 = p->buf[i + 1];
               int type = (code & 0x7E) >> 1;

               if (code & 0x81) // forbidden and reserved zero bits
                   return 0;

               if (nal2 & 0xf8) // reserved zero
                   return 0;

               switch (type) {
               case NAL_VPS:        vps++;  break;
               case NAL_SPS:        sps++;  break;
               case NAL_PPS:        pps++;  break;
               case NAL_BLA_N_LP:
               case NAL_BLA_W_LP:
               case NAL_BLA_W_RADL:
               case NAL_CRA_NUT:
               case NAL_IDR_N_LP:
               case NAL_IDR_W_RADL: irap++; break;
               }
           }
       }

       // printf("vps=%d, sps=%d, pps=%d, irap=%d\n", vps, sps, pps, irap);

       if (vps && sps && pps && irap)
           return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg
       return 0;
    }

    According to whatever i have read, only if this function returns a constant of type AVPROBE_SCORE_EXTENSION, the decoding will proceed. However it is returning AVPROBE_SCORE_EXTENSION+1 Why is it ?

    Also as seen above in the code, they are deciding some type variable from the input bit code obtained and performing increment in the constants like sps, pps, etc. Is the the normal operation that needs to be performed by a parser which can decode an elementary stream ?

    It would be really helpful to everyone if anyone is able to give a brief of a parser of a decoder that can decode an elementary stream.

    Please Help. Thanks in advance.

  • mp3 : Tweak the probe scores

    6 décembre 2014, par Luca Barbato
    mp3 : Tweak the probe scores
    

    Having more than 10 consecutive frames decoded as mp3 should be
    considered a clear signal that the sample is mp3 and not mpegps.

    Reported-By : Florian Iragne <florian@iragne.fr>
    CC : libav-stable@libav.org

    • [DH] libavformat/mp3dec.c
  • 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()) &lt; 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 &lt; 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 &lt; 0) {
           System.out.println("Could not open audio coder");
           return false;
       }
       retVal = outContainer.writeHeader();
       if (retVal &lt; 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 &lt; packet.getSize())
       {
           int bytesDecoded = audioDecoder.decodeAudio(audioSamples, packet, offset);
           if (bytesDecoded &lt; 0)
               throw new RuntimeException("got error decoding audio ");
           offset += bytesDecoded;
           if (audioSamples.isComplete())
           {
               int samplesConsumed = 0;
               while (samplesConsumed &lt; audioSamples.getNumSamples()) {
                   retVal = outAudioCoder.encodeAudio(packet_out, audioSamples, samplesConsumed);
                   if (retVal &lt;= 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 &lt; 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.