Recherche avancée

Médias (0)

Mot : - Tags -/masques

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

Autres articles (77)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • 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 (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (14099)

  • lavc/qsvenc_hevc : add -pic_timing_sei option

    6 août 2021, par Haihao Xiang
    lavc/qsvenc_hevc : add -pic_timing_sei option
    

    The SDK may insert picture timing SEI for hevc and the code to set mfx
    parameter has been added in qsvenc, however the corresponding option is
    missing in the hevc option array

    Reviewed-by : Limin Wang <lance.lmwang@gmail.com>
    Signed-off-by : Haihao Xiang <haihao.xiang@intel.com>

    • [DH] doc/encoders.texi
    • [DH] libavcodec/qsvenc_hevc.c
  • How to fill an AVFrame structure in order to encode an YUY2 video (or UYVY) into H265

    22 avril, par Rich Deng

    I want to compress a video stream in YUY2 or UYVY format to, say H265. If I understand the answers given this thread correctly, I should be able use the function av_image_fill_arrays() to fill the data and linesize arrays of an AVFrame object, call avcodec_send_frame(), and then avcodec_receive_packet() to get encoded data :

    &#xA;

    bool VideoEncoder::Init(const AM_MEDIA_TYPE* pMediaType)&#xA;{&#xA;    // we should have a valid pointer&#xA;    if (pMediaType)&#xA;    {&#xA;        m_mtInput.Empty();&#xA;        m_mtInput.Set(*pMediaType);&#xA;    }&#xA;    else&#xA;        return false;&#xA;&#xA;        // find encoder&#xA;    m_pCodec = m_spAVCodecDlls->avcodec_find_encoder(AV_CODEC_ID_HEVC);&#xA;    m_pCodecCtx = m_spAVCodecDlls->avcodec_alloc_context3(m_pCodec);&#xA;    if (!m_pCodec || !m_pCodecCtx)&#xA;    {&#xA;        Log.Log(_T("Failed to find or allocate codec context!"));&#xA;        return false;&#xA;    }&#xA;&#xA;    AVPixelFormat ePixFmtInput = GetInputPixelFormat();&#xA;    if (CanConvertInputFormat(ePixFmtInput) == false)&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    // we are able to convert&#xA;    // so continue with setting it up&#xA;    int nWidth = m_mtInput.GetWidth();&#xA;    int nHeight = m_mtInput.GetHeight();&#xA;&#xA;    // Set encoding parameters&#xA;&#xA;    // Set bitrate (4 Mbps for 1920x1080)&#xA;    m_pCodecCtx->bit_rate = (((int64)4000000 * nWidth / 1920) * nHeight / 1080);  &#xA;&#xA;    m_pCodecCtx->width = nWidth;  &#xA;    m_pCodecCtx->height = nHeight;&#xA;&#xA;&#xA;    // use reference time as time_base&#xA;    m_pCodecCtx->time_base.den = 10000000;  &#xA;    m_pCodecCtx->time_base.num = 1;&#xA;&#xA;    SetAVRational(m_pCodecCtx->framerate, m_mtInput.GetFrameRate());&#xA;    //m_pCodecCtx->framerate = (AVRational){ 30, 1 };&#xA;    m_pCodecCtx->gop_size = 10;  // GOP size&#xA;    m_pCodecCtx->max_b_frames = 1;&#xA;&#xA;    // set pixel format&#xA;    m_pCodecCtx->pix_fmt = ePixFmtInput;  // YUV 4:2:0 format or YUV 4:2:2&#xA;&#xA;    // Open the codec&#xA;    if (m_spAVCodecDlls->avcodec_open2(m_pCodecCtx, m_pCodec, NULL) &lt; 0)&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;        return true;&#xA;}&#xA;&#xA;bool VideoEncoder::AllocateFrame()&#xA;{&#xA;&#xA;    m_pFrame = m_spAVCodecDlls->av_frame_alloc();&#xA;    if (m_pFrame == NULL)&#xA;    {&#xA;        Log.Log(_T("Failed to allocate frame object!"));&#xA;        return false;&#xA;    }&#xA;&#xA;    m_pFrame->format = m_pCodecCtx->pix_fmt;&#xA;    m_pFrame->width = m_pCodecCtx->width;&#xA;    m_pFrame->height = m_pCodecCtx->height;&#xA;&#xA;    m_pFrame->time_base.den = m_pCodecCtx->time_base.den;&#xA;    m_pFrame->time_base.num = m_pCodecCtx->time_base.num;&#xA;&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool VideoEncoder::Encode(IMediaSample* pSample)&#xA;{&#xA;    if (m_pFrame == NULL)&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    // get the time stamps&#xA;    REFERENCE_TIME rtStart, rtEnd;&#xA;    HRESULT hr = pSample->GetTime(&amp;rtStart, &amp;rtEnd);&#xA;    m_rtInputFrameStart = rtStart;&#xA;    m_rtInputFrameEnd = rtEnd;&#xA;&#xA;&#xA;    // get length&#xA;    int nLength = pSample->GetActualDataLength();&#xA;&#xA;    // get pointer to actual sample data&#xA;    uint8_t* pData = NULL;&#xA;    hr = pSample->GetPointer(&amp;pData);&#xA;&#xA;    if (FAILED(hr) || NULL == pData)&#xA;        return false;&#xA;&#xA;    m_pFrame->flags = (S_OK == pSample->IsSyncPoint()) ? (m_pFrame->flags | AV_FRAME_FLAG_KEY) : (m_pFrame->flags &amp; ~AV_FRAME_FLAG_KEY);&#xA;&#xA;    // clear old data&#xA;    for (int n = 0; n &lt; AV_NUM_DATA_POINTERS; n&#x2B;&#x2B;)&#xA;    {&#xA;        m_pFrame->data[n] = NULL;// (uint8_t*)aryData[n];&#xA;        m_pFrame->linesize[n] = 0;// = aryStride[n];&#xA;    }&#xA;&#xA;&#xA;    int nRet = 0;&#xA;    int nStride = m_mtInput.GetStride();&#xA;    nRet = m_spAVCodecDlls->av_image_fill_arrays(m_pFrame->data, m_pFrame->linesize, pData, ePixFmt, m_pFrame->width, m_pFrame->height, 32);&#xA;    if (nRet &lt; 0)&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    m_pFrame->pts = (int64_t) rtStart;&#xA;    m_pFrame->duration = rtEnd - rtStart;&#xA;    nRet = m_spAVCodecDlls->avcodec_send_frame(m_pCodecCtx, m_pFrame);&#xA;    if (nRet == AVERROR(EAGAIN))&#xA;    {&#xA;        ReceivePacket();&#xA;        nRet = m_spAVCodecDlls->avcodec_send_frame(m_pCodecCtx, m_pFrame);&#xA;    }&#xA;&#xA;    if (nRet &lt; 0)&#xA;    {&#xA;        return false;&#xA;    }&#xA;&#xA;    // Receive the encoded packets&#xA;    ReceivePacket();&#xA;&#xA;    return true;&#xA;}&#xA;&#xA;bool VideoEncoder::ReceivePacket()&#xA;{&#xA;    bool bRet = true;&#xA;    AVPacket* pkt = m_spAVCodecDlls->av_packet_alloc();&#xA;    while (m_spAVCodecDlls->avcodec_receive_packet(m_pCodecCtx, pkt) == 0)&#xA;    {&#xA;        // Write pkt->data to output file or stream&#xA;        m_pCallback->VideoEncoderWriteEncodedSample(pkt);&#xA;        if (m_OutFile.IsOpen())&#xA;            m_OutFile.Write(pkt->data, pkt->size);&#xA;        m_spAVCodecDlls->av_packet_unref(pkt);&#xA;    }&#xA;    m_spAVCodecDlls->av_packet_free(&amp;pkt);&#xA;&#xA;    return bRet;&#xA;}&#xA;

    &#xA;

    I must have done something wrong. The result is not correct. For example, rather than a video with a person's face showing in the middle of the screen, I get a mostly green screen with parts of the face showing up at the lower left and lower right corners.

    &#xA;

    Can someone help me ?

    &#xA;

  • How do I know the time left in order to convert to an audio file, to use that to display the remainder for downloading in front of the user

    6 novembre 2020, par Kerols afifi

    I got this code from GITHUB, and this is better for me than using the FFmpeg library, because this library only works at a minimum. Issued 24 APIs, but the code that I got I don't know exactly how to tell me when the conversion is finished and also how much time is left because it's the conversion to appear. In front of the user

    &#xA;

    @SuppressLint("NewApi")&#xA;    public void genVideoUsingMuxer(Context context,String srcPath, String dstPath, int startMs, int endMs, boolean useAudio, boolean useVideo,long time) throws IOException {&#xA;        // Set up MediaExtractor to read from the source.&#xA;         extractor = new MediaExtractor();&#xA;        extractor.setDataSource(srcPath);&#xA;        int trackCount = extractor.getTrackCount();&#xA;        // Set up MediaMuxer for the destination.&#xA;&#xA;    mediaMuxer = new MediaMuxer(dstPath, MediaMuxer.OutputFormat.MUXER_OUTPUT_MPEG_4);&#xA;    // Set up the tracks and retrieve the max buffer size for selected&#xA;    // tracks.&#xA;    HashMap indexMap = new HashMap(trackCount);&#xA;    int bufferSize = -1;&#xA;    for (int i = 0; i &lt; trackCount; i&#x2B;&#x2B;) {&#xA;        MediaFormat format = extractor.getTrackFormat(i);&#xA;        String mime = format.getString(MediaFormat.KEY_MIME);&#xA;        boolean selectCurrentTrack = false;&#xA;        if (mime.startsWith("audio/") &amp;&amp; useAudio) {&#xA;            selectCurrentTrack = true;&#xA;        } else if (mime.startsWith("video/") &amp;&amp; useVideo) {&#xA;            selectCurrentTrack = true;&#xA;        }&#xA;        if (selectCurrentTrack) {&#xA;            extractor.selectTrack(i);&#xA;            int dstIndex = mediaMuxer.addTrack(format);&#xA;            indexMap.put(i, dstIndex);&#xA;            if (format.containsKey(MediaFormat.KEY_MAX_INPUT_SIZE)) {&#xA;                int newSize = format.getInteger(MediaFormat.KEY_MAX_INPUT_SIZE);&#xA;                bufferSize = newSize > bufferSize ? newSize : bufferSize;&#xA;            }&#xA;        }&#xA;    }&#xA;    if (bufferSize &lt; 0) {&#xA;        bufferSize = DEFAULT_BUFFER_SIZE;&#xA;    }&#xA;    // Set up the orientation and starting time for extractor.&#xA;    MediaMetadataRetriever retrieverSrc = new MediaMetadataRetriever();&#xA;    retrieverSrc.setDataSource(srcPath);&#xA;    String degreesString = retrieverSrc.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION);&#xA;    if (degreesString != null) {&#xA;        int degrees = Integer.parseInt(degreesString);&#xA;        if (degrees >= 0) {&#xA;            mediaMuxer.setOrientationHint(degrees);&#xA;        }&#xA;    }&#xA;    if (startMs > 0) {&#xA;        extractor.seekTo(startMs * 1000, MediaExtractor.SEEK_TO_CLOSEST_SYNC);&#xA;    }&#xA;    // Copy the samples from MediaExtractor to MediamediaMuxer. We will loop&#xA;    // for copying each sample and stop when we get to the end of the source&#xA;    // file or exceed the end time of the trimming.&#xA;    int offset = 0;&#xA;    int trackIndex = -1;&#xA;    time = bufferSize;&#xA;    ByteBuffer dstBuf = ByteBuffer.allocate(bufferSize);&#xA;    mediaMuxer.start();&#xA;    while (true) {&#xA;        bufferInfo.offset = offset;&#xA;        bufferInfo.size = extractor.readSampleData(dstBuf, offset);&#xA;        if (bufferInfo.size &lt; 0) {&#xA;            Log.d(TAG, "Saw input EOS.");&#xA;            bufferInfo.size = 0;&#xA;            break;&#xA;        } else {&#xA;            bufferInfo.presentationTimeUs = extractor.getSampleTime();&#xA;            if (endMs > 0 &amp;&amp; bufferInfo.presentationTimeUs > (endMs * 1000)) {&#xA;                Log.d(TAG, "The current sample is over the trim end time.");&#xA;                break;&#xA;            } else {&#xA;                bufferInfo.flags = extractor.getSampleFlags();&#xA;                trackIndex = extractor.getSampleTrackIndex();&#xA;                mediaMuxer.writeSampleData(indexMap.get(trackIndex), dstBuf, bufferInfo);&#xA;                extractor.advance();&#xA;            }&#xA;        }&#xA;    }&#xA;&#xA;    mediaMuxer.stop();&#xA;    mediaMuxer.release();&#xA;&#xA;    return;&#xA;}&#xA;

    &#xA;