Recherche avancée

Médias (91)

Autres articles (72)

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

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

  • Menus personnalisés

    14 novembre 2010, par

    MediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
    Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
    Menus créés à l’initialisation du site
    Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...)

Sur d’autres sites (10640)

  • avformat/hlsenc : Use HLS version 2 if rounded durations are enabled

    29 juin 2022, par Lucy
    avformat/hlsenc : Use HLS version 2 if rounded durations are enabled
    

    This allows for wider compatibility with older devices, such as those
    running iOS 3. The only difference between HLS version 2 and version 3 is
    that version 3 supports non-integer EXTINF values, and as such, we can
    default to version 2 if we're using whole-integer EXTINFs anyways, when
    `-hls_flags round_durations` is set.

    As this code seems to otherwise consistently use the lowest compatible
    version, this seems to fit in properly with existing behavior.

    Testing confirms with that this patch, HLS output can work all the way back
    to iOS 3.

    Reviewed-by : Steven Liu <liuqi05@kuaishou.com>
    Signed-off-by : Lucy <lucy@absolucy.moe>

    • [DH] doc/muxers.texi
    • [DH] libavformat/hlsenc.c
  • Incorrect values for song length (duration) in Mp3tag after ffmpeg FLAC to MP3 conversion

    29 mars 2024, par Clueless

    The problem

    &#xA;

    As per this post, I use the following command to convert a flac file to mp3 while keeping all metadata :

    &#xA;

    ffmpeg -i input.flac -ab 320k -map_metadata 0 -id3v2_version 3 output.mp3&#xA;

    &#xA;

    When inspecting the converted mp3 file by right-clicking it, going to properties and then details, everything looks in order. The value for "Length" is correct.

    &#xA;

    enter image description here

    &#xA;

    When inspecting the converted mp3 file with Mp3tag, the value for "Length" is different. From my testing, the "Length" value is consistently about 28% of what it is supposed to be.

    &#xA;

    enter image description here

    &#xA;

    Normally, this isn't an issue. Most music players I use, read the correct length value, same as Windows. However, I've recently discovered that Spotify Mobile for some reason ignores the length value that can be seen in the Windows panel and uses the one that can be seen in Mp3tag.

    &#xA;

    I want to figure out what command I should use so that after the flac file has been converted to mp3, Mp3tag shows the correct length, and there by, Spotify Mobile reads the correct length as well.

    &#xA;

    What I have tried

    &#xA;

    1.&#xA;After converting the file to Mp3, I've tried reencoding the mp3 file into a... mp3 file using the following command :

    &#xA;

    ffmpeg -i original.mp3 -c:v copy -c:a mp3 -vn -ar 44100 -ac 2 -b:a 320k copy.mp3&#xA;

    &#xA;

    enter image description here

    &#xA;

    As can be seen in the image above, this fixes the issue and the length is showing correctly in Mp3tag and in Spotify Mobile.

    &#xA;

    Issues with this : Reencoding reduces quality and I don't know how to combine the previous flac conversion command and this one into one line.

    &#xA;

    2.&#xA;I tried https://cloudconvert.com/flac-to-mp3 and it worked. The length is displayed correctly in Mp3tag. (What commands did they use on the server ???)

    &#xA;

    enter image description here

    &#xA;

    Issues with this : I don't want to rely on a cloud service for conversion, I have a lot of files to convert and I'd prefer it to be done locally.

    &#xA;

    Some demo files

    &#xA;

    Here is a folder with a flac file, a bad mp3 file (wrong length) and a good mp3 file. It looks like if you preview the music in google drive, it also plays the wrong length for the bad mp3 (39s not 2m19s), while vlc, groove player, spotify (desktop not mobile) all play the correct full length (2m19s) for the bad mp3 file.

    &#xA;

    Folder : here's the link

    &#xA;

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

    &#xA;

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

    &#xA;

    time ffmpeg -threads 1 -i file -map 0:a:0 -f null -&#xA;

    &#xA;

    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.

    &#xA;

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

    &#xA;

    #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;