Recherche avancée

Médias (0)

Mot : - Tags -/presse-papier

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (39)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • Prérequis à l’installation

    31 janvier 2010, par

    Préambule
    Cet article n’a pas pour but de détailler les installations de ces logiciels mais plutôt de donner des informations sur leur configuration spécifique.
    Avant toute chose SPIPMotion tout comme MediaSPIP est fait pour tourner sur des distributions Linux de type Debian ou dérivées (Ubuntu...). Les documentations de ce site se réfèrent donc à ces distributions. Il est également possible de l’utiliser sur d’autres distributions Linux mais aucune garantie de bon fonctionnement n’est possible.
    Il (...)

  • Librairies et binaires spécifiques au traitement vidéo et sonore

    31 janvier 2010, par

    Les logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
    Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
    Binaires complémentaires et facultatifs flvtool2 : (...)

Sur d’autres sites (7889)

  • PTS and DTS calculation for video and audio frames

    12 juin 2022, par Kaidul

    I am receiving video H264 encoded data and audio G.711 PCM encoded data from two different threads to mux / write into mov multimedia container.

    



    The writer function signatures are like :

    



    bool WriteAudio(const unsigned char *pEncodedData, size_t iLength);
bool WriteVideo(const unsigned char *pEncodedData, size_t iLength, bool const bIFrame);


    



    And the function for adding audio and video streams looks like :

    



    AVStream* AudioVideoRecorder::AddMediaStream(enum AVCodecID codecID) {
    Log("Adding stream: %s.", avcodec_get_name(codecID));
    AVCodecContext* pCodecCtx;
    AVStream* pStream;

    /* find the encoder */
    AVCodec* codec = avcodec_find_encoder(codecID);
    if (!codec) {
        LogErr("Could not find encoder for %s", avcodec_get_name(codecID));
        return NULL;
    }

    pStream = avformat_new_stream(m_pFormatCtx, codec);
    if (!pStream) {
        LogErr("Could not allocate stream.");
        return NULL;
    }
    pStream->id = m_pFormatCtx->nb_streams - 1;
    pStream->time_base = (AVRational){1, VIDEO_FRAME_RATE};
    pCodecCtx = pStream->codec;


    switch(codec->type) {
    case AVMEDIA_TYPE_VIDEO:
        pCodecCtx->codec_id = codecID;
        pCodecCtx->bit_rate = VIDEO_BIT_RATE;
        pCodecCtx->width = PICTURE_WIDTH;
        pCodecCtx->height = PICTURE_HEIGHT;
        pCodecCtx->gop_size = VIDEO_FRAME_RATE;
        pCodecCtx->pix_fmt = PIX_FMT_YUV420P;
        m_pVideoStream = pStream;
        break;

    case AVMEDIA_TYPE_AUDIO:
        pCodecCtx->codec_id = codecID;
        pCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;
        pCodecCtx->bit_rate = 64000;
        pCodecCtx->sample_rate = 8000;
        pCodecCtx->channels = 1;
        m_pAudioStream = pStream;
        break;

    default:
        break;
    }

    /* Some formats want stream headers to be separate. */
    if (m_pOutputFmt->flags & AVFMT_GLOBALHEADER)
        m_pFormatCtx->flags |= CODEC_FLAG_GLOBAL_HEADER;

    return pStream;
}


    



    Inside WriteAudio(..) and WriteVideo(..) functions, I am creating AVPakcet using av_init_packet(...) and set pEncodedData and iLength as packet.data and packet.size. I printed packet.pts and packet.dts and its equivalent to AV_NOPTS_VALUE.

    



    Now, how do I calculate the PTS, DTS, and packet duration (packet.dts, packet.pts and packet.duration) correctly for both audio and video data so that I can sync audio & video and play it properly ? I saw many examples on the internet, but none of them are making sense to me. I am new with ffmpeg, and my conception may not be correct in some context. I want to do it in the appropriate way.

    



    Thanks in advance !

    



    EDIT : In my video streams, there is no B frame. So, I think PTS and DTS can be kept the same here.

    


  • FFmpeg - confused with the concept of audio frame size and its calculation

    12 mars 2019, par Jinx

    I’m learning video and audio codecs with FFmpeg. I’m strgulling to understand frame size and some other concepts.

    Frame size
    This is the size in bytes of each frame. This can vary a lot : if each sample
    is 8 bits, and we’re handling mono sound, the frame size is one byte.
    Similarly in 6 channel audio with 64 bit floating point samples, the frame size is 48 bytes
    (PCM Terminology and Concepts)

    As described above, if each sample is 8 bits and there are 6 channels, then the frame size will be 48 bytes. The result from my code was 96 (16 bits * 6 channels). On the other side, the result from the call stream->codecpar->frame_size was 1024. Why were they different ? Is the frame size 1024 for 6 channels or just each channel ?

    main.cpp :

    else if (stream->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
       std::cout << "audio sample rate: " << stream->codecpar->sample_rate << std::endl;
       std::cout << "audio bits: " << stream->codecpar->bits_per_coded_sample << std::endl;
       std::cout << "audio channels: " << stream->codecpar->channels << std::endl;
       std::cout << "audio frame size: " << stream->codecpar->frame_size << std::endl;
       std::cout << "audio frame size: (16bits * 6 channels) = " << stream->codecpar->channels * stream->codecpar->bits_per_coded_sample << std::endl;
       audio_stream_index = i;
    }

    console :

    audio sample rate: 48000
    audio bits: 16
    audio channels: 6
    audio frame size: 1024
    audio frame size: (16bits * 6 channels) = 96
  • vp56data : Move all shared enum/struct declarations to common header

    14 août 2013, par Diego Biurrun
    vp56data : Move all shared enum/struct declarations to common header
    
    • [DH] libavcodec/vp56.h
    • [DH] libavcodec/vp56data.h
    • [DH] libavcodec/vp6data.h
    • [DH] libavcodec/vp8.h