Recherche avancée

Médias (0)

Mot : - Tags -/tags

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

Autres articles (47)

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

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

Sur d’autres sites (8958)

  • Unable to encode H264 video using FFMPEG example

    4 mai 2020, par Basit Anwer

    FFMPEG encode example fails to create a H264 video. MPEG1 works fine though.

    



    Pasting the code here as well

    



    &#xA;     * @file&#xA;     * video encoding with libavcodec API example&#xA;     *&#xA;     * @example encode_video.c&#xA;     */&#xA;    #include &#xA;    #include &#xA;    #include &#xA;    #include <libavcodec></libavcodec>avcodec.h>&#xA;    #include <libavutil></libavutil>opt.h>&#xA;    #include <libavutil></libavutil>imgutils.h>&#xA;    static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,&#xA;                       FILE *outfile)&#xA;    {&#xA;        int ret;&#xA;        /* send the frame to the encoder */&#xA;        if (frame)&#xA;            printf("Send frame %3"PRId64"\n", frame->pts);&#xA;        ret = avcodec_send_frame(enc_ctx, frame);&#xA;        if (ret &lt; 0) {&#xA;            fprintf(stderr, "Error sending a frame for encoding\n");&#xA;            exit(1);&#xA;        }&#xA;        while (ret >= 0) {&#xA;            ret = avcodec_receive_packet(enc_ctx, pkt);&#xA;            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                return;&#xA;            else if (ret &lt; 0) {&#xA;                fprintf(stderr, "Error during encoding\n");&#xA;                exit(1);&#xA;            }&#xA;            printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);&#xA;            fwrite(pkt->data, 1, pkt->size, outfile);&#xA;            av_packet_unref(pkt);&#xA;        }&#xA;    }&#xA;&#xA;    int main(int argc, char **argv)&#xA;    {&#xA;        const char *filename, *codec_name;&#xA;        const AVCodec *codec;&#xA;        AVCodecContext *c= NULL;&#xA;        int i, ret, x, y;&#xA;        FILE *f;&#xA;        AVFrame *frame;&#xA;        AVPacket *pkt;&#xA;        uint8_t endcode[] = { 0, 0, 1, 0xb7 };&#xA;        if (argc &lt;= 2) {&#xA;            fprintf(stderr, "Usage: %s <output file="file"> <codec>\n", argv[0]);&#xA;            exit(0);&#xA;        }&#xA;        filename = argv[1];&#xA;        codec_name = argv[2];&#xA;        /* find the mpeg1video encoder */&#xA;        codec = avcodec_find_encoder_by_name(codec_name);&#xA;        if (!codec) {&#xA;            fprintf(stderr, "Codec &#x27;%s&#x27; not found\n", codec_name);&#xA;            exit(1);&#xA;        }&#xA;        c = avcodec_alloc_context3(codec);&#xA;        if (!c) {&#xA;            fprintf(stderr, "Could not allocate video codec context\n");&#xA;            exit(1);&#xA;        }&#xA;        pkt = av_packet_alloc();&#xA;        if (!pkt)&#xA;            exit(1);&#xA;        /* put sample parameters */&#xA;        c->bit_rate = 400000;&#xA;        /* resolution must be a multiple of two */&#xA;        c->width = 352;&#xA;        c->height = 288;&#xA;        /* frames per second */&#xA;        c->time_base = (AVRational){1, 25};&#xA;        c->framerate = (AVRational){25, 1};&#xA;        /* emit one intra frame every ten frames&#xA;         * check frame pict_type before passing frame&#xA;         * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I&#xA;         * then gop_size is ignored and the output of encoder&#xA;         * will always be I frame irrespective to gop_size&#xA;         */&#xA;        c->gop_size = 10;&#xA;        c->max_b_frames = 1;&#xA;        c->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;        if (codec->id == AV_CODEC_ID_H264)&#xA;            av_opt_set(c->priv_data, "preset", "slow", 0);&#xA;        /* open it */&#xA;        ret = avcodec_open2(c, codec, NULL);&#xA;        if (ret &lt; 0) {&#xA;            fprintf(stderr, "Could not open codec: %s\n", av_err2str(ret));&#xA;            exit(1);&#xA;        }&#xA;        f = fopen(filename, "wb");&#xA;        if (!f) {&#xA;            fprintf(stderr, "Could not open %s\n", filename);&#xA;            exit(1);&#xA;        }&#xA;        frame = av_frame_alloc();&#xA;        if (!frame) {&#xA;            fprintf(stderr, "Could not allocate video frame\n");&#xA;            exit(1);&#xA;        }&#xA;        frame->format = c->pix_fmt;&#xA;        frame->width  = c->width;&#xA;        frame->height = c->height;&#xA;        ret = av_frame_get_buffer(frame, 32);&#xA;        if (ret &lt; 0) {&#xA;            fprintf(stderr, "Could not allocate the video frame data\n");&#xA;            exit(1);&#xA;        }&#xA;        /* encode 1 second of video */&#xA;        for (i = 0; i &lt; 25; i&#x2B;&#x2B;) {&#xA;            fflush(stdout);&#xA;            /* make sure the frame data is writable */&#xA;            ret = av_frame_make_writable(frame);&#xA;            if (ret &lt; 0)&#xA;                exit(1);&#xA;            /* prepare a dummy image */&#xA;            /* Y */&#xA;            for (y = 0; y &lt; c->height; y&#x2B;&#x2B;) {&#xA;                for (x = 0; x &lt; c->width; x&#x2B;&#x2B;) {&#xA;                    frame->data[0][y * frame->linesize[0] &#x2B; x] = x &#x2B; y &#x2B; i * 3;&#xA;                }&#xA;            }&#xA;            /* Cb and Cr */&#xA;            for (y = 0; y &lt; c->height/2; y&#x2B;&#x2B;) {&#xA;                for (x = 0; x &lt; c->width/2; x&#x2B;&#x2B;) {&#xA;                    frame->data[1][y * frame->linesize[1] &#x2B; x] = 128 &#x2B; y &#x2B; i * 2;&#xA;                    frame->data[2][y * frame->linesize[2] &#x2B; x] = 64 &#x2B; x &#x2B; i * 5;&#xA;                }&#xA;            }&#xA;            frame->pts = i;&#xA;            /* encode the image */&#xA;            encode(c, frame, pkt, f);&#xA;        }&#xA;        /* flush the encoder */&#xA;        encode(c, NULL, pkt, f);&#xA;        /* add sequence end code to have a real MPEG file */&#xA;        if (codec->id == AV_CODEC_ID_MPEG1VIDEO || codec->id == AV_CODEC_ID_MPEG2VIDEO)&#xA;            fwrite(endcode, 1, sizeof(endcode), f);&#xA;        fclose(f);&#xA;        avcodec_free_context(&amp;c);&#xA;        av_frame_free(&amp;frame);&#xA;        av_packet_free(&amp;pkt);&#xA;        return 0;&#xA;    }&#xA;</codec></output>

    &#xA;&#xA;

    The code fails at encode call and every avcodec_receive_packet call returns AVERROR(EAGAIN)

    &#xA;&#xA;

    What am i missing here ?

    &#xA;

  • Unable to encode H264 video using FFMPEG example

    4 mai 2020, par Basit Anwer

    FFMPEG encode example fails to create a H264 video. MPEG1 works fine though.

    &#xA;&#xA;

    Pasting the code here as well

    &#xA;&#xA;

    &#xA;     * @file&#xA;     * video encoding with libavcodec API example&#xA;     *&#xA;     * @example encode_video.c&#xA;     */&#xA;    #include &#xA;    #include &#xA;    #include &#xA;    #include <libavcodec></libavcodec>avcodec.h>&#xA;    #include <libavutil></libavutil>opt.h>&#xA;    #include <libavutil></libavutil>imgutils.h>&#xA;    static void encode(AVCodecContext *enc_ctx, AVFrame *frame, AVPacket *pkt,&#xA;                       FILE *outfile)&#xA;    {&#xA;        int ret;&#xA;        /* send the frame to the encoder */&#xA;        if (frame)&#xA;            printf("Send frame %3"PRId64"\n", frame->pts);&#xA;        ret = avcodec_send_frame(enc_ctx, frame);&#xA;        if (ret &lt; 0) {&#xA;            fprintf(stderr, "Error sending a frame for encoding\n");&#xA;            exit(1);&#xA;        }&#xA;        while (ret >= 0) {&#xA;            ret = avcodec_receive_packet(enc_ctx, pkt);&#xA;            if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)&#xA;                return;&#xA;            else if (ret &lt; 0) {&#xA;                fprintf(stderr, "Error during encoding\n");&#xA;                exit(1);&#xA;            }&#xA;            printf("Write packet %3"PRId64" (size=%5d)\n", pkt->pts, pkt->size);&#xA;            fwrite(pkt->data, 1, pkt->size, outfile);&#xA;            av_packet_unref(pkt);&#xA;        }&#xA;    }&#xA;&#xA;    int main(int argc, char **argv)&#xA;    {&#xA;        const char *filename, *codec_name;&#xA;        const AVCodec *codec;&#xA;        AVCodecContext *c= NULL;&#xA;        int i, ret, x, y;&#xA;        FILE *f;&#xA;        AVFrame *frame;&#xA;        AVPacket *pkt;&#xA;        uint8_t endcode[] = { 0, 0, 1, 0xb7 };&#xA;        if (argc &lt;= 2) {&#xA;            fprintf(stderr, "Usage: %s <output file="file"> <codec>\n", argv[0]);&#xA;            exit(0);&#xA;        }&#xA;        filename = argv[1];&#xA;        codec_name = argv[2];&#xA;        /* find the mpeg1video encoder */&#xA;        codec = avcodec_find_encoder_by_name(codec_name);&#xA;        if (!codec) {&#xA;            fprintf(stderr, "Codec &#x27;%s&#x27; not found\n", codec_name);&#xA;            exit(1);&#xA;        }&#xA;        c = avcodec_alloc_context3(codec);&#xA;        if (!c) {&#xA;            fprintf(stderr, "Could not allocate video codec context\n");&#xA;            exit(1);&#xA;        }&#xA;        pkt = av_packet_alloc();&#xA;        if (!pkt)&#xA;            exit(1);&#xA;        /* put sample parameters */&#xA;        c->bit_rate = 400000;&#xA;        /* resolution must be a multiple of two */&#xA;        c->width = 352;&#xA;        c->height = 288;&#xA;        /* frames per second */&#xA;        c->time_base = (AVRational){1, 25};&#xA;        c->framerate = (AVRational){25, 1};&#xA;        /* emit one intra frame every ten frames&#xA;         * check frame pict_type before passing frame&#xA;         * to encoder, if frame->pict_type is AV_PICTURE_TYPE_I&#xA;         * then gop_size is ignored and the output of encoder&#xA;         * will always be I frame irrespective to gop_size&#xA;         */&#xA;        c->gop_size = 10;&#xA;        c->max_b_frames = 1;&#xA;        c->pix_fmt = AV_PIX_FMT_YUV420P;&#xA;        if (codec->id == AV_CODEC_ID_H264)&#xA;            av_opt_set(c->priv_data, "preset", "slow", 0);&#xA;        /* open it */&#xA;        ret = avcodec_open2(c, codec, NULL);&#xA;        if (ret &lt; 0) {&#xA;            fprintf(stderr, "Could not open codec: %s\n", av_err2str(ret));&#xA;            exit(1);&#xA;        }&#xA;        f = fopen(filename, "wb");&#xA;        if (!f) {&#xA;            fprintf(stderr, "Could not open %s\n", filename);&#xA;            exit(1);&#xA;        }&#xA;        frame = av_frame_alloc();&#xA;        if (!frame) {&#xA;            fprintf(stderr, "Could not allocate video frame\n");&#xA;            exit(1);&#xA;        }&#xA;        frame->format = c->pix_fmt;&#xA;        frame->width  = c->width;&#xA;        frame->height = c->height;&#xA;        ret = av_frame_get_buffer(frame, 32);&#xA;        if (ret &lt; 0) {&#xA;            fprintf(stderr, "Could not allocate the video frame data\n");&#xA;            exit(1);&#xA;        }&#xA;        /* encode 1 second of video */&#xA;        for (i = 0; i &lt; 25; i&#x2B;&#x2B;) {&#xA;            fflush(stdout);&#xA;            /* make sure the frame data is writable */&#xA;            ret = av_frame_make_writable(frame);&#xA;            if (ret &lt; 0)&#xA;                exit(1);&#xA;            /* prepare a dummy image */&#xA;            /* Y */&#xA;            for (y = 0; y &lt; c->height; y&#x2B;&#x2B;) {&#xA;                for (x = 0; x &lt; c->width; x&#x2B;&#x2B;) {&#xA;                    frame->data[0][y * frame->linesize[0] &#x2B; x] = x &#x2B; y &#x2B; i * 3;&#xA;                }&#xA;            }&#xA;            /* Cb and Cr */&#xA;            for (y = 0; y &lt; c->height/2; y&#x2B;&#x2B;) {&#xA;                for (x = 0; x &lt; c->width/2; x&#x2B;&#x2B;) {&#xA;                    frame->data[1][y * frame->linesize[1] &#x2B; x] = 128 &#x2B; y &#x2B; i * 2;&#xA;                    frame->data[2][y * frame->linesize[2] &#x2B; x] = 64 &#x2B; x &#x2B; i * 5;&#xA;                }&#xA;            }&#xA;            frame->pts = i;&#xA;            /* encode the image */&#xA;            encode(c, frame, pkt, f);&#xA;        }&#xA;        /* flush the encoder */&#xA;        encode(c, NULL, pkt, f);&#xA;        /* add sequence end code to have a real MPEG file */&#xA;        if (codec->id == AV_CODEC_ID_MPEG1VIDEO || codec->id == AV_CODEC_ID_MPEG2VIDEO)&#xA;            fwrite(endcode, 1, sizeof(endcode), f);&#xA;        fclose(f);&#xA;        avcodec_free_context(&amp;c);&#xA;        av_frame_free(&amp;frame);&#xA;        av_packet_free(&amp;pkt);&#xA;        return 0;&#xA;    }&#xA;</codec></output>

    &#xA;&#xA;

    The code fails at encode call and every avcodec_receive_packet call returns AVERROR(EAGAIN)

    &#xA;&#xA;

    What am i missing here ?

    &#xA;

  • Interlaced (1080i) video converted to deinterlaced (1080p) won't play in Quicktime or other players, except VLC

    24 avril 2020, par cozmonaut

    I'm trying to convert a 1080i ts video clip to 1080p mp4. I've found many different ffmpeg commands to do this, which all successfully convert to 1080p mp4, however, none of generated clips will open in Quicktime or any another other player, other than VLC. I've read about the need to have the correct color space (i.e. yuv420p) for Quicktime to work, and also that 10 bit files won't work (only 8 bit). However, when these things have been accounted for, the resulting video clips still won't open in Quicktime.

    &#xA;&#xA;

    &#xA;&#xA;

    Here are the commands I've tried.

    &#xA;&#xA;

        ffmpeg -i test_original_interlaced.ts -vf bwdif -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -c:a aac -b:a 320k test_generated_progressive.mp4&#xA;&#xA;    ffmpeg -i test_original_interlaced.ts  -vf yadif -c:v libx264 -preset slow -crf 19 -c:a aac -b:a 256k test_generated_progressive.mp4&#xA;&#xA;    ffmpeg -i test_original_interlaced.ts  -vf yadif -c:v libx264 -preset slow -crf 18 -pix_fmt yuv420p -c:a aac -b:a 256k test_generated_progressive.mp4&#xA;&#xA;    ffmpeg -i test_original_interlaced.ts -vf yadif=parity=auto test_generated_progressive.mp4&#xA;

    &#xA;&#xA;

    &#xA;&#xA;

    Here are the 1080i ts details and link to the original video clip :

    &#xA;&#xA;

    ffmpeg version 4.2.1-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)&#xA;  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-libvmaf --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&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, mpegts, from &#x27;/Users/test_original_interlaced.ts&#x27;:&#xA;  Duration: 00:00:05.26, start: 1.400000, bitrate: 15183 kb/s&#xA;  Program 1 &#xA;    Metadata:&#xA;      service_name    : Service01&#xA;      service_provider: FFmpeg&#xA;    Stream #0:0[0x100]: Video: mpeg2video (Main) ([2][0][0][0] / 0x0002), yuv420p(tv, top first), 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc&#xA;    Stream #0:1[0x101](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, 5.1(side), fltp, 384 kb/s&#xA;

    &#xA;&#xA;

    Link to original video clip (10 MB) : https://www.dropbox.com/s/85tv3v91lflfpon/test_original_interlaced.ts?dl=0

    &#xA;&#xA;

    &#xA;&#xA;

    Here are the 1080p mp4 details and link to the generated video clip (that won't open in Quicktime) :

    &#xA;&#xA;

    ffmpeg version 4.2.1-tessus  https://evermeet.cx/ffmpeg/  Copyright (c) 2000-2019 the FFmpeg developers&#xA;  built with Apple LLVM version 10.0.1 (clang-1001.0.46.4)&#xA;  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-libvmaf --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&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Guessed Channel Layout for Input Stream #0.1 : 5.1&#xA;Input #0, mov,mp4,m4a,3gp,3g2,mj2, from &#x27;/Users/test_generated_progressive.mp4&#x27;:&#xA;  Metadata:&#xA;    major_brand     : isom&#xA;    minor_version   : 512&#xA;    compatible_brands: isomiso2avc1mp41&#xA;    encoder         : Lavf58.29.100&#xA;  Duration: 00:00:05.27, start: 0.000000, bitrate: 9873 kb/s&#xA;    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 9543 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)&#xA;    Metadata:&#xA;      handler_name    : VideoHandler&#xA;    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 319 kb/s (default)&#xA;    Metadata:&#xA;      handler_name    : SoundHandler&#xA;

    &#xA;&#xA;

    Link to generated video clip (6.5 MB) : https://www.dropbox.com/s/w744mdee5drvmya/test_generated_progressive.mp4?dl=0

    &#xA;&#xA;

    &#xA;&#xA;

    Any help would be greatly appreciated.

    &#xA;&#xA;

    Thank you.

    &#xA;