Recherche avancée

Médias (91)

Autres articles (54)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

  • (Dés)Activation de fonctionnalités (plugins)

    18 février 2011, par

    Pour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
    SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
    Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
    MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)

  • Soumettre bugs et patchs

    10 avril 2011

    Un logiciel n’est malheureusement jamais parfait...
    Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
    Si vous pensez avoir résolu vous même le bug (...)

Sur d’autres sites (3560)

  • C++ OpenCV 3.4 / FFMPEG 3.4.1 VideoWriter and MP4 Output File Format

    11 janvier 2019, par PhilBot

    I’m running on an ARM BeagleBone X-15 Debian machine with Linux Kernel 4.9.35-ti-r44. In my C++ ( Qt 5 ) application, I want to save my cv::Mat frames to an MP4 format video. I have libx264 installed and compiled from scratch both ffmpeg and OpenCv. I can successfully record and view video with MJPEG with the AVI video container type but not MP4. Whenever I try to write an MP4 video, I get run time errors of the form :

    OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x00000020/' ???'

    I’ve tried various Google answers but none have worked.

    Relevant code :

    cv::Size frameSize = frame.size();

    qDebug() << "Initializing Video Recording to save Video file here: " << destinationFileName;

    std::string filename = destinationFileName.toStdString();
    //int fcc =   CV_FOURCC('M','J','P','G');
    //int fcc =   CV_FOURCC('X','2','6','4');
    int fcc = CV_FOURCC('X','V','I','D');
    int fps =   1;
    videoRecorder = new cv::VideoWriter(filename,fcc,fps,frameSize);

    ...

    videoRecorder->write(frame);

    I’ve downloaded and built the latest OpenCV 3.4 but the problem persists.
    How can I write to an MP4 File with OpenCV’s video writer ?

    When I try the ’X’,’2’,’6’,’4’ format I get the error :

       Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    OpenCV: FFMPEG: tag 0x34363258/'X264' is not supported with codec id 28 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
    [h264_v4l2m2m @ 0x81042020] Could not find a valid device
    [h264_v4l2m2m @ 0x81042020] can't configure encoder
    Could not open codec 'h264_v4l2m2m': Unspecified error
    Starting

    When I try the ’X’,’V’,’I’,’D’ format I get the error :

    Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    OpenCV: FFMPEG: tag 0x44495658/'XVID' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
    Starting

    When I try the ’M’,’P’,’E’,’G’ format I get the error :

    Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    OpenCV: FFMPEG: tag 0x4745504d/'MPEG' is not supported with codec id 2 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
    Starting

    When I try the ’H’,’2’,’6’,’4’ format I get the error :

    OpenCV: FFMPEG: tag 0x34363248/'H264' is not supported with codec id 28 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
    [h264_v4l2m2m @ 0x7fdde340] Could not find a valid device
    [h264_v4l2m2m @ 0x7fdde340] can't configure encoder
    Could not open codec 'h264_v4l2m2m': Unspecified error
    Starting

    When I try the ’M’,’P’,’4’,’V’ format I get the error :

    Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    OpenCV: FFMPEG: tag 0x5634504d/'MP4V' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
    Starting

    When I try the ’A’,’V’,’C’,’1’ format I get the error :

    Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    OpenCV: FFMPEG: tag 0x31435641/'AVC1' is not supported with codec id 28 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'
    [h264_v4l2m2m @ 0x810f5f50] Could not find a valid device
    [h264_v4l2m2m @ 0x810f5f50] can't configure encoder
    Could not open codec 'h264_v4l2m2m': Unspecified error
    Starting

    When I try the ’D’,’I’,’V’,’X’ format I get the error :

    Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    OpenCV: FFMPEG: tag 0x58564944/'DIVX' is not supported with codec id 13 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x7634706d/'mp4v'
    Starting

    When I try the 0x21 format I get the error :

    Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    OpenCV: FFMPEG: tag 0x00000021/'!???' is not found (format 'mp4 / MP4 (MPEG-4 Part 14)')'
    Starting

    Here is my complete class which shows all tried formats :

       #include "downloader.h"

    Downloader::Downloader(QString url, QString destinationFile) : downloadUrl(url) , destinationFileName(destinationFile)
    {

       didInitializeVideoWriter = false;

       qDebug() << "Initialized Downloader...";

    }

    Downloader::~Downloader() {

       videoRecorder->release();
       delete videoRecorder;

    }

    void Downloader::doDownload()
    {
       networkManager = new QNetworkAccessManager(this);

       connect(networkManager, SIGNAL(finished(QNetworkReply*)),
               this, SLOT(replyFinished(QNetworkReply*)));

       networkManager->get(QNetworkRequest(QUrl(downloadUrl)));
    }

    void Downloader::writeFrame(cv::Mat frame) {

       QMutexLocker locker(&videoFrameMutex);

       videoRecorder->write(frame);

    }

    void Downloader::replyFinished(QNetworkReply *reply)
    {

       if(reply->error())
       {
           qDebug() << "ERROR!";
           qDebug() << reply->errorString();
       }
       else
       {
           //qDebug() << reply->header(QNetworkRequest::ContentTypeHeader).toString();
           //qDebug() << reply->header(QNetworkRequest::LastModifiedHeader).toDateTime().toString();
           //qDebug() << reply->header(QNetworkRequest::ContentLengthHeader).toULongLong();
           qDebug() << reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
           qDebug() << reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString();

           QString tempFileName = destinationFileName;
           QString jpegTempFilename = QString("%1").arg(tempFileName.replace("mp4","jpeg"));

           qDebug() << "Overwriting: " << jpegTempFilename;
           QFile *file = new QFile(jpegTempFilename);
           if(file->open(QFile::WriteOnly))
           {
               file->write(reply->readAll());
               file->flush();
               file->close();
           }
           delete file;

           cv::Mat frame = imread(jpegTempFilename.toStdString(), CV_LOAD_IMAGE_COLOR);   // CV_LOAD_IMAGE_COLOR (>0) loads the image in the BGR format
           cv::cvtColor(frame,frame,CV_BGR2RGB);

           // Now lazy load the recorder
           if ( !didInitializeVideoWriter ) {

               cv::Size frameSize = frame.size();

               qDebug() << "Initializing Video Recording to save Video file here: " << destinationFileName;

               std::string filename = destinationFileName.toStdString();
               //int fcc =   CV_FOURCC('M','J','P','G');
               int fcc =   CV_FOURCC('X','2','6','4');
               //int fcc = CV_FOURCC('X','V','I','D');
               //int fcc = CV_FOURCC('M','P','E','G');
               //int fcc = CV_FOURCC('H','2','6','4');
               //int fcc = CV_FOURCC('M','P','4','V');
               //int fcc = CV_FOURCC('A','V','C','1');
               //int fcc = CV_FOURCC('D','I','V','X');
               //int fcc = 0x21;
               //int fcc = 0x00000021;
               int fps =   1;
               videoRecorder = new cv::VideoWriter(filename,fcc,fps,frameSize);

               qDebug() << "Starting";
               frameCounter = 1;
               performanceTimer.start();

               didInitializeVideoWriter = true;

           }

           cv::putText(frame,"[REC]",cv::Point(50,50),5,1,cv::Scalar(0,0,225));

           QFuture<void> backgroundRun = QtConcurrent::run(this, &amp;Downloader::writeFrame, frame);
           //backgroundRun.waitForFinished();

       }

       reply->deleteLater();

       qDebug() &lt;&lt; "RequestTimer: " &lt;&lt; performanceTimer.elapsed() &lt;&lt; frameCounter;

       // Requests Again
       networkManager->get(QNetworkRequest(QUrl(downloadUrl)));

       frameCounter++;

       performanceTimer.restart();


    }
    </void>

    Update - I tried ’a’,’v’,’c’,’1’ and unfortunately that also does not work :

    Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    [h264_v4l2m2m @ 0x810f6aa0] Could not find a valid device
    [h264_v4l2m2m @ 0x810f6aa0] can't configure encoder
    Could not open codec 'h264_v4l2m2m': Unspecified error

    (qt-downloader:6234): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
    OpenCV Error: Unspecified error (GStreamer: cannot link elements
    ) in CvVideoWriter_GStreamer::open, file /media/usb/opencv/modules/videoio/src/cap_gstreamer.cpp, line 1635
    VIDEOIO(cvCreateVideoWriter_GStreamer (filename, fourcc, fps, frameSize, is_color)): raised OpenCV exception:

    /media/usb/opencv/modules/videoio/src/cap_gstreamer.cpp:1635: error: (-2) GStreamer: cannot link elements
    in function CvVideoWriter_GStreamer::open

    When I try the X264 FOURCC, the mp4 file is 48 bytes and never grows :

    Initializing Video Recording to save Video file here:  "/tmp/Garage.mp4"
    OpenCV: FFMPEG: tag 0x34363258/'X264' is not supported with codec id 27 and format 'mp4 / MP4 (MPEG-4 Part 14)'
    OpenCV: FFMPEG: fallback to use tag 0x31637661/'avc1'

    Static Size :

    debian@BeagleBoard-X15:/tmp$ ls -lrt Garage.*
    -rw-r--r-- 1 debian debian     48 Dec 24 21:13 Garage.mp4
    -rw-r--r-- 1 debian debian 100424 Dec 24 21:14 Garage.jpeg
    debian@BeagleBoard-X15:/tmp$ hexdump Garage.mp4
    0000000 0000 2000 7466 7079 7369 6d6f 0000 0002
    0000010 7369 6d6f 7369 326f 7661 3163 706d 3134
    0000020 0000 0800 7266 6565 0000 0000 646d 7461
    0000030

    Here is my ffmpeg build conf :

    debian@BeagleBoard-X15:/tmp$ ffmpeg -buildconf
    ffmpeg version N-89524-g74f408cc8e Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
     configuration: --enable-gpl --enable-libx264 --enable-pthreads --enable-static --extra-cflags=-I./x264/include --extra-ldflags=-L./x264/lib --extra-libs=-ldl
     libavutil      56.  6.100 / 56.  6.100
     libavcodec     58.  8.100 / 58.  8.100
     libavformat    58.  3.100 / 58.  3.100
     libavdevice    58.  0.100 / 58.  0.100
     libavfilter     7.  7.100 /  7.  7.100
     libswscale      5.  0.101 /  5.  0.101
     libswresample   3.  0.101 /  3.  0.101
     libpostproc    55.  0.100 / 55.  0.100

     configuration:
       --enable-gpl
       --enable-libx264
       --enable-pthreads
       --enable-static
       --extra-cflags=-I./x264/include
       --extra-ldflags=-L./x264/lib
       --extra-libs=-ldl
  • Is this the best way to decrease the number of failures when downloading m3u8 ?

    26 juillet 2022, par zackchess1

    I have a bunch of m3u8 links that I am trying to download.

    &#xA;

    When I use ffmpeg, I get an average of 8/10 videos. The remaining 2 videos simply don't download. I use this command :

    &#xA;

    ffmpeg -i http://.../playlist.m3u8 -c copy -bsf:a aac_adtstoasc output.mp4

    &#xA;

    I have seen suggestions to use yt-dlp and aria2c to reduce the number of failures. Do either of these actually affect failure rates ?

    &#xA;

    Would you suggest using :

    &#xA;

    yt-dlp M3U8LINK

    &#xA;

    OR

    &#xA;

    yt-dlp --downloader aria2c M3U8LINK

    &#xA;

    IF NOT, WHAT COMMAND DECREASES THE NUMBER OF FAILURES ? Thanks.

    &#xA;

  • Want to convert my 16:9 size MKV video to 4:3 size AVI video file

    19 septembre 2012, par Bimal Rekhadiya

    I have a video in MKV format and it's size is 720x304 (16:9 ratio) size video.

    I want to convert it to AVi format (using xvid video codec). The output file size should be 480x360 (4:3 ratio) and also want to keep the original (16:9) ratio so it should be cinemascope (black areas at top and bottom).

    I am on Ubuntu linux OS so I can use mencoder, avconv(ffmpeg) or any tool that work on Linux.

    I am trying this command :

    avconv -i sample.mkv -vcodec libxvid -r 25 -b 1200 -aspect 4:3 -q 1 t.avi

    But the problem is that the video is stretched to 4:3 and I want to keep original video's ratio and want to add black boxes at top and bottom so it will look cinemascope.

    Please provide me command to do this.