Recherche avancée

Médias (91)

Autres articles (78)

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

Sur d’autres sites (6512)

  • On ALAC’s Open Sourcing

    1er novembre 2011, par Multimedia Mike — Codec Technology

    Apple open sourced their lossless audio codec last week. Pretty awesome ! I have a theory that, given enough time, absolutely every codec will be open source in one way or another.

    I know I shouldn’t bother reading internet conversation around any news related to multimedia technology. And if I do read it, I shouldn’t waste any effort getting annoyed about them. But here are some general corrections :

    • ALAC is not in the same league as — nor is it a suitable replacement for — MP3/AAC/Vorbis or any other commonly used perceptual audio codec. It’s not a matter of better or worse ; they’re just different families of codecs designed for different purposes.
    • Apple open sourced ALAC, not AAC– easy mistake, though there’s nothing to ‘open source’ about AAC (though people can, and will, argue about its absolute ‘open-ness’).
    • There’s not much technical room to argue between ALAC and FLAC, the leading open source lossless audio compressor. Both perform similarly in terms of codec speeds (screamingly fast) and compression efficiency (results vary slightly depending on source material).
    • Perhaps the most frustrating facet is the blithe ignorance about ALAC’s current open source status. While this event simply added an official “open source” status to the codec, ALAC has effectively been open source for a very long time. According to my notes, the ALAC decoding algorithm was reverse engineered in 2005 and added into FFmpeg in March of the same year. Then in 2008, Google — through their Summer of Code program — sponsored an open source ALAC encoder.

    From the multimedia-savvy who are versed in these concepts, the conversation revolves around which would win in a fight, ALAC or FLAC ? And who between Apple and FFmpeg/Libav has a faster ALAC decoder ? The faster and more efficient ALAC encoder ? I contend that these issues don’t really matter. If you have any experience working with lossless audio encoders, you know that they tend to be ridiculously fast to both encode and decode and that many different lossless codecs compress at roughly the same ratios.

    As for which encoder is the fastest : use whatever encoder is handiest and most familiar, either iTunes or FFmpeg/Libav.

    As for whether to use FLAC or ALAC — if you’ve already been using one or the other for years, keep on using it. Support isn’t going to vanish. If you’re deciding which to use for a new project, again, perhaps choose based on software you’re already familiar with. Also, consider hardware support– ALAC enjoys iPod support, FLAC is probably better supported in a variety of non-iPod devices, though that may change going forward due to this open sourcing event.

    For my part, I’m just ecstatic that the question of moral superiority based on open source status has been removed from the equation.

    Code-wise, I’m interested in studying the official ALAC code to see if it has any corner-case modes that the existing open source decoders don’t yet account for. The source makes mention of multichannel (i.e., greater than stereo) configurations, but I don’t know if that’s in FFmpeg/Libav.

  • How can I stream very long H.264 videos over HTTP without long startup times ? (or : MOOV atom too large)

    5 octobre 2012, par michael

    I want to stream videos of public meetings that are often 10 hours long. Users will generally be starting at some point in the middle of the video and jumping around frequently.

    H.264 in an MP4 container seems like the current best option for encoding streaming video (right ?). But these are large files — about 1.3GB for one file — and the metadata (MOOV atom) at the beginning of the file is itself about 40MB. If I understand correctly, clients need to download the full metadata before they're able to seek within the remainder of the file. Obviously, having to download 40MB before you can start streaming is unacceptable.

    (My tests of streaming have been with VLC and the HTML5 tag in Chrome.)

    I'm encoding the file using avconv, and am currently providing no additional settings beyond telling it which encoders to use (x264 and libfaac). I then move the metadata to the beginning of the file using qt-faststart.

    Is there a way to make the MOOV atom smaller ?

    If not, are there other strategies to use (e.g. is splitting long videos into several files something that's frequently done ? it seems like a real pain in terms of users seeking around the whole day's video) ?

    Or should I be using a different codec or container ?

    thanks !

    Here's a breakdown of the file header structure, from AtomicParsley :

    Atom ftyp @ 0 of size: 32, ends @ 32
    Atom moov @ 32 of size: 40157673, ends @ 40157705
        Atom mvhd @ 40 of size: 108, ends @ 148
        Atom iods @ 148 of size: 24, ends @ 172
        Atom trak @ 172 of size: 20156304, ends @ 20156476
            Atom tkhd @ 180 of size: 92, ends @ 272
            Atom edts @ 272 of size: 36, ends @ 308
                Atom elst @ 280 of size: 28, ends @ 308
            Atom mdia @ 308 of size: 20156168, ends @ 20156476
                Atom mdhd @ 316 of size: 32, ends @ 348
                Atom hdlr @ 348 of size: 45, ends @ 393
                Atom minf @ 393 of size: 20156083, ends @ 20156476
                    Atom vmhd @ 401 of size: 20, ends @ 421
                    Atom dinf @ 421 of size: 36, ends @ 457
                        Atom dref @ 429 of size: 28, ends @ 457
                    Atom stbl @ 457 of size: 20156019, ends @ 20156476
                        Atom stsd @ 465 of size: 147, ends @ 612
                            Atom avc1 @ 481 of size: 131, ends @ 612
                                Atom avcC @ 567 of size: 45, ends @ 612
                        Atom stts @ 612 of size: 6115608, ends @ 6116220
                        Atom stss @ 6116220 of size: 16960, ends @ 6133180
                        Atom ctts @ 6133180 of size: 5683824, ends @ 11817004
                        Atom stsc @ 11817004 of size: 28, ends @ 11817032
                        Atom stsz @ 11817032 of size: 4169724, ends @ 15986756
                        Atom stco @ 15986756 of size: 4169720, ends @ 20156476
        Atom trak @ 20156476 of size: 20001133, ends @ 40157609
            Atom tkhd @ 20156484 of size: 92, ends @ 20156576
            Atom mdia @ 20156576 of size: 20001033, ends @ 40157609
                Atom mdhd @ 20156584 of size: 32, ends @ 20156616
                Atom hdlr @ 20156616 of size: 45, ends @ 20156661
                Atom minf @ 20156661 of size: 20000948, ends @ 40157609
                    Atom smhd @ 20156669 of size: 16, ends @ 20156685
                    Atom dinf @ 20156685 of size: 36, ends @ 20156721
                        Atom dref @ 20156693 of size: 28, ends @ 20156721
                    Atom stbl @ 20156721 of size: 20000888, ends @ 40157609
                        Atom stsd @ 20156729 of size: 96, ends @ 20156825
                            Atom mp4a @ 20156745 of size: 80, ends @ 20156825
                                Atom esds @ 20156781 of size: 44, ends @ 20156825
                        Atom stts @ 20156825 of size: 9348168, ends @ 29504993
                        Atom stsc @ 29504993 of size: 28, ends @ 29505021
                        Atom stsz @ 29505021 of size: 5326296, ends @ 34831317
                        Atom stco @ 34831317 of size: 5326292, ends @ 40157609
        Atom udta @ 40157609 of size: 96, ends @ 40157705
            Atom meta @ 40157617 of size: 88, ends @ 40157705
                Atom hdlr @ 40157629 of size: 33, ends @ 40157662
                Atom ilst @ 40157662 of size: 43, ends @ 40157705
                    Atom ©too @ 40157670 of size: 35, ends @ 40157705
                        Atom data @ 40157678 of size: 27, ends @ 40157705
    Atom free @ 40157705 of size: 8, ends @ 40157713
    Atom mdat @ 40157713 of size: 1320096566, ends @ 1360254279
  • Assigning of dts values to encoded packets

    24 mars, par Alex

    I have a dump of H264-encoded data, which I need to put in mp4 container. I verified the validity of the encoded data by using mp4box utility against it. The mp4 file created by mp4box contained a proper 17 seconds long video. It is interesting that if I try ffmpeg to achieve the same, the resulting video is 34 seconds long and rather crappy (probably ffmpeg tries to decode video and then encode it, which results in the loss of video quality ?) Anyway, for my project I can't use command line approach and need to come up wit a programmatic way to embed the data in the mp4 container.

    



    Below is the code I use (I removed error checking for brevity. During execution all the calls succeed) :

    



    AVFormatContext* pInputFormatContext = avformat_alloc_context();
