Recherche avancée

Médias (0)

Mot : - Tags -/page unique

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

Autres articles (110)

  • Diogene : création de masques spécifiques de formulaires d’édition de contenus

    26 octobre 2010, par

    Diogene est un des plugins ? SPIP activé par défaut (extension) lors de l’initialisation de MediaSPIP.
    A quoi sert ce plugin
    Création de masques de formulaires
    Le plugin Diogène permet de créer des masques de formulaires spécifiques par secteur sur les trois objets spécifiques SPIP que sont : les articles ; les rubriques ; les sites
    Il permet ainsi de définir en fonction d’un secteur particulier, un masque de formulaire par objet, ajoutant ou enlevant ainsi des champs afin de rendre le formulaire (...)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (13765)

  • Using libav to encode RGBA frames into MP4 but the output is a mess

    5 octobre 2019, par Cu2S

    I’m trying to decode a video into RGB frames, and then postprocess the frames, finally encode the frames into a video. But the output video is completely a mess :
    Screenshot from potplayer

    I wrote a minimal example to illustrate my idea. First, I read some information from some source video :

       AVFormatContext* inputFormatCtx = nullptr;
       int ret = avformat_open_input(&inputFormatCtx, inputParamsVideo, nullptr, nullptr);
       assert(ret >= 0);
       ret = avformat_find_stream_info(inputFormatCtx, NULL);
       av_dump_format(inputFormatCtx, 0, inputParamsVideo, 0);

       assert(ret >= 0);
       AVStream* inputVideoStream = nullptr;
       for (int i = 0; i < inputFormatCtx->nb_streams; i++)
       {
           const auto inputStream = inputFormatCtx->streams[i];
           if (inputStream->codec->codec_type == AVMEDIA_TYPE_VIDEO)
           {
               inputVideoStream = inputStream;
               break;
           }
       }

       assert(inputVideoStream != nullptr);
       AVCodecParameters* inputParams = inputVideoStream->codecpar;
       AVRational framerate = inputVideoStream->codec->framerate;
       auto gop_size = inputVideoStream->codec->gop_size;
       auto maxBFrames = inputVideoStream->codec->max_b_frames;

    Then I assign the information to the output stream :

    AVFormatContext *outputAVFormat = nullptr;
    avformat_alloc_output_context2(&outputAVFormat, nullptr, nullptr, kOutputPath);
    assert(outputAVFormat);
    AVCodec* codec = avcodec_find_encoder(outputAVFormat->oformat->video_codec);
    assert(codec);
    AVCodecContext* encodingCtx = avcodec_alloc_context3(codec);
    avcodec_parameters_to_context(encodingCtx, inputParams);
    encodingCtx->time_base = av_inv_q(framerate);
    encodingCtx->max_b_frames = maxBFrames;
    encodingCtx->gop_size = gop_size;


    if (outputAVFormat->oformat->flags & AVFMT_GLOBALHEADER)
       encodingCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
    AVStream* outStream = avformat_new_stream(outputAVFormat, nullptr);
    assert(outStream != nullptr);
    ret = avcodec_parameters_from_context(outStream->codecpar, encodingCtx);
    assert(ret >= 0);
    outStream->time_base = encodingCtx->time_base;

    Then I convert RGBA frames(which is read from files) into YUV420P via sws_scale, and encoding :

       ret = avcodec_open2(encodingCtx, codec, nullptr);
       assert(ret >= 0);
       av_dump_format(outputAVFormat, 0, kOutputPath, 1);

       ret = avio_open(&outputAVFormat->pb, kOutputPath, AVIO_FLAG_WRITE);
       assert(ret >= 0);
       ret = avformat_write_header(outputAVFormat, nullptr);
       assert(ret >= 0);

       AVFrame* frame = av_frame_alloc();
       frame->width = inputParams->width;
       frame->height = inputParams->height;
       frame->format = inputParams->format;
       frame->pts = 0;
       assert(ret >= 0);

       ret = av_frame_get_buffer(frame, 32);
       int frameCount = 0;
       assert(ret >= 0);
       ret = av_frame_make_writable(frame);
       assert(ret >= 0);
       SwsContext* swsContext = sws_getContext(inputParams->width, inputParams->height,
           AV_PIX_FMT_RGBA, frame->width,
           frame->height, static_cast<avpixelformat>(inputParams->format),
           SWS_BILINEAR, NULL, NULL, NULL);


       for (auto inputPicPath : std::filesystem::directory_iterator(kInputDir))
       {
           int width, height, comp;
           unsigned char* data = stbi_load(inputPicPath.path().string().c_str(), &amp;width, &amp;height, &amp;comp, 4);
           int srcStrides[1] = { 4 * width };
           int ret = sws_scale(swsContext, &amp;data, srcStrides, 0, height, frame->data,
               frame->linesize);
           assert(ret >= 0);
           frame->pts = frameCount;
           //frame->pict_type = AV_PICTURE_TYPE_I;
           frameCount += 1;
           encode(encodingCtx, frame, 0, outputAVFormat);

           stbi_image_free(data);
       }

       while (encode(encodingCtx, nullptr, 0, outputAVFormat))
       {
           ;
       }

       static bool encode(AVCodecContext* enc_ctx, AVFrame* frame, std::uint32_t streamIndex,
           AVFormatContext * formatCtx)
       {
           int ret;
           int got_output = 0;
           AVPacket packet = {};
           av_init_packet(&amp;packet);
           ret = avcodec_encode_video2(enc_ctx, &amp;packet, frame, &amp;got_output);
           assert(ret >= 0);
           if (got_output) {
               packet.stream_index = streamIndex;
               av_packet_rescale_ts(&amp;packet, enc_ctx->time_base, formatCtx->streams[streamIndex]->time_base);
               ret = av_interleaved_write_frame(formatCtx, &amp;packet);
               assert(ret >= 0);
               return true;
           }
           else {
               return false;
           }
       }
    </avpixelformat>

    Finally I cleaned up stuff :

       av_write_trailer(outputAVFormat);
       sws_freeContext(swsContext);
       avcodec_free_context(&amp;encodingCtx);
       avio_closep(&amp;outputAVFormat->pb);
       avformat_free_context(outputAVFormat);
       av_frame_free(&amp;frame);

    I dumped my input format and my output format :

    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'H:\Me.MP4':
     Metadata:
       major_brand     : mp42
       minor_version   : 1
       compatible_brands: mp41mp42isom
       creation_time   : 2019-04-03T05:44:22.000000Z
     Duration: 00:00:06.90, start: 0.000000, bitrate: 1268 kb/s
       Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 540x960, 1238 kb/s, 29.86 fps, 30 tbr, 600 tbn, 1200 tbc (default)
       Metadata:
         creation_time   : 2019-04-03T05:44:22.000000Z
         handler_name    : Core Media Video
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 8000 Hz, stereo, fltp, 24 kb/s (default)
       Metadata:
         creation_time   : 2019-04-03T05:44:22.000000Z
         handler_name    : Core Media Audio
    [libx264 @ 000002126F90C1C0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 000002126F90C1C0] profile High, level 3.1, 4:2:0, 8-bit
    [libx264 @ 000002126F90C1C0] 264 - core 157 - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=12 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=12 rc=abr mbtree=1 bitrate=1238 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to './output.mp4':
       Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 540x960, q=2-31, 1238 kb/s, 29.86 tbn

    Update :

    After I deleted

    encodingCtx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

    the output video is right. Also, outputting avi works, too.

  • FFmpeg "Illegal instruction" Raspberry Pi Zero W

    20 août 2019, par ErezM

    I’ve been struggling with having FFmpeg run on Pi Zero W, as a newbie I can’t say where the root of the problem whether its the compilation configuration of the FFmpeg or maybe the syntax of the command line itself..

    The current configuration is :

    Raspberry Pi Zero Wireless
    Set GPU memory to 256

    Running OS :

    Linux raspberrypi 4.19.66+ #1253 Thu Aug 15 11:37:30 BST 2019 armv6l GNU/Linux

    PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
    NAME="Raspbian GNU/Linux"
    VERSION_ID="10"
    VERSION="10 (buster)"
    VERSION_CODENAME=buster
    ID=raspbian
    ID_LIKE=debian

    No LSB modules are available.
    Distributor ID: Raspbian
    Description: Raspbian GNU/Linux 10 (buster)
    Release: 10
    Codename: buster

    FFmpeg version and configuration :

    ffmpeg version N-94582-gd0fa1a58da Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 8 (Raspbian 8.3.0-6+rpi1)
    configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-omx --enable-omx-rpi --enable-nonfree
    libavutil 56. 33.100 / 56. 33.100
    libavcodec 58. 55.100 / 58. 55.100
    libavformat 58. 31.101 / 58. 31.101
    libavdevice 58. 9.100 / 58. 9.100
    libavfilter 7. 58.100 / 7. 58.100
    libswscale 5. 6.100 / 5. 6.100
    libswresample 3. 6.100 / 3. 6.100
    libpostproc 55. 6.100 / 55. 6.100
    Hyper fast Audio and Video encoder

    Command to copy 30 seconds clip from the 10 second mark :

    sudo ffmpeg -ss 00:00:10 -t 00:00:30 -i GOPR2546.MP4 -c:v libx264 -c:a copy out.MP4

    The FFmpeg output :

    ffmpeg version N-94582-gd0fa1a58da Copyright (c) 2000-2019 the FFmpeg developers
    built with gcc 8 (Raspbian 8.3.0-6+rpi1)
    configuration: --arch=armel --target-os=linux --enable-gpl --enable-libx264 --enable-omx --enable-omx-rpi --enable-nonfree
    libavutil 56. 33.100 / 56. 33.100
    libavcodec 58. 55.100 / 58. 55.100
    libavformat 58. 31.101 / 58. 31.101
    libavdevice 58. 9.100 / 58. 9.100
    libavfilter 7. 58.100 / 7. 58.100
    libswscale 5. 6.100 / 5. 6.100
    libswresample 3. 6.100 / 3. 6.100
    libpostproc 55. 6.100 / 55. 6.100
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x210d360] Using non-standard frame rate 59/1
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR2546.MP4':
    Metadata:
    major_brand : mp41
    minor_version : 538120216
    compatible_brands: mp41
    creation_time : 2019-08-20T11:09:41.000000Z
    firmware : HD7.01.01.80.00
    Duration: 00:01:00.84, start: 0.000000, bitrate: 45293 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 45043 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
    Metadata:
    creation_time : 2019-08-20T11:09:41.000000Z
    handler_name : GoPro AVC
    encoder : GoPro AVC encoder
    timecode : 11:20:21:32
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
    creation_time : 2019-08-20T11:09:41.000000Z
    handler_name : GoPro AAC
    timecode : 11:20:21:32
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74) (default)
    Metadata:
    creation_time : 2019-08-20T11:09:41.000000Z
    handler_name : GoPro TCD
    timecode : 11:20:21:32
    Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 41 kb/s (default)
    Metadata:
    creation_time : 2019-08-20T11:09:41.000000Z
    handler_name : GoPro MET
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 13 kb/s (default)
    Metadata:
    creation_time : 2019-08-20T11:09:41.000000Z
    handler_name : GoPro SOS
    Stream mapping:
    Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    Illegal instruction

    The result is an empty out.MP4 file... I’ve tried different configuration but never got it to work.

    the one minute input file i’m using to test can be downloaded from https://dl.dropboxusercontent.com/s/dxd285zrz6d57da/GOPR2546.MP4

    Thank you all in advance !!

  • How to convert mp4 file so that it can allow timeline drag in html5 video tag ?

    21 août 2019, par sgon00

    I generated a mp4 file by ffmpeg. And then correct the index by qt-faststart. But now, there is still one problem. In chrome browser, the video timeline can not be dragged. I tried another online video with the same video tag code. (for instance : http://www.w3schools.com/html/movie.mp4). The timeline dragging works fine. Can anyone please teach me how to enable timeine drag for this video ? How can I convert the mp4 file to make it right ? Thanks a lot.

    Updated :

    I kinda found the problem and fixed it. My debug http server is picky. So when I use nginx server, the mp4 video timeline can be draggable.

    But the weird part is the timeline of the movie.mp4 from w3schools.com works in my debug http server. So I don’t know the true cause, but changing to production http server solved the problem.

    • ffmpeg command and output :
    $ ffmpeg -i movie.mp4 -vf yadif=1:tff,zscale=w=320:h=240:f=spline36:r=full,unsharp=luma_msize_x=3:luma_msize_y=3:luma_amount=0.8,interlace notworking.mp4

    ffmpeg version N-93939-g819ed1df94-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers
     built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)
     configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libmysofa --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-version3 --pkg-config-flags=--static --disable-ffplay
     libavutil      56. 28.100 / 56. 28.100
     libavcodec     58. 52.102 / 58. 52.102
     libavformat    58. 27.103 / 58. 27.103
     libavdevice    58.  7.100 / 58.  7.100
     libavfilter     7. 54.101 /  7. 54.101
     libswscale      5.  4.101 /  5.  4.101
     libswresample   3.  4.100 /  3.  4.100
     libpostproc    55.  4.100 / 55.  4.100
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42isomavc1
       creation_time   : 2010-05-11T10:32:06.000000Z
       encoder         : HandBrake 0.9.4 2009112300
     Duration: 00:00:12.61, start: 0.000000, bitrate: 202 kb/s
       Chapter #0:0: start 0.000000, end 12.612000
       Metadata:
         title           :
       Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 320x240, 80 kb/s, 29.65 fps, 29.97 tbr, 90k tbn, 59.31 tbc (default)
       Metadata:
         creation_time   : 2010-05-11T10:32:06.000000Z
         encoder         : JVT/AVC Coding
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 115 kb/s (default)
       Metadata:
         creation_time   : 2010-05-11T10:32:06.000000Z
       Stream #0:2(und): Data: bin_data (text / 0x74786574), 0 kb/s
       Metadata:
         creation_time   : 2010-05-11T10:32:06.000000Z
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
     Stream #0:1 -> #0:1 (aac (native) -> aac (native))
    Press [q] to stop, [?] for help
    [libx264 @ 0x7faa5400a800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
    [libx264 @ 0x7faa5400a800] profile Progressive High, level 1.3, 4:2:0, 8-bit
    [libx264 @ 0x7faa5400a800] 264 - core 157 r2969 d4099dd - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'notworking.mp4':
     Metadata:
       major_brand     : mp42
       minor_version   : 0
       compatible_brands: mp42isomavc1
       encoder         : Lavf58.27.103
       Chapter #0:0: start 0.000000, end 12.612000
       Metadata:
         title           :
       Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 320x240, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc (default)
       Metadata:
         creation_time   : 2010-05-11T10:32:06.000000Z
         encoder         : Lavc58.52.102 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
       Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
       Metadata:
         creation_time   : 2010-05-11T10:32:06.000000Z
         encoder         : Lavc58.52.102 aac
    frame=  378 fps=229 q=-1.0 Lsize=     603kB time=00:00:12.60 bitrate= 391.5kbits/s dup=4 drop=0 speed=7.63x
    video:388kB audio:199kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.604359%
    [libx264 @ 0x7faa5400a800] frame I:2     Avg QP:22.49  size: 11066
    [libx264 @ 0x7faa5400a800] frame P:117   Avg QP:24.98  size:  2340
    [libx264 @ 0x7faa5400a800] frame B:259   Avg QP:29.82  size:   390
    [libx264 @ 0x7faa5400a800] consecutive B-frames:  3.7% 10.1% 14.3% 72.0%
    [libx264 @ 0x7faa5400a800] mb I  I16..4:  1.3% 47.0% 51.7%
    [libx264 @ 0x7faa5400a800] mb P  I16..4:  0.1%  1.7%  1.2%  P16..4: 49.5% 18.7% 10.5%  0.0%  0.0%    skip:18.3%
    [libx264 @ 0x7faa5400a800] mb B  I16..4:  0.0%  0.0%  0.1%  B16..8: 51.6%  5.8%  1.5%  direct: 0.9%  skip:40.1%  L0:52.8% L1:43.7% BI: 3.5%
    [libx264 @ 0x7faa5400a800] 8x8 transform intra:51.8% inter:50.8%
    [libx264 @ 0x7faa5400a800] coded y,uvDC,uvAC intra: 95.0% 53.2% 17.0% inter: 14.1% 3.7% 0.0%
    [libx264 @ 0x7faa5400a800] i16 v,h,dc,p:  8% 75%  2% 15%
    [libx264 @ 0x7faa5400a800] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu:  7% 42% 10%  5%  4%  3% 10%  4% 14%
    [libx264 @ 0x7faa5400a800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu:  9% 36% 13%  5%  6%  5% 11%  4% 11%
    [libx264 @ 0x7faa5400a800] i8c dc,h,v,p: 62% 24%  9%  5%
    [libx264 @ 0x7faa5400a800] Weighted P-Frames: Y:0.9% UV:0.9%
    [libx264 @ 0x7faa5400a800] ref P L0: 72.8%  9.6% 15.4%  2.2%  0.0%
    [libx264 @ 0x7faa5400a800] ref B L0: 92.4%  7.1%  0.5%
    [libx264 @ 0x7faa5400a800] ref B L1: 97.7%  2.3%
    [libx264 @ 0x7faa5400a800] kb/s:251.81
    [aac @ 0x7faa5500b200] Qavg: 826.560