Recherche avancée

Médias (1)

Mot : - Tags -/lev manovitch

Autres articles (112)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • 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

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (14236)

  • why is ffmpeg so fast

    8 juillet 2017, par jx.xu

    I have written a ffmpeg-based C++ program about converting yuv to rgb using libswscale, similar to the official example.
    Just simple copy and modify the official example before build in my visual studio 2017 on windows 10. However, the time performance is much slower than the ffmpeg.exe executable file, as 36 seconds vs 12 seconds.
    I already know that ffmpeg uses some optimization techniques like SIMD instructions. While in my performance profiling, the bottleneck is disk I/O writing which takes at least 2/3 time.
    Then I develop a concurrent version where a dedicated thread will handle all I/O task while the situation doesn’t seem to improve. It’s worth noting that I use Boost C++ library to utilize multi-thread and asynchronous events.

    So, I just wanna know how can I modify program using the libraries of ffmpeg or the time performance gap towards ffmpeg.exe just can’ be catched up.

    As requested by friendly answers, I post my codes. Compiler is msvc in vs2017 and I turn on the full optimization /Ox .

    Supplement my main question, I make another plain disk I/O test merely copying the file of the same size. It’s surprising to find that plain sequential disk I/O costs 28 seconds while the front codes cost 36 seconds in total... Any one knows how can ffmpeg finishes the same job in only 12 seconds ? That must use some optimization techniques, like random disk I/O or memory buffer reusing ?

    #include "stdafx.h"
    #define __STDC_CONSTANT_MACROS
    extern "C" {
    #include <libavutil></libavutil>imgutils.h>
    #include <libavutil></libavutil>parseutils.h>
    #include <libswscale></libswscale>swscale.h>
    }

    #ifdef _WIN64
    #pragma comment(lib, "avformat.lib")
    #pragma comment(lib, "avcodec.lib")
    #pragma comment(lib, "avutil.lib")
    #pragma comment(lib, "swscale.lib")
    #endif

    #include <common></common>cite.hpp>   // just include headers of c++ STL/Boost

    int main(int argc, char **argv)
    {
       chrono::duration<double> period;
       auto pIn = fopen("G:/Panorama/UHD/originalVideos/DrivingInCountry_3840x1920_30fps_8bit_420_erp.yuv", "rb");
       auto time_mark = chrono::steady_clock::now();

       int src_w = 3840, src_h = 1920, dst_w, dst_h;
       enum AVPixelFormat src_pix_fmt = AV_PIX_FMT_YUV420P, dst_pix_fmt = AV_PIX_FMT_RGB24;
       const char *dst_filename = "G:/Panorama/UHD/originalVideos/out.rgb";
       const char *dst_size = "3840x1920";
       FILE *dst_file;
       int dst_bufsize;
       struct SwsContext *sws_ctx;
       int i, ret;
       if (av_parse_video_size(&amp;dst_w, &amp;dst_h, dst_size) &lt; 0) {
           fprintf(stderr,
               "Invalid size '%s', must be in the form WxH or a valid size abbreviation\n",
               dst_size);
           exit(1);
       }
       dst_file = fopen(dst_filename, "wb");
       if (!dst_file) {
           fprintf(stderr, "Could not open destination file %s\n", dst_filename);
           exit(1);
       }
       /* create scaling context */
       sws_ctx = sws_getContext(src_w, src_h, src_pix_fmt,
           dst_w, dst_h, dst_pix_fmt,
           SWS_BILINEAR, NULL, NULL, NULL);
       if (!sws_ctx) {
           fprintf(stderr,
               "Impossible to create scale context for the conversion "
               "fmt:%s s:%dx%d -> fmt:%s s:%dx%d\n",
               av_get_pix_fmt_name(src_pix_fmt), src_w, src_h,
               av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h);
           ret = AVERROR(EINVAL);
           exit(1);
       }
       io_service srv;   // Boost.Asio class
       auto work = make_shared(srv);
       thread t{ bind(&amp;io_service::run,&amp;srv) }; // I/O worker thread
       vector> result;
       /* utilize function class so that lambda can capture itself */
       function)> recursion;  
       recursion = [&amp;](int left, unique_future<bool> writable)  
       {
           if (left &lt;= 0)
           {
               writable.wait();
               return;
           }
           uint8_t *src_data[4], *dst_data[4];
           int src_linesize[4], dst_linesize[4];
           /* promise-future pair used for thread synchronizing so that the file part is written in the correct sequence  */
           promise<bool> sync;
           /* allocate source and destination image buffers */
           if ((ret = av_image_alloc(src_data, src_linesize,
               src_w, src_h, src_pix_fmt, 16)) &lt; 0) {
               fprintf(stderr, "Could not allocate source image\n");
           }
           /* buffer is going to be written to rawvideo file, no alignment */
           if ((ret = av_image_alloc(dst_data, dst_linesize,
               dst_w, dst_h, dst_pix_fmt, 1)) &lt; 0) {
               fprintf(stderr, "Could not allocate destination image\n");
           }
           dst_bufsize = ret;
           fread(src_data[0], src_h*src_w, 1, pIn);
           fread(src_data[1], src_h*src_w / 4, 1, pIn);
           fread(src_data[2], src_h*src_w / 4, 1, pIn);
           result.push_back(async([&amp;] {
               /* convert to destination format */
               sws_scale(sws_ctx, (const uint8_t * const*)src_data,
                   src_linesize, 0, src_h, dst_data, dst_linesize);
               if (left>0)
               {
                   assert(writable.get() == true);
                   srv.post([=]
                   {
                       /* write scaled image to file */
                       fwrite(dst_data[0], 1, dst_bufsize, dst_file);
                       av_freep((void*)&amp;dst_data[0]);
                   });
               }
               sync.set_value(true);
               av_freep(&amp;src_data[0]);
           }));
           recursion(left - 1, sync.get_future());
       };

       promise<bool> root;
       root.set_value(true);
       recursion(300, root.get_future());  // .yuv file only has 300 frames
       wait_for_all(result.begin(), result.end()); // wait for all unique_future to callback
       work.reset();    // io_service::work releses
       srv.stop();      // io_service stops
       t.join();        // I/O thread joins
       period = steady_clock::now() - time_mark;  // calculate valid time
       fprintf(stderr, "Scaling succeeded. Play the output file with the command:\n"
           "ffplay -f rawvideo -pix_fmt %s -video_size %dx%d %s\n",
           av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h, dst_filename);
       cout &lt;&lt; "period" &lt;&lt; et &lt;&lt; period &lt;&lt; en;
    end:
       fclose(dst_file);
       //  av_freep(&amp;src_data[0]);
       //  av_freep(&amp;dst_data[0]);
       sws_freeContext(sws_ctx);
       return ret &lt; 0;
    }
    </bool></bool></bool></double>
  • avformat : add AV1 RTP depacketizer and packetizer

    26 août 2024, par Chris Hodges
    avformat : add AV1 RTP depacketizer and packetizer
    

    Add RTP packetizer and depacketizer according to (most)
    of the official AV1 RTP specification. This enables
    streaming via RTSP between ffmpeg and ffmpeg and has
    also been tested to work with AV1 RTSP streams via
    GStreamer.

    It also adds the required SDP attributes for AV1.

    AV1 RTP encoding is marked as experimental due to
    draft specification status, debug amount reduced
    and other changes suggested by Tristan.

    Added optional code for searching the sequence
    header to determine the first packet for broken
    AV1 encoders / parsers.

    Stops depacketizing on corruption until next keyframe,
    no longer prematurely issues packet on decoding if
    temporal unit was not complete yet.

    Change-Id : I90f5c5b9d577908a0d713606706b5654fde5f910
    Signed-off-by : Chris Hodges <chrishod@axis.com>
    Signed-off-by : Ronald S. Bultje <rsbultje@gmail.com>

    • [DH] libavformat/Makefile
    • [DH] libavformat/demux.c
    • [DH] libavformat/rtp_av1.h
    • [DH] libavformat/rtpdec.c
    • [DH] libavformat/rtpdec_av1.c
    • [DH] libavformat/rtpdec_formats.h
    • [DH] libavformat/rtpenc.c
    • [DH] libavformat/rtpenc.h
    • [DH] libavformat/rtpenc_av1.c
    • [DH] libavformat/sdp.c
  • Desktop recording with ffmpeg won't play in anything but VLC

    12 mai 2022, par Alex

    I'm creating a desktop application for fun/education. Its primary function is to record my PCs screen and have a pretty UI to play this back. I am recording with ffmpeg like so :

    &#xA;

    ffmpeg -thread_queue_size 1024 -f gdigrab -framerate 50 -video_size 1920x1080 -i desktop -f dshow -i audio="virtual-audio-capturer" -r 50 -preset fast -c:v h264_nvenc -qp 23 "D:/vid.mp4"&#xA;

    &#xA;

    At first glance this seems fine, a file is created and playing it back in VLC media player also works fine.

    &#xA;

    The problem is that I can't play this back in anything else. Windows apps (videos + media player) just freeze up/provide no clue as to the problem. My end goal is to embed this into a HTML5 player to fit with the electron/react framework I'm writing my application in. This also doesn't play in a similar fashion.

    &#xA;

    I ran mediainfo on the file in WSL and got the following :

    &#xA;

    General&#xA;Complete name                            : vid.mp4&#xA;Format                                   : MPEG-4&#xA;Format profile                           : Base Media&#xA;Codec ID                                 : isom (isom/iso2/avc1/mp41)&#xA;File size                                : 544 MiB&#xA;Duration                                 : 1 min 15 s&#xA;Overall bit rate mode                    : Variable&#xA;Overall bit rate                         : 60.4 Mb/s&#xA;Writing application                      : Lavf59.10.100&#xA;&#xA;Video&#xA;ID                                       : 1&#xA;Format                                   : AVC&#xA;Format/Info                              : Advanced Video Codec&#xA;Format profile                           : High 4:4:4 Predictive@L4.2&#xA;Format settings                          : 1 Ref Frames&#xA;Format settings, CABAC                   : No&#xA;Format settings, Reference frames        : 1 frame&#xA;Codec ID                                 : avc1&#xA;Codec ID/Info                            : Advanced Video Coding&#xA;Duration                                 : 1 min 15 s&#xA;Bit rate mode                            : Variable&#xA;Bit rate                                 : 60.3 Mb/s&#xA;Maximum bit rate                         : 2 000 kb/s&#xA;Width                                    : 1 920 pixels&#xA;Height                                   : 1 080 pixels&#xA;Display aspect ratio                     : 16:9&#xA;Frame rate mode                          : Constant&#xA;Frame rate                               : 50.000 FPS&#xA;Color space                              : RGB&#xA;Bit depth                                : 8 bits&#xA;Scan type                                : Progressive&#xA;Bits/(Pixel*Frame)                       : 0.581&#xA;Stream size                              : 543 MiB (100%)&#xA;Color range                              : Full&#xA;Matrix coefficients                      : Identity&#xA;Codec configuration box                  : avcC&#xA;&#xA;Audio&#xA;ID                                       : 2&#xA;Format                                   : AAC LC&#xA;Format/Info                              : Advanced Audio Codec Low Complexity&#xA;Codec ID                                 : mp4a-40-2&#xA;Duration                                 : 1 min 15 s&#xA;Source duration                          : 1 min 15 s&#xA;Bit rate mode                            : Constant&#xA;Bit rate                                 : 132 kb/s&#xA;Channel(s)                               : 2 channels&#xA;Channel layout                           : L R&#xA;Sampling rate                            : 48.0 kHz&#xA;

    &#xA;

    I also saw this thread (ffmpeg created timelapse won’t play on other players than VLC) suggesting the bit rate may be the problem but having tried the suggestions there had no luck.

    &#xA;

    At a glance I suspected the "Codec ID" field as with comparison to other MP4 files that windows does play it is slightly different, i.e. :

    &#xA;

    isom (isom/iso2/avc1/mp41) vs mp42 (mp42/mp41/isom/avc1)

    &#xA;

    However fiddling with the ffmpeg encoder settings I managed to vary this and still could not play the video back.

    &#xA;

    Also including the ffprobe output :

    &#xA;

    ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers&#xA;  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)&#xA;  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;vid.mp4:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf59.10.100&#xA;  Duration: 00:01:15.50, start: 0.000000, bitrate: 60414 kb/s&#xA;    Stream #0:0(und): Video: h264 (High 4:4:4 Predictive) (avc1 / 0x31637661), gbrp(pc, gbr/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 60277 kb/s, 50 fps, 50 tbr, 12800 tbn, 100 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 132 kb/s (default)&#xA;    Metadata:&#xA;      handler_name    : SoundHandler&#xA;

    &#xA;