avformat_open_input(&pInputFormatContext, "Data.264", NULL, NULL);
avformat_find_stream_info(pInputFormatContext, NULL);
AVRational* pTime_base = &pInputFormatContext->streams[0]->time_base;

int nFrameRate = pInputFormatContext->streams[0]->r_frame_rate.num / pFormatCtx->streams[0]->r_frame_rate.den;
int nWidth = pInputFormatContext->streams[0]->codecpar->width;
int nHeight = pInputFormatContext->streams[0]->codecpar->height;
// nWidth = 1920, nHeight = 1080, nFrameRate = 25

// Create output objects
AVFormatContext* pOutputFormatContext = NULL;
avformat_alloc_output_context2(&pOutputFormatContext, NULL, NULL, "Destination.mp4");

AVCodec* pVideoCodec = avcodec_find_encoder(pOutputFormatContext->oformat->video_codec/*AV_CODEC_ID_264*/);
AVStream* pOutputStream = avformat_new_stream(pOutputFormatContext, NULL);
pOutputStream->id = pOutputFormatContext->nb_streams - 1;
AVCodecContext* pCodecContext = avcodec_alloc_context3(pVideoCodec);

switch (pVideoCodec->type) {
case AVMEDIA_TYPE_VIDEO:
  pCodecContext->codec_id = codec_id;
  pCodecContext->bit_rate = 400000;
  /* Resolution must be a multiple of two. */
  pCodecContext->width = nFrameWidth;
  pCodecContext->height = nFrameHeight;
  /* timebase: This is the fundamental unit of time (in seconds) in terms
  * of which frame timestamps are represented. For fixed-fps content,
  * timebase should be 1/framerate and timestamp increments should be
  * identical to 1. */
  pOutputStream->time_base.num = 1;
  pOutputStream->time_base.den = nFrameRate;
  pCodecContext->time_base = pOutputStream->time_base;
  pCodecContext->gop_size = 12; /* emit one intra frame every twelve frames at most */
  pCodecContext->pix_fmt = STREAM_PIX_FMT;
  break;
default:
  break;
}

