Recherche avancée

Médias (91)

Autres articles (94)

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

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

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

  • How do I use ffmpeg to concatenate 2 videos and add a period of silence + black screen between them ?

    29 avril 2022, par masotime

    There are several existing examples, but I'd like a single command that uses complex_filter to achieve the objective without doing extra things like generating blank video / audio files.

    


    Looking around, this is the best I've come up with so far :

    


    ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "color=black:s=960x540:d=1[b0];aevalsrc=0:d=1[s0];[0:v:0][0:a:0][b0][s0][1:v:0][1:a:0]concat=n=3:v=1:a=1[outv][outa]" -map '[outv]' -map '[outa]' out.mp4


    


    My understanding of the breakdown of such a command is

    


      

    1. specify 2 inputs
    2. 


    3. define a complex filter
    4. 


    5. define a black video stream of duration 1s and call it b0
    6. 


    7. define a silent audio stream of duration 1s and call it s0
    8. 


    9. pipe it through the concat filter with
    10. 


    


      

    • First stream : [0:v:0][0:a:0] // video1.mp4
    • 


    • Second stream : [b0][s0] // stuff I defined earlier
    • 


    • Third stream : [1:v:0][1:a:0] // video2.mp4
    • 


    


      

    1. define 2 output streams [outv][outa] for video and audio respectively
    2. 


    3. combine them into out.mp4
    4. 


    


    All file inputs are correctly 960x540, all using the same audio and video codecs but ffmpeg gives me this error and starts using 100% CPU

    


    More than 1000 frames duplicated


    


    I think there's something wrong with the streams I'm defining in the filter - what's wrong ? Do I need to specify more parameters somewhere ?

    


    EDIT : Here's a MediaInfo printout of the input video's metadata

    


    Format                                   : MPEG-4
Format profile                           : Base Media
Codec ID                                 : isom (isom/iso2/mp41)
File size                                : 7.82 MiB
Duration                                 : 31 s 449 ms
Overall bit rate                         : 2 086 kb/s
Writing application                      : Lavf59.16.100

Video
ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main@L3@Main
Codec ID                                 : hvc1
Codec ID/Info                            : High Efficiency Video Coding
Duration                                 : 31 s 449 ms
Bit rate                                 : 1 973 kb/s
Maximum bit rate                         : 2 000 kb/s
Width                                    : 960 pixels
Height                                   : 540 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0 (Type 0)
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.159
Stream size                              : 7.40 MiB (95%)
Writing library                          : x265 3.4+31-6722fce1f:[Mac OS X][clang 12.0.0][64 bit] 8bit+10bit+12bit
Encoding settings                        : cpuid=1111039 / frame-threads=4 / wpp / no-pmode / no-pme / no-psnr / no-ssim / log-level=2 / input-csp=1 / input-res=960x540 / interlace=0 / total-frames=0 / level-idc=0 / high-tier=1 / uhd-bd=0 / ref=3 / no-allow-non-conformance / no-repeat-headers / annexb / no-aud / no-hrd / info / hash=0 / no-temporal-layers / open-gop / min-keyint=23 / keyint=250 / gop-lookahead=0 / bframes=4 / b-adapt=2 / b-pyramid / bframe-bias=0 / rc-lookahead=20 / lookahead-slices=0 / scenecut=40 / hist-scenecut=0 / radl=0 / no-splice / no-intra-refresh / ctu=64 / min-cu-size=8 / no-rect / no-amp / max-tu-size=32 / tu-inter-depth=1 / tu-intra-depth=1 / limit-tu=0 / rdoq-level=0 / dynamic-rd=0.00 / no-ssim-rd / signhide / no-tskip / nr-intra=0 / nr-inter=0 / no-constrained-intra / strong-intra-smoothing / max-merge=3 / limit-refs=1 / no-limit-modes / me=1 / subme=2 / merange=57 / temporal-mvp / no-frame-dup / no-hme / weightp / no-weightb / no-analyze-src-pics / deblock=0:0 / sao / no-sao-non-deblock / rd=3 / selective-sao=4 / early-skip / rskip / no-fast-intra / no-tskip-fast / no-cu-lossless / b-intra / no-splitrd-skip / rdpenalty=0 / psy-rd=2.00 / psy-rdoq=0.00 / no-rd-refine / no-lossless / cbqpoffs=0 / crqpoffs=0 / rc=abr / bitrate=2000 / qcomp=0.60 / qpstep=4 / stats-write=1 / stats-read=0 / slow-firstpass / ipratio=1.40 / pbratio=1.30 / aq-mode=2 / aq-strength=1.00 / cutree / zone-count=0 / no-strict-cbr / qg-size=32 / no-rc-grain / qpmax=69 / qpmin=0 / no-const-vbv / sar=1 / overscan=0 / videoformat=5 / range=0 / colorprim=1 / transfer=1 / colormatrix=1 / chromaloc=1 / chromaloc-top=0 / chromaloc-bottom=0 / display-window=0 / cll=0,0 / min-luma=0 / max-luma=255 / log2-max-poc-lsb=8 / vui-timing-info / vui-hrd-info / slices=1 / no-opt-qp-pps / no-opt-ref-list-length-pps / no-multi-pass-opt-rps / scenecut-bias=0.05 / hist-threshold=0.03 / no-opt-cu-delta-qp / no-aq-motion / no-hdr10 / no-hdr10-opt / no-dhdr10-opt / no-idr-recovery-sei / analysis-reuse-level=0 / analysis-save-reuse-level=0 / analysis-load-reuse-level=0 / scale-factor=0 / refine-intra=0 / refine-inter=0 / refine-mv=1 / refine-ctu-distortion=0 / no-limit-sao / ctu-info=0 / no-lowpass-dct / refine-analysis-type=0 / copy-pic=1 / max-ausize-factor=1.0 / no-dynamic-refine / no-single-sei / no-hevc-aq / no-svt / no-field / qp-adaptation-range=1.00 / scenecut-aware-qp=0conformance-window-offsets / right=0 / bottom=0 / decoder-max-rate=0 / no-vbv-live-multi-pass
Color range                              : Limited
Color primaries                          : BT.709
Transfer characteristics                 : BT.709
Matrix coefficients                      : BT.709
Codec configuration box                  : hvcC

Audio
ID                                       : 2
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Codec ID                                 : mp4a-40-2
Duration                                 : 31 s 449 ms
Source duration                          : 31 s 492 ms
Source_Duration_LastFrame                : -17 ms
Bit rate mode                            : Constant
Bit rate                                 : 106 kb/s
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Stream size                              : 405 KiB (5%)
Source stream size                       : 406 KiB (5%)
Title                                    : Core Media Audio
Language                                 : English
Default                                  : Yes
Alternate group                          : 1


    


  • Why is ffmpeg faster than this minimal example ?

    23 juillet 2022, par Dave Ceddia

    I'm wanting to read the audio out of a video file as fast as possible, using the libav libraries. It's all working fine, but it seems like it could be faster.

    


    To get a performance baseline, I ran this ffmpeg command and timed it :

    


    time ffmpeg -threads 1 -i file -map 0:a:0 -f null -


    


    On a test file (a 2.5gb 2hr .MOV with pcm_s16be audio) this comes out to about 1.35 seconds on my M1 Macbook Pro.

    


    On the other hand, this minimal C code (based on FFmpeg's "Demuxing and decoding" example) is consistently around 0.3 seconds slower.

    


    #include <libavcodec></libavcodec>avcodec.h>&#xA;#include <libavformat></libavformat>avformat.h>&#xA;&#xA;static int decode_packet(AVCodecContext *dec, const AVPacket *pkt, AVFrame *frame)&#xA;{&#xA;    int ret = 0;&#xA;&#xA;    // submit the packet to the decoder&#xA;    ret = avcodec_send_packet(dec, pkt);&#xA;&#xA;    // get all the available frames from the decoder&#xA;    while (ret >= 0) {&#xA;        ret = avcodec_receive_frame(dec, frame);&#xA;        av_frame_unref(frame);&#xA;    }&#xA;&#xA;    return 0;&#xA;}&#xA;&#xA;int main (int argc, char **argv)&#xA;{&#xA;    int ret = 0;&#xA;    AVFormatContext *fmt_ctx = NULL;&#xA;    AVCodecContext  *dec_ctx = NULL;&#xA;    AVFrame *frame = NULL;&#xA;    AVPacket *pkt = NULL;&#xA;&#xA;    if (argc != 3) {&#xA;        exit(1);&#xA;    }&#xA;&#xA;    int stream_idx = atoi(argv[2]);&#xA;&#xA;    /* open input file, and allocate format context */&#xA;    avformat_open_input(&amp;fmt_ctx, argv[1], NULL, NULL);&#xA;&#xA;    /* get the stream */&#xA;    AVStream *st = fmt_ctx->streams[stream_idx];&#xA;&#xA;    /* find a decoder for the stream */&#xA;    AVCodec *dec = avcodec_find_decoder(st->codecpar->codec_id);&#xA;&#xA;    /* allocate a codec context for the decoder */&#xA;    dec_ctx = avcodec_alloc_context3(dec);&#xA;&#xA;    /* copy codec parameters from input stream to output codec context */&#xA;    avcodec_parameters_to_context(dec_ctx, st->codecpar);&#xA;&#xA;    /* init the decoder */&#xA;    avcodec_open2(dec_ctx, dec, NULL);&#xA;&#xA;    /* allocate frame and packet structs */&#xA;    frame = av_frame_alloc();&#xA;    pkt = av_packet_alloc();&#xA;&#xA;    /* read frames from the specified stream */&#xA;    while (av_read_frame(fmt_ctx, pkt) >= 0) {&#xA;        if (pkt->stream_index == stream_idx)&#xA;            ret = decode_packet(dec_ctx, pkt, frame);&#xA;&#xA;        av_packet_unref(pkt);&#xA;        if (ret &lt; 0)&#xA;            break;&#xA;    }&#xA;&#xA;    /* flush the decoders */&#xA;    decode_packet(dec_ctx, NULL, frame);&#xA;&#xA;    return ret &lt; 0;&#xA;}&#xA;

    &#xA;

    I tried measuring parts of this program to see if it was spending a lot of time in the setup, but it's not – at least 1.5 seconds of the runtime is the loop where it's reading frames.

    &#xA;

    So I took some flamegraph recordings (using cargo-flamegraph) and ran each a few times to make sure the timing was consistent. There's probably some overhead since both were consistently higher than running normally, but they still have the 0.3 second delta.

    &#xA;

    # 1.812 total&#xA;time sudo flamegraph ./minimal file 1&#xA;&#xA;# 1.542 total&#xA;time sudo flamegraph ffmpeg -threads 1 -i file -map 0:a:0 -f null - 2>&amp;1&#xA;

    &#xA;

    Here are the flamegraphs stacked up, scaled so that the faster one is only 85% as wide as the slower one. (click for larger)

    &#xA;

    ffmpeg versus a minimal example, audio from the same file

    &#xA;

    The interesting thing that stands out to me is how long is spent on read in the minimal example vs. ffmpeg :

    &#xA;

    time spent on read call, ffmpeg vs minimal example

    &#xA;

    The time spent on lseek is also a lot longer in the minimal program – it's plainly visible in that flamegraph, but in the ffmpeg flamegraph, lseek is a single pixel wide.

    &#xA;

    What's causing this discrepancy ? Is ffmpeg actually doing less work than I think it is here ? Is the minimal code doing something naive ? Is there some buffering or other I/O optimizations that ffmpeg has enabled ?

    &#xA;

    How can I shave 0.3 seconds off of the minimal example's runtime ?

    &#xA;

  • Add a sample "CAMM" data to specific PTS in a MP4 file

    11 janvier 2023, par Cheloute

    For testing purpose, I need to add programatically some samples to an existing MP4 video file but I can't understand how.&#xA;My goal is to add some CAMM1 records (exposure data) associated to each PTS multiple of 33366, that's to say : PTS=0, PTS=33366, PTS=66732, ...

    &#xA;

    I already have an existing camm track atom in my file, so the idea is to duplicate all the existing CAMM samples (CAMM2 and CAMM3 data), add my CAMM1 samples to the existing CAMM data, and write all the samples again at the end of the mdat atom (moov atom is located after mdat atom in my case). Next I'll update the CAMM track atom (stts, stsc, stsz and stco) to index all the samples correctly.

    &#xA;

    But I have 1 question I can't understand. STSC and STCO are dealing with offsets and STTS with time and delta, how can I do to link my CAMM1 records to PTS multiple of 33366 ?

    &#xA;

    Thanks

    &#xA;