Recherche avancée

Médias (91)

Autres articles (110)

  • Emballe médias : à quoi cela sert ?

    4 février 2011, par

    Ce plugin vise à gérer des sites de mise en ligne de documents de tous types.
    Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

  • Formulaire personnalisable

    21 juin 2013, par

    Cette page présente les champs disponibles dans le formulaire de publication d’un média et il indique les différents champs qu’on peut ajouter. Formulaire de création d’un Media
    Dans le cas d’un document de type média, les champs proposés par défaut sont : Texte Activer/Désactiver le forum ( on peut désactiver l’invite au commentaire pour chaque article ) Licence Ajout/suppression d’auteurs Tags
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire. (...)

Sur d’autres sites (9580)

  • Can VideoView be detach and reattached without stopping the stream ?

    1er juin 2015, par Thierry-Dimitri Roy

    I’m building an app where the user clicks on a button to show a video full screen. Initially the video is attached to a view inside a ViewPager. To be able to show it fullscreen I detach it from its parent and reattach it to the root view. This works fine, except when the video is switched to fullscreen while playing. When I detach a playing VideoView it just stop and I need to restart it. This is not acceptable since the video starts buffering before resume. Here the part of the code where the detach is done :

       final ViewGroup parent = (ViewGroup) findViewById(R.id.parent);

       final ViewGroup root = (ViewGroup) findViewById(R.id.root);

       Button b = (Button) findViewById(R.id.button);
       b.setOnClickListener(new OnClickListener() {

           @Override
           public void onClick(View v) {
               parent.removeView(mVideoView);

               LayoutParams lp = new FrameLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
               root.addView(mVideoView, lp);
           }
       });

    Depending of the device, I have a different log error. Probably because the actual video player is provided by the manufacturer and not the Android SDK. Here are the error logs for a Nexus 7 :

    10-30 20:26:18.618: D/NvOsDebugPrintf(124): NvMMDecTVMRDestroyParser Begin
    10-30 20:26:18.618: D/NvOsDebugPrintf(124): --------- Closing TVMR Frame Delivery Thread -------------
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): ------- NvAvpClose -------
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): NvMMDecTVMRDestroyParser Done
    10-30 20:26:18.678: D/NvOsDebugPrintf(124): NvMMLiteTVMRDecPrivateClose Done

    I haven’t been able to detach the video without stopping it. I tried using SurfaceView or TextureView without success.

    I also tried finding a third party video player. I found a commercial one (http://www.vitamio.org/) that I can’t really use for business reason. I found an open source one, that hasn’t been updated in the last year (https://code.google.com/p/dolphin-player/).

    I’m currently targeting Android 4.2 or better on tablet only.


    Note that the ViewPager is not fullscreen. So I can’t use LayoutParams to make the video fullscreen. I need to remove the VideoView from the parent in the ViewPager and add it to the root view to be able to show it fullscreen.

    The URL I’m testing with : http://bellvps1.cpl.delvenetworks.com/media/e1b3e24ecb944abd8f4ed823a0b76ddc/68f78d35296243bfb46d2418f03f2fd0/bande-annonce---the-secret-life-of-walter-mitty-1-9efcc5c6e52ac07a3edf84a1b21967995b7796a2.m3u8

  • How do I convert ADPCM to PCM using FFmpeg ?

    26 janvier 2013, par mystafer

    I have a video feed that sends me audio using the ADPCM codec. However, android only supports PCM format. How can I convert the ADPCM audio feed into a PCM audio feed ?

    The answer to this may be similar to the answer to this question.

    I have successfully decoded the frame with this code :

    int len = avcodec_decode_audio4(pAudioCodecCtx, pAudioFrame, &frameFinished, &packet);

    Is the secret here to use a reverse encode function ?

    Here is what I have so far in my audio decode function :

    if(packet_queue_get(env, javaThread, pAudioPacketQueue, &packet, 1) < 0) {
       LOGE("audio - after get packet failed");
       return;
    }
    LOGD("Dequeued audio packet");

    // calculate frame size
    int frameSize;
    if (pPcmAudioCodecCtx->frame_size) {
       frameSize = pPcmAudioCodecCtx->frame_size;
    } else {
       /* if frame_size is not set, the number of samples must be
        * calculated from the buffer size */
       int64_t nb_samples = (int64_t)AUDIO_PCM_OUTBUFF_SIZE * 8 /
               (av_get_bits_per_sample(pPcmAudioCodecCtx->codec_id) *
                       pPcmAudioCodecCtx->channels);
       frameSize = nb_samples;
    }

    int pcmBytesPerSample = av_get_bytes_per_sample(pPcmAudioCodecCtx->sample_fmt);
    int pcmFrameBytes = frameSize * pcmBytesPerSample * pPcmAudioCodecCtx->channels;

    uint8_t *pDataStart = packet.data;
    while(packet.size > 0) {
       int len = avcodec_decode_audio4(pAudioCodecCtx, pAudioFrame, &frameFinished, &packet);
       LOGD("Decoded ADPCM frame");

       if (len < 0) {
           LOGE("Error while decoding audio");
           return;
       }

       if (frameFinished) {
           // store frame data in FIFO buffer
           uint8_t *inputBuffer = pAudioFrame->data[0];
           int inputBufferSize = pAudioFrame->linesize[0];
           av_fifo_generic_write(fifoBuffer, inputBuffer, inputBufferSize, NULL);
           LOGD("Added ADPCM frame to FIFO buffer");

           // check if fifo buffer has enough data for a PCM frame
           while (av_fifo_size(fifoBuffer) >= pcmFrameBytes) {
               LOGI("PCM frame data in FIFO buffer");

               // read frame's worth of data from FIFO buffer
               av_fifo_generic_read(fifoBuffer, pAudioPcmOutBuffer, pcmFrameBytes, NULL);
               LOGD("Read data from FIFO buffer into pcm frame");


               avcodec_get_frame_defaults(pPcmAudioFrame);
               LOGD("Got frame defaults");

               pPcmAudioFrame->nb_samples = pcmFrameBytes / (pPcmAudioCodecCtx->channels *
                       pcmBytesPerSample);

               avcodec_fill_audio_frame(pPcmAudioFrame, pPcmAudioCodecCtx->channels,
                       pPcmAudioCodecCtx->sample_fmt,
                       pAudioPcmOutBuffer, pcmFrameBytes, 1);
               LOGD("Filled frame audio with data");

               // fill audio play buffer
               int dataSize = pPcmAudioFrame->linesize[0];
               LOGD("Data to output: %d", dataSize);
               jbyteArray audioPlayBuffer = (jbyteArray) env->GetObjectField(ffmpegCtx, env->GetFieldID(cls, "audioPlayBuffer", "[B"));
               jbyte *bytes = env->GetByteArrayElements(audioPlayBuffer, NULL);
               memcpy(bytes, pPcmAudioFrame->data[0], dataSize);
               env->ReleaseByteArrayElements(audioPlayBuffer, bytes, 0);
               LOGD("Copied data into Java array");

               env->CallVoidMethod(player, env->GetMethodID(playerCls, "updateAudio", "(I)V"), dataSize);
           }
  • Decoding video frames and sending them to RabbitMQ using FFmpeg

    28 janvier 2023, par viator

    I've built ffmpeg with AMQP support and tried ffmpeg -i /videos/episode.mp4 -f mpegts amqp://localhost which apparently works. But AFAIK mpegts has some muxing overhead, so I don't really know how it splits stream into messages.

    


    Is it possible to decode all the frames from a video and send them one-by-one in some format (say, JPEG or PNG) to RabbitMQ ?