Recherche avancée

Médias (1)

Mot : - Tags -/embed

Autres articles (56)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • 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

Sur d’autres sites (8538)

  • C++ ffmpeg mp4 to mp3 transcoding

    2 juillet 2014, par Unknown

    I am working on an application that converts the audio of mp4 video to mp3 files. I managed to compile ffmpeg with libmp3lame.

    This is what I have so far

    // Step 1 - Register all formats and codecs
    avcodec_register_all();
    av_register_all();

    AVFormatContext* fmtCtx = avformat_alloc_context();

    // Step 2 - Open input file, and allocate format context
    if(avformat_open_input(&fmtCtx, filePath.toLocal8Bit().data(), NULL, NULL) < 0)
       qDebug() << "Error while opening " << filePath;

    // Step 3 - Retrieve stream information
    if(avformat_find_stream_info(fmtCtx, NULL) < 0)
       qDebug() << "Error while finding stream info";

    // Step 4 - Find the audiostream
    int audioStreamIdx = -1;
    for(uint i=0; inb_streams; i++) {
       if(fmtCtx->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {
           audioStreamIdx = i;
           break;
       }
    }

    if(audioStreamIdx != -1) {
       AVCodecContext *audioDecCtx = fmtCtx->streams[audioStreamIdx]->codec;

       // Step 5
       AVCodec *aCodec = avcodec_find_decoder(audioDecCtx->codec_id);
       avcodec_open2(audioDecCtx, aCodec, NULL);

       // Step 6
       AVOutputFormat* outputFormat = av_guess_format(NULL, outPath.toLocal8Bit().data(), NULL);

       // Step 7
       AVFormatContext *outformatCtx = avformat_alloc_context();

       // Step 8
       AVCodec *encoder = avcodec_find_encoder(AV_CODEC_ID_MP3);
       //encoder->sample_fmts = AV_SAMPLE_FMT_S16;
       AVCodecContext *audioEncCtx = avcodec_alloc_context3(encoder);
       audioEncCtx->sample_fmt = AV_SAMPLE_FMT_S16P;
       audioEncCtx->sample_rate = 44100;
       audioEncCtx->channel_layout = av_get_default_channel_layout(audioDecCtx->channels);

       avcodec_open2(audioEncCtx, encoder, NULL);

       // Step 9
       AVFrame *frame = av_frame_alloc();

       AVPacket pkt;
       av_init_packet(&pkt);

       // Step 10
       while(av_read_frame(fmtCtx, &pkt) == 0) {
           int got_frame = 0;

           if(pkt.stream_index == audioStreamIdx) {
               int len = avcodec_decode_audio4(audioDecCtx, frame, &got_frame, &pkt);

               if(got_frame) {
                   // Step 11
                   AVPacket outPkt;
                   av_init_packet(&outPkt);

                   int got_packet = 0;

                   qDebug() << "This is printed";

                   int error = avcodec_encode_audio2(audioEncCtx, &outPkt, frame, &got_packet);

                   qDebug() << "This is not printed...";
              }
           }
       }

       av_free_packet(&pkt);
    }

    avformat_close_input(&fmtCtx);

    It goes wrong at the line avcodec_encode_audio2(). It seems like the function does not return. As you can see, the line after the encoding line is not printed. What am I doing wrong ?

    Thanks in advance !

  • vc1dsp : Change remaining stride parameters to ptrdiff_t

    29 mars 2022, par Martin Storsjö
    vc1dsp : Change remaining stride parameters to ptrdiff_t
    

    The existing x86 assembly for loop filters uses the stride as a
    full register without clearing/sign extending the upper half
    of the registers on x86_64.

    This avoids crashes if the caller would have passed nonzero bits
    in the previously undefined upper 32 bits of the parameters.

    Signed-off-by : Martin Storsjö <martin@martin.st>

    • [DH] libavcodec/mips/vc1dsp_mips.h
    • [DH] libavcodec/mips/vc1dsp_mmi.c
    • [DH] libavcodec/vc1dsp.c
    • [DH] libavcodec/vc1dsp.h
    • [DH] libavcodec/x86/vc1dsp_init.c
    • [DH] libavcodec/x86/vc1dsp_loopfilter.asm
  • Decoding audio with FFMPEG

    8 juillet 2012, par Mariano

    I am using FFMPEG to decode an audio file, but I am not able to do it.

       AVFormatContext *pFormatCtx;
    AVCodec *pCodec_audio;
    AVCodecContext *aCodecCtx_audio = NULL;
    AVPacket packet;
    string outfilename = "salida.avi";
    string filename = "john.wav";
    int audioStream;
    int out_size, len, size;
    FILE *outfile;
    int16_t *outbuf;
    uint8_t inbuf[INBUF_SIZE + FF_INPUT_BUFFER_PADDING_SIZE];
    avcodec_init();
    /* register all the codecs */
    av_register_all();

    if(av_open_input_file(&amp;pFormatCtx, filename.c_str(), NULL, 0, NULL) != 0) {
       cerr &lt;&lt; "Archivo no encontrado" &lt;&lt; endl;
       return -1; // Couldn&#39;t open file
    }

    if(av_find_stream_info(pFormatCtx) &lt; 0) {
       cerr &lt;&lt; " No encontro el stream de info" &lt;&lt; endl;
       return -1;// Couldn&#39;t find stream information
    }

    dump_format(pFormatCtx, 0, filename.c_str(), 0);

    for(unsigned int i=0; i &lt; pFormatCtx->nb_streams; i++)
     if(pFormatCtx->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
         audioStream = i;
    aCodecCtx_audio = pFormatCtx->streams[audioStream]->codec;
    pCodec_audio = avcodec_find_decoder(aCodecCtx_audio->codec_id);
    if(pCodec_audio == NULL) {
       cerr&lt;&lt; "Unsupported codec!" &lt;&lt; endl;
       return -1; // Codec not found
    }

    if(avcodec_open(aCodecCtx_audio, pCodec_audio) &lt; 0) {
       cerr &lt;&lt; "No se pudo abrir el codec de audio" &lt;&lt; endl;
       return -1;
    }

    outbuf = (int16_t*) av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);

    outfile = fopen(outfilename.c_str(), "wb");
    if (!outfile) {
       exit(1);
    }

    av_init_packet(&amp;packet);
    packet.data = inbuf;
    while(av_read_frame(pFormatCtx, &amp;packet) == 0) {
       if(packet.stream_index == audioStream) {
           size = packet.size;
           if (size == 0) {
               cerr &lt;&lt; "Size = 0 " &lt;&lt; endl;
               break;
           }
           while(size > 0) {
               out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
               len = avcodec_decode_audio3(aCodecCtx_audio, outbuf, &amp;out_size , &amp;packet);
               //av_free_packet(&amp;packet);
               cout &lt;&lt; len &lt;&lt; endl;
               if(len == -1) {
                   cerr &lt;&lt; "Error while decoding" &lt;&lt; endl;
                   return 1;
               }
               if(out_size > 0) {
                   fwrite(outbuf, 1, out_size, outfile);
               }
               size -= len;
               packet.data += len;
           }
       }
    }
    av_free_packet(&amp;packet);


    fclose(outfile);
    free(outbuf);
    cout &lt;&lt; "END CODE" &lt;&lt; endl;
    avcodec_close(aCodecCtx_audio);
    av_free(aCodecCtx_audio);

    In the code I am trying to decode an .wav file to a .avi file. The output file ("salida.avi") is created , but does not play.