Recherche avancée

Médias (1)

Mot : - Tags -/book

Autres articles (32)

  • Emballe Médias : Mettre en ligne simplement des documents

    29 octobre 2010, par

    Le plugin emballe médias a été développé principalement pour la distribution mediaSPIP mais est également utilisé dans d’autres projets proches comme géodiversité par exemple. Plugins nécessaires et compatibles
    Pour fonctionner ce plugin nécessite que d’autres plugins soient installés : CFG Saisies SPIP Bonux Diogène swfupload jqueryui
    D’autres plugins peuvent être utilisés en complément afin d’améliorer ses capacités : Ancres douces Légendes photo_infos spipmotion (...)

  • Le plugin : Podcasts.

    14 juillet 2010, par

    Le problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
    Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
    Types de fichiers supportés dans les flux
    Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...)

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (5608)

  • avcodec_find_encoder_by_name() returns NULL

    27 décembre 2019, par GiuTor

    I’m trying to compile the following example I found on ffmpeg documentation :

    /*
    * Copyright (c) 2001 Fabrice Bellard
    *
    * Permission is hereby granted, free of charge, to any person obtaining a copy
    * of this software and associated documentation files (the "Software"), to deal
    * in the Software without restriction, including without limitation the rights
    * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    * copies of the Software, and to permit persons to whom the Software is
    * furnished to do so, subject to the following conditions:
    *
    * The above copyright notice and this permission notice shall be included in
    * all copies or substantial portions of the Software.
    *
    * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
    * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    * THE SOFTWARE.
    */

    // compile with gcc -o encode_video encode_video.c -lavutil -lavcodec -lz -lm

    /**
    * @file
    * video encoding with libavcodec API example
    *
    * @example encode_video.c
    */

    #include
    #include
    #include

    #include <libavcodec></libavcodec>avcodec.h>

    #include <libavutil></libavutil>opt.h>
    #include <libavutil></libavutil>imgutils.h>

    static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,
                      FILE *outfile)
    {
       int ret;

       /* send the frame to the encoder */
       if (frame)
           printf("Send frame %3"PRId64"\n", frame->pts);

       ret = avcodec_send_frame(enc_ctx, frame);
       if (ret &lt; 0) {
           fprintf(stderr, "Error sending a frame for encoding\n");
           exit(1);
       }

       while (ret >= 0) {
           ret = avcodec_receive_packet(enc_ctx, pkt);
           if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
               return;
           else if (ret &lt; 0) {
               fprintf(stderr, "Error during encoding\n");
               exit(1);
           }

           printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);
           fwrite(pkt->data, 1, pkt->size, outfile);
           av_packet_unref(pkt);
       }
    }

    int main(int argc, char **argv)
    {
       const char *filename, *codec_name;
       const AVCodec *codec;
       AVCodecContext *c= NULL;
       int i, ret, x, y;
       FILE *f;
       AVFrame *frame;
       AVPacket *pkt;
       uint8_t endcode[] = { 0, 0, 1, 0xb7 };

       if (argc &lt;= 2) {
           fprintf(stderr, "Usage: %s <output file="file"> <codec>\n", argv[0]);
           exit(0);
       }
       filename = argv[1];
       codec_name = argv[2];

       /* find the mpeg1video encoder */
       codec = avcodec_find_encoder_by_name(codec_name);
       if (!codec) {
           fprintf(stderr, "Codec '%s' not found\n", codec_name);
           exit(1);
       }

       c = avcodec_alloc_context3(codec);
       if (!c) {
           fprintf(stderr, "Could not allocate video codec context\n");
           exit(1);
       }

       pkt = av_packet_alloc();
       if (!pkt)
           exit(1);

       /* put sample parameters */
       c->bit_rate = 400000;
       /* resolution must be a multiple of two */
       c->width = 352;
       c->height = 288;
       /* frames per second */
       c->time_base = (AVRational){1, 25};
       c->framerate = (AVRational){25, 1};

       /* emit one intra frame every ten frames
        * check frame pict_type before passing frame
        * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I
        * then gop_size is ignored and the output of encoder
        * will always be I frame irrespective to gop_size
        */
       c->gop_size = 10;
       c->max_b_frames = 1;
       c->pix_fmt = AV_PIX_FMT_YUV420P;

       if (codec->id == AV_CODEC_ID_H264)
           av_opt_set(c->priv_data, "preset", "slow", 0);

       /* open it */
       ret = avcodec_open2(c, codec, NULL);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not open codec: %s\n", av_err2str(ret));
           exit(1);
       }

       f = fopen(filename, "wb");
       if (!f) {
           fprintf(stderr, "Could not open %s\n", filename);
           exit(1);
       }

       frame = av_frame_alloc();
       if (!frame) {
           fprintf(stderr, "Could not allocate video frame\n");
           exit(1);
       }
       frame->format = c->pix_fmt;
       frame->width  = c->width;
       frame->height = c->height;

       ret = av_frame_get_buffer(frame, 32);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not allocate the video frame data\n");
           exit(1);
       }

       /* encode 1 second of video */
       for (i = 0; i &lt; 25; i++) {
           fflush(stdout);

           /* make sure the frame data is writable */
           ret = av_frame_make_writable(frame);
           if (ret &lt; 0)
               exit(1);

           /* prepare a dummy image */
           /* Y */
           for (y = 0; y &lt; c->height; y++) {
               for (x = 0; x &lt; c->width; x++) {
                   frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
               }
           }

           /* Cb and Cr */
           for (y = 0; y &lt; c->height/2; y++) {
               for (x = 0; x &lt; c->width/2; x++) {
                   frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
                   frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
               }
           }

           frame->pts = i;

           /* encode the image */
           encode(c, frame, pkt, f);
       }

       /* flush the encoder */
       encode(c, NULL, pkt, f);

       /* add sequence end code to have a real MPEG file */
       if (codec->id == AV_CODEC_ID_MPEG1VIDEO || codec->id == AV_CODEC_ID_MPEG2VIDEO)
           fwrite(endcode, 1, sizeof(endcode), f);
       fclose(f);

       avcodec_free_context(&amp;c);
       av_frame_free(&amp;frame);
       av_packet_free(&amp;pkt);

       return 0;
    }
    </codec></output>

    ffmpeg -codecs return a bunch of codecs among which libx264 and libx265. When I run the above code I get NULL from avcodec_find_encoder_by_name() :

    gt@gt-Aspire-E1-570 : /libav$ ./encode_video pippo libx264
    Codec ’libx264’ not found
    gt@gt-Aspire-E1-570 : /libav$ ./encode_video pippo x264
    Codec ’x264’ not found
    gt@gt-Aspire-E1-570 : /libav$ ./encode_video pippo H264
    Codec ’H264’ not found
    gt@gt-Aspire-E1-570 : /libav$

    Can someone help please ?

    Thanks

  • FFMPEG Audio/video out of sync after cutting and concatonating

    31 janvier 2020, par Ham789

    I am attempting to take cuts from a set of videos and concatonate them together with the concat demuxer.

    However, each video’s audio is out of sync in the output. At the beggening of each clip there is a short period of silence before the audio begins.

    For each video, I decode it, trim a clip from it and then encode it to 4k resolution at 25 fps with its audio :

    ffmpeg -ss 0.5 -t 0.5 -i input_video1.mp4 -r 25 -vf scale=3840:2160 output_video1.mp4

    I then take each of these videos and concatonate them together with the concat demuxer :

    ffmpeg -f concat -safe 0 -i cut_videos.txt -c copy -y output.mp4

    I am taking short cuts of each video (approximately 0.5s)

    I am using Python’s subprocess to automate the cutting and concatonating of the videos.

    It seems the audio becomes out of sync after the trimming step (not the concatonation) as when I play back the intermediate cut video files (output_video1.mp4 in the above code), there seems to be the same silence before the audio comes in at the start of the video.

    When I concatonate the videos, I get a lot of these warnings :

    [mp4 @ 0000021a252ce080] Non-monotonous DTS in output stream 0:1; previous: 51792, current: 50009; changing to 51793. This may result in incorrect timestamps in the output file.

    From this post, it seems to be a problem with cutting the videos and their timestamps. The solution proposed in the post is to decode, cut and then encode the video however I am already doing that.

    How can I ensure the audio and video are in sync ?

  • ffmpeg - Frames flip upside-down when using -c:v copy

    26 décembre 2019, par Berndi

    I tried to just copy (a period of time of) an AVI-Video into another newly created AVI-file using ffmpeg’s copy option.
    (On Windows 32-bit)

    ffmpeg -i "C:\Temp\zzz\myAvi.avi" -c copy -t 00:00:10 "C:\Temp\zzz\myAviNew.avi"

    Why are the pictures flipped upside-down in the resulting file ?
    (Also the generated new audio is a little distorted.)

    Using the same command again on the newly created file will not flip them back again - the pictures stay upside down.
    Why this ? Is it a bug ?

    Console brings the following output :

    ffmpeg version N-50911-g9efcfbe Copyright (c) 2000-2013 the FFmpeg developers
     built on Mar 13 2013 21:26:48 with gcc 4.7.2 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
    isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
    le-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libg
    sm --enable-libilbc --enable-libmp3lame --enable-libopencore-amrnb --enable-libo
    pencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-li
    bschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-lib
    twolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enabl
    e-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
     libavutil      52. 19.100 / 52. 19.100
     libavcodec     55.  0.100 / 55.  0.100
     libavformat    55.  0.100 / 55.  0.100
     libavdevice    54.  4.100 / 54.  4.100
     libavfilter     3. 45.103 /  3. 45.103
     libswscale      2.  2.100 /  2.  2.100
     libswresample   0. 17.102 /  0. 17.102
     libpostproc    52.  2.100 / 52.  2.100
    [avi @ 02537ba0] non-interleaved AVI
    Guessed Channel Layout for  Input Stream #0.1 : stereo
    Input #0, avi, from 'C:\Temp\zzz\Hase.avi':
     Duration: 00:00:35.92, start: 0.000000, bitrate: 171375 kb/s
       Stream #0:0: Video: rawvideo, bgra, 768x576, 12 tbr, 12 tbn, 12 tbc
       Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, s16
    , 1411 kb/s
    Output #0, avi, to 'C:\Temp\zzz\HaseNew.avi':
     Metadata:
       ISFT            : Lavf55.0.100
       Stream #0:0: Video: rawvideo, bgra, 768x576, q=2-31, 12 tbn, 12 tbc
       Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, stereo, 141
    1 kb/s
    Stream mapping:
     Stream #0:0 -> #0:0 (copy)
     Stream #0:1 -> #0:1 (copy)
    Press [q] to stop, [?] for help
    frame=   11 fps=0.0 q=-1.0 size=   19162kB time=00:00:00.91 bitrate=171242.4kbit
    frame=   16 fps= 12 q=-1.0 size=   27874kB time=00:00:01.33 bitrate=171255.5kbit
    ...
    ...
    ...
    frame=  120 fps=5.4 q=-1.0 size=  209083kB time=00:00:09.99 bitrate=171280.6kbit
    frame=  121 fps=5.5 q=-1.0 Lsize=  210834kB time=00:00:10.08 bitrate=171288.2kbi
    ts/s
    video:209088kB audio:1723kB subtitle:0 global headers:0kB muxing overhead 0.0112
    76%

    C:\WINDOWS\system32>