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 (47)

  • 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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

Sur d’autres sites (8732)

  • Can i ship a commercial product with opencv_ffmpeg.dll, or is that a breach of the license ? [closed]

    6 juin 2020, par anti

    We are developing an application that uses opencv to load video files. This will be commercially available.

    



    In the current (as yet unreleased) version, I have added the opencv_ffmpeg410_64.dll file to the application build directory, as it is needed to load video files.

    



    However, reading online, I cannot track down a clear idea of whether or not I can legally ship with this dll.

    



    A question on opencv answers says yes :

    



    https://answers.opencv.org/question/28202/opencv_ffmpegdll-license/

    



    But another says not :

    



    https://answers.opencv.org/question/128342/is-using-opencv_ffmpegdll-in-commercial-applicatoin-require-license/

    



    The FFmpeg license page seems to focus on using the source code, and i cannot get a clear idea of the situation when using only the single dll bundled with opencv.

    



    Can i legally ship an application with the opencv FFmpeg dll file ? Or should I use another video backend ?

    


  • avformat/mxfenc : Add Product Version, Toolkit version and Platform

    17 mars 2018, par Michael Niedermayer
    avformat/mxfenc : Add Product Version, Toolkit version and Platform
    

    Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>

    • [DH] libavformat/mxfenc.c
    • [DH] tests/ref/fate/copy-trac4914
    • [DH] tests/ref/fate/mxf-reel_name
    • [DH] tests/ref/fate/time_base
    • [DH] tests/ref/lavf/mxf
    • [DH] tests/ref/lavf/mxf_d10
    • [DH] tests/ref/lavf/mxf_dv25
    • [DH] tests/ref/lavf/mxf_dvcpro50
    • [DH] tests/ref/lavf/mxf_opatom
    • [DH] tests/ref/lavf/mxf_opatom_audio
  • Qt Open Source Product 2 - Vlc Demo [closed]

    3 juin 2021, par cool code

    Ⅰ. Preface

    &#xA;

    The previous work was made by the FFmpeg kernel, and FFmpeg is too powerful for many beginners to understand. There are also a lot of users only need a simple video stream can be played, do not need to be involved in the responsible decoding and transcoding, so VLC came in handy, it directly made FFMPEG deep encapsulation, to provide a friendly interface. There's an MPV that does the same thing, and MPV is even better than VLC in that it's just one library file, and it looks like it's packaged as a static library, unlike VLC, VLC comes with a bunch of dynamic library files and plug-in files.&#xA;Of course, the simplicity of VLC is that it only needs a few lines of code to start, so that beginners immediately see the effect is very important, very excited, you can more quickly carry out the next step of coding, experience the fun of coding.

    &#xA;

    Ⅱ. Code framework

    &#xA;

    #include "ffmpeg.h"&#xA;&#xA;FFmpegThread::FFmpegThread(QObject *parent) : QThread(parent)&#xA;{&#xA;    setObjectName("FFmpegThread");&#xA;    stopped = false;&#xA;    isPlay = false;&#xA;&#xA;    frameFinish = false;&#xA;    videoWidth = 0;&#xA;    videoHeight = 0;&#xA;    oldWidth = 0;&#xA;    oldHeight = 0;&#xA;    videoStreamIndex = -1;&#xA;    audioStreamIndex = -1;&#xA;&#xA;    url = "rtsp://192.168.1.128:554/1";&#xA;&#xA;    buffer = NULL;&#xA;    avPacket = NULL;&#xA;    avFrame = NULL;&#xA;    avFrame2 = NULL;&#xA;    avFrame3 = NULL;&#xA;    avFormatContext = NULL;&#xA;    videoCodec = NULL;&#xA;    audioCodec = NULL;&#xA;    swsContext = NULL;&#xA;&#xA;    options = NULL;&#xA;    videoDecoder = NULL;&#xA;    audioDecoder = NULL;&#xA;&#xA;    //Initial registration, only register once in a software&#xA;    FFmpegThread::initlib();&#xA;}&#xA;&#xA;//Only need to initialize once in a software&#xA;void FFmpegThread::initlib()&#xA;{&#xA;    static QMutex mutex;&#xA;    QMutexLocker locker(&amp;mutex);&#xA;    static bool isInit = false;&#xA;    if (!isInit) {&#xA;        //Register all available file formats and decoders in the library&#xA;        av_register_all();&#xA;        //Register all devices, mainly for local camera playback support&#xA;#ifdef ffmpegdevice&#xA;        avdevice_register_all();&#xA;#endif&#xA;        //Initialize the network stream format, which must be executed first when using the network stream&#xA;        avformat_network_init();&#xA;&#xA;        isInit = true;&#xA;        qDebug() &lt;&lt; TIMEMS &lt;&lt; "init ffmpeg lib ok" &lt;&lt; " version:" &lt;&lt; FFMPEG_VERSION;&#xA;#if 0&#xA;        //Output all supported decoder names&#xA;        QStringList listCodeName;&#xA;        AVCodec *code = av_codec_next(NULL);&#xA;        while (code != NULL) {&#xA;            listCodeName &lt;&lt; code->name;&#xA;            code = code->next;&#xA;        }&#xA;&#xA;        qDebug() &lt;&lt; TIMEMS &lt;&lt; listCodeName;&#xA;#endif&#xA;    }&#xA;}&#xA;&#xA;bool FFmpegThread::init()&#xA;{&#xA;    //Before opening the code stream, specify various parameters such as: detection time/timeout time/maximum delay, etc.&#xA;    //Set the cache size, 1080p can increase the value&#xA;    av_dict_set(&amp;options, "buffer_size", "8192000", 0);&#xA;    //Open in tcp mode, if open in udp mode, replace tcp with udp&#xA;    av_dict_set(&amp;options, "rtsp_transport", "tcp", 0);&#xA;    //Set the timeout disconnection time, the unit is microseconds, 3000000 means 3 seconds&#xA;    av_dict_set(&amp;options, "stimeout", "3000000", 0);&#xA;    //Set the maximum delay, in microseconds, 1000000 means 1 second&#xA;    av_dict_set(&amp;options, "max_delay", "1000000", 0);&#xA;    //Automatically start the number of threads&#xA;    av_dict_set(&amp;options, "threads", "auto", 0);&#xA;&#xA;    //Open video stream&#xA;    avFormatContext = avformat_alloc_context();&#xA;&#xA;    int result = avformat_open_input(&amp;avFormatContext, url.toStdString().data(), NULL, &amp;options);&#xA;    if (result &lt; 0) {&#xA;        qDebug() &lt;&lt; TIMEMS &lt;&lt; "open input error" &lt;&lt; url;&#xA;        return false;&#xA;    }&#xA;&#xA;    //Release setting parameters&#xA;    if (options != NULL) {&#xA;        av_dict_free(&amp;options);&#xA;    }&#xA;&#xA;    //Get flow information&#xA;    result = avformat_find_stream_info(avFormatContext, NULL);&#xA;    if (result &lt; 0) {&#xA;        qDebug() &lt;&lt; TIMEMS &lt;&lt; "find stream info error";&#xA;        return false;&#xA;    }&#xA;&#xA;    //----------At the beginning of the video stream part, make a mark to facilitate the folding of the code----------&#xA;    if (1) {&#xA;        videoStreamIndex = av_find_best_stream(avFormatContext, AVMEDIA_TYPE_VIDEO, -1, -1, &amp;videoDecoder, 0);&#xA;        if (videoStreamIndex &lt; 0) {&#xA;            qDebug() &lt;&lt; TIMEMS &lt;&lt; "find video stream index error";&#xA;            return false;&#xA;        }&#xA;&#xA;        //Get video stream&#xA;        AVStream *videoStream = avFormatContext->streams[videoStreamIndex];&#xA;&#xA;        //Get the video stream decoder, or specify the decoder&#xA;        videoCodec = videoStream->codec;&#xA;        videoDecoder = avcodec_find_decoder(videoCodec->codec_id);&#xA;        //videoDecoder = avcodec_find_decoder_by_name("h264_qsv");&#xA;        if (videoDecoder == NULL) {&#xA;            qDebug() &lt;&lt; TIMEMS &lt;&lt; "video decoder not found";&#xA;            return false;&#xA;        }&#xA;&#xA;        //Set up accelerated decoding&#xA;        videoCodec->lowres = videoDecoder->max_lowres;&#xA;        videoCodec->flags2 |= AV_CODEC_FLAG2_FAST;&#xA;&#xA;        //Open the video decoder&#xA;        result = avcodec_open2(videoCodec, videoDecoder, NULL);&#xA;        if (result &lt; 0) {&#xA;            qDebug() &lt;&lt; TIMEMS &lt;&lt; "open video codec error";&#xA;            return false;&#xA;        }&#xA;&#xA;        //Get the resolution size&#xA;        videoWidth = videoStream->codec->width;&#xA;        videoHeight = videoStream->codec->height;&#xA;&#xA;        //If the width and height are not obtained, return&#xA;        if (videoWidth == 0 || videoHeight == 0) {&#xA;            qDebug() &lt;&lt; TIMEMS &lt;&lt; "find width height error";&#xA;            return false;&#xA;        }&#xA;&#xA;        QString videoInfo = QString("Video stream info -> index: %1  decode: %2  format: %3  duration: %4 s  Resolution: %5*%6")&#xA;                            .arg(videoStreamIndex).arg(videoDecoder->name).arg(avFormatContext->iformat->name)&#xA;                            .arg((avFormatContext->duration) / 1000000).arg(videoWidth).arg(videoHeight);&#xA;        qDebug() &lt;&lt; TIMEMS &lt;&lt; videoInfo;&#xA;    }&#xA;    //----------The video stream part starts----------&#xA;&#xA;    //----------Start the audio stream part, mark it to facilitate the code folding----------&#xA;    if (1) {&#xA;        //Loop to find audio stream index&#xA;        audioStreamIndex = -1;&#xA;        for (uint i = 0; i &lt; avFormatContext->nb_streams; i&#x2B;&#x2B;) {&#xA;            if (avFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) {&#xA;                audioStreamIndex = i;&#xA;                break;&#xA;            }&#xA;        }&#xA;&#xA;        //Some have no audio stream, so there is no need to return here&#xA;        if (audioStreamIndex == -1) {&#xA;            qDebug() &lt;&lt; TIMEMS &lt;&lt; "find audio stream index error";&#xA;        } else {&#xA;            //Get audio stream&#xA;            AVStream *audioStream = avFormatContext->streams[audioStreamIndex];&#xA;            audioCodec = audioStream->codec;&#xA;&#xA;            //Get the audio stream decoder, or specify the decoder&#xA;            audioDecoder = avcodec_find_decoder(audioCodec->codec_id);&#xA;            //audioDecoder = avcodec_find_decoder_by_name("aac");&#xA;            if (audioDecoder == NULL) {&#xA;                qDebug() &lt;&lt; TIMEMS &lt;&lt; "audio codec not found";&#xA;                return false;&#xA;            }&#xA;&#xA;            //Open the audio decoder&#xA;            result = avcodec_open2(audioCodec, audioDecoder, NULL);&#xA;            if (result &lt; 0) {&#xA;                qDebug() &lt;&lt; TIMEMS &lt;&lt; "open audio codec error";&#xA;                return false;&#xA;            }&#xA;&#xA;            QString audioInfo = QString("Audio stream information -> index: %1  decode: %2  Bit rate: %3  channel num: %4  sampling: %5")&#xA;                                .arg(audioStreamIndex).arg(audioDecoder->name).arg(avFormatContext->bit_rate)&#xA;                                .arg(audioCodec->channels).arg(audioCodec->sample_rate);&#xA;            qDebug() &lt;&lt; TIMEMS &lt;&lt; audioInfo;&#xA;        }&#xA;    }&#xA;    //----------End of audio stream----------&#xA;&#xA;    //Pre-allocated memory&#xA;    avPacket = av_packet_alloc();&#xA;    avFrame = av_frame_alloc();&#xA;    avFrame2 = av_frame_alloc();&#xA;    avFrame3 = av_frame_alloc();&#xA;&#xA;    //Compare the width and height of the last file. When changing, you need to reallocate the memory&#xA;    if (oldWidth != videoWidth || oldHeight != videoHeight) {&#xA;        int byte = avpicture_get_size(AV_PIX_FMT_RGB32, videoWidth, videoHeight);&#xA;        buffer = (uint8_t *)av_malloc(byte * sizeof(uint8_t));&#xA;        oldWidth = videoWidth;&#xA;        oldHeight = videoHeight;&#xA;    }&#xA;&#xA;    //Define pixel format&#xA;    AVPixelFormat srcFormat = AV_PIX_FMT_YUV420P;&#xA;    AVPixelFormat dstFormat = AV_PIX_FMT_RGB32;&#xA;    //Get the decoded format through the decoder&#xA;    srcFormat = videoCodec->pix_fmt;&#xA;&#xA;    //The SWS_FAST_BILINEAR parameter used by the default fastest decoding may lose part of the picture data, and you can change it to other parameters by yourself&#xA;    int flags = SWS_FAST_BILINEAR;&#xA;&#xA;    //Open up a cache to store one frame of data&#xA;    //The following two methods are ok, avpicture_fill has been gradually abandoned&#xA;    //avpicture_fill((AVPicture *)avFrame3, buffer, dstFormat, videoWidth, videoHeight);&#xA;    av_image_fill_arrays(avFrame3->data, avFrame3->linesize, buffer, dstFormat, videoWidth, videoHeight, 1);&#xA;&#xA;    //Image conversion&#xA;    swsContext = sws_getContext(videoWidth, videoHeight, srcFormat, videoWidth, videoHeight, dstFormat, flags, NULL, NULL, NULL);&#xA;&#xA;    //Output video information&#xA;    //av_dump_format(avFormatContext, 0, url.toStdString().data(), 0);&#xA;&#xA;    //qDebug() &lt;&lt; TIMEMS &lt;&lt; "init ffmpeg finsh";&#xA;    return true;&#xA;}&#xA;&#xA;void FFmpegThread::run()&#xA;{&#xA;    while (!stopped) {&#xA;        //Perform initialization based on the flag bit&#xA;        if (isPlay) {&#xA;            this->init();&#xA;            isPlay = false;&#xA;            continue;&#xA;        }&#xA;&#xA;        if (av_read_frame(avFormatContext, avPacket) >= 0) {&#xA;            //Determine whether the current package is video or audio&#xA;            int index = avPacket->stream_index;&#xA;            if (index == videoStreamIndex) {&#xA;                //Decode video stream avcodec_decode_video2 method has been deprecated&#xA;#if 0&#xA;                avcodec_decode_video2(videoCodec, avFrame2, &amp;frameFinish, avPacket);&#xA;#else&#xA;                frameFinish = avcodec_send_packet(videoCodec, avPacket);&#xA;                if (frameFinish &lt; 0) {&#xA;                    continue;&#xA;                }&#xA;&#xA;                frameFinish = avcodec_receive_frame(videoCodec, avFrame2);&#xA;                if (frameFinish &lt; 0) {&#xA;                    continue;&#xA;                }&#xA;#endif&#xA;&#xA;                if (frameFinish >= 0) {&#xA;                    //Turn the data into a picture&#xA;                    sws_scale(swsContext, (const uint8_t *const *)avFrame2->data, avFrame2->linesize, 0, videoHeight, avFrame3->data, avFrame3->linesize);&#xA;&#xA;                    //The following two methods can be used&#xA;                    //QImage image(avFrame3->data[0], videoWidth, videoHeight, QImage::Format_RGB32);&#xA;                    QImage image((uchar *)buffer, videoWidth, videoHeight, QImage::Format_RGB32);&#xA;                    if (!image.isNull()) {&#xA;                        emit receiveImage(image);&#xA;                    }&#xA;&#xA;                    msleep(1);&#xA;                }&#xA;            } else if (index == audioStreamIndex) {&#xA;                //Decode the audio stream, it will not be processed here, and will be handed over to sdl to play&#xA;            }&#xA;        }&#xA;&#xA;        av_packet_unref(avPacket);&#xA;        av_freep(avPacket);&#xA;        msleep(1);&#xA;    }&#xA;&#xA;    //Release resources after the thread ends&#xA;    free();&#xA;    stopped = false;&#xA;    isPlay = false;&#xA;    qDebug() &lt;&lt; TIMEMS &lt;&lt; "stop ffmpeg thread";&#xA;}&#xA;&#xA;void FFmpegThread::setUrl(const QString &amp;url)&#xA;{&#xA;    this->url = url;&#xA;}&#xA;&#xA;void FFmpegThread::free()&#xA;{&#xA;    if (swsContext != NULL) {&#xA;        sws_freeContext(swsContext);&#xA;        swsContext = NULL;&#xA;    }&#xA;&#xA;    if (avPacket != NULL) {&#xA;        av_packet_unref(avPacket);&#xA;        avPacket = NULL;&#xA;    }&#xA;&#xA;    if (avFrame != NULL) {&#xA;        av_frame_free(&amp;avFrame);&#xA;        avFrame = NULL;&#xA;    }&#xA;&#xA;    if (avFrame2 != NULL) {&#xA;        av_frame_free(&amp;avFrame2);&#xA;        avFrame2 = NULL;&#xA;    }&#xA;&#xA;    if (avFrame3 != NULL) {&#xA;        av_frame_free(&amp;avFrame3);&#xA;        avFrame3 = NULL;&#xA;    }&#xA;&#xA;    if (videoCodec != NULL) {&#xA;        avcodec_close(videoCodec);&#xA;        videoCodec = NULL;&#xA;    }&#xA;&#xA;    if (audioCodec != NULL) {&#xA;        avcodec_close(audioCodec);&#xA;        audioCodec = NULL;&#xA;    }&#xA;&#xA;    if (avFormatContext != NULL) {&#xA;        avformat_close_input(&amp;avFormatContext);&#xA;        avFormatContext = NULL;&#xA;    }&#xA;&#xA;    av_dict_free(&amp;options);&#xA;    //qDebug() &lt;&lt; TIMEMS &lt;&lt; "close ffmpeg ok";&#xA;}&#xA;&#xA;void FFmpegThread::play()&#xA;{&#xA;    //Let the thread perform initialization through the flag bit&#xA;    isPlay = true;&#xA;}&#xA;&#xA;void FFmpegThread::pause()&#xA;{&#xA;&#xA;}&#xA;&#xA;void FFmpegThread::next()&#xA;{&#xA;&#xA;}&#xA;&#xA;void FFmpegThread::stop()&#xA;{&#xA;    //Stop the thread through the flag&#xA;    stopped = true;&#xA;}&#xA;&#xA;//Real-time video display form class&#xA;FFmpegWidget::FFmpegWidget(QWidget *parent) : QWidget(parent)&#xA;{&#xA;    thread = new FFmpegThread(this);&#xA;    connect(thread, SIGNAL(receiveImage(QImage)), this, SLOT(updateImage(QImage)));&#xA;    image = QImage();&#xA;}&#xA;&#xA;FFmpegWidget::~FFmpegWidget()&#xA;{&#xA;    close();&#xA;}&#xA;&#xA;void FFmpegWidget::paintEvent(QPaintEvent *)&#xA;{&#xA;    if (image.isNull()) {&#xA;        return;&#xA;    }&#xA;&#xA;    //qDebug() &lt;&lt; TIMEMS &lt;&lt; "paintEvent" &lt;&lt; objectName();&#xA;    QPainter painter(this);&#xA;    painter.drawImage(this->rect(), image);&#xA;}&#xA;&#xA;void FFmpegWidget::updateImage(const QImage &amp;image)&#xA;{&#xA;    //this->image = image.copy();&#xA;    this->image = image;&#xA;    this->update();&#xA;}&#xA;&#xA;void FFmpegWidget::setUrl(const QString &amp;url)&#xA;{&#xA;    thread->setUrl(url);&#xA;}&#xA;&#xA;void FFmpegWidget::open()&#xA;{&#xA;    //qDebug() &lt;&lt; TIMEMS &lt;&lt; "open video" &lt;&lt; objectName();&#xA;    clear();&#xA;&#xA;    thread->play();&#xA;    thread->start();&#xA;}&#xA;&#xA;void FFmpegWidget::pause()&#xA;{&#xA;    thread->pause();&#xA;}&#xA;&#xA;void FFmpegWidget::next()&#xA;{&#xA;    thread->next();&#xA;}&#xA;&#xA;void FFmpegWidget::close()&#xA;{&#xA;    //qDebug() &lt;&lt; TIMEMS &lt;&lt; "close video" &lt;&lt; objectName();&#xA;    if (thread->isRunning()) {&#xA;        thread->stop();&#xA;        thread->quit();&#xA;        thread->wait(500);&#xA;    }&#xA;&#xA;    QTimer::singleShot(1, this, SLOT(clear()));&#xA;}&#xA;&#xA;void FFmpegWidget::clear()&#xA;{&#xA;    image = QImage();&#xA;    update();&#xA;}&#xA;&#xA;

    &#xA;

    Ⅲ. Renderings

    &#xA;

    https://youtu.be/CLsGw2CJW-c

    &#xA;

    Ⅳ. Open source code download URL

    &#xA;

    1.download URL for dropbox :

    &#xA;

    https://www.dropbox.com/sh/n58ucs57pscp25e/AABWBQlg4U3Oz2WF9YOJDrj1a?dl=0

    &#xA;

    2.download URL for box :

    &#xA;

    https://app.box.com/s/x48a7ttpk667afqqdk7t1fqok4fmvmyv

    &#xA;