/* copy the stream parameters to the muxer */
avcodec_parameters_from_context(pOutputStream->codecpar, pCodecContext);

avio_open(&pOutputFormatContext->pb, "Destination.mp4", AVIO_FLAG_WRITE);

// Start writing
AVDictionary* pDict = NULL;
avformat_write_header(pOutputFormatContext, &pDict);

// Process packets
AVPacket packet;
int64_t nCurrentDts = 0;
int64_t nDuration = 0;
int nReadResult = 0;

while (nReadResult == 0)
{
  nReadResult = av_read_frame(m_pInputFormatContext, &packet);
// At this point, packet.dts == AV_NOPTS_VALUE. 
// The duration field of the packet contains valid data

  packet.flags |= AV_PKT_FLAG_KEY;
  nDuration = packet.duration;
  packet.dts = nCurrentDts;
  packet.dts = av_rescale_q(nCurrentDts, pOutputFormatContext->streams[0]->codec->time_base, pOutputFormatContext->streams[0]->time_base);
  av_interleaved_write_frame(pOutputFormatContext, &packet);
  nCurrentDts += nDuration;
  nDuration += packet.duration;
  av_free_packet(&packet);
}

av_write_trailer(pOutputFormatContext);


    



    The properties for the Destination.mp4 file I receive indicate it is about 1 hour long with frame rate 0. I am sure the culprit is in the way I calculate dts values for each packet and use av_rescale_q(), but I do not have sufficient understanding of the avformat library to figure out the proper way to do it. Any help will be appreciated !