Recherche avancée

Médias (0)

Mot : - Tags -/latitude

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

Autres articles (63)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • Configuration spécifique d’Apache

    4 février 2011, par

    Modules spécifiques
    Pour la configuration d’Apache, il est conseillé d’activer certains modules non spécifiques à MediaSPIP, mais permettant d’améliorer les performances : mod_deflate et mod_headers pour compresser automatiquement via Apache les pages. Cf ce tutoriel ; mode_expires pour gérer correctement l’expiration des hits. Cf ce tutoriel ;
    Il est également conseillé d’ajouter la prise en charge par apache du mime-type pour les fichiers WebM comme indiqué dans ce tutoriel.
    Création d’un (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (8228)

  • Why we get co located POCs unavailable while encoding a video using ffmpeg ?

    22 août 2019, par geo-freak

    I am trying to encode a video to m3u8 file. I am inserting blackframes when the video has no source in between. I used the following command to encode the video. I found the options in ffmpeg website to insert the filters and blackframes. But I am failing after making some changes as per stackoverflow and from other sources.

    ffmpeg -threads 8 -i input.ts -loop 1 -framerate 30000/1001 -i /usr/local/etc/tv-test-pattern-146649_1280.png -f lavfi -i anullsrc=channel_layout=5.1:sample_rate=48000 -filter_complex "[0:v]setpts=PTS-STARTPTS[v0]; [0:a]asetpts=PTS-STARTPTS[a0]; [v0]scale=320:240,setsar=1[v0-1]; [1:v]scale=320:240,setsar=1[v1]; [v0-1][a0][v1][2:a]insert=v=1:a=1[v][a]" -map [v] -map [a] -vcodec libx264 -r 30 -fsize 320x240 -b:v 512000 -maxrate 512000 -acodec libfdk_aac -b:a 32000 -ac 2 -ar 48000 -force_key_frames expr:gte'(t,n_forced*3)' -hls_flags single_file -hls_list_size 0 -hls_time 3 -fsize 400x222 -preset:v ultrafast -y output.m3u8

    ffmpeg version n4.1.1-5-gbf14903c01 Copyright (c) 2000-2019 the FFmpeg developers
     built with gcc (Debian 6.3.0-18+deb9u1) 6.3.0 20170516
     configuration: --prefix=/opt/ffmpeg --extra-version= --toolchain=hardened --libdir=/opt/ffmpeg/lib/x86_64-linux-gnu --incdir=/opt/ffmpeg/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-nonfree --enable-libfdk_aac --enable-shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libsnappy --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libxvid --enable-libzvbi --enable-openal --enable-opengl --enable-libxcb --enable-libxcb-shm --enable-libxcb-shape --enable-libdc1394 --enable-libiec61883 --enable-libx264 --disable-x86asm
     WARNING: library configuration mismatch

    libavutil      56. 22.100 / 56. 22.100
    libavcodec     58. 35.100 / 58. 35.100
    libavformat    58. 20.100 / 58. 20.100
    libavdevice    58.  5.100 / 58.  5.100
    libavfilter     7. 40.101 /  7. 40.101
    libavresample   4.  0.  0 /  4.  0.  0
    libswscale      5.  3.100 /  5.  3.100
    libswresample   3.  3.100 /  3.  3.100
    libpostproc    55.  3.100 / 55.  3.100

    [h264 @ 0x564c2be0f340] sps_id 0 out of range
    [h264 @ 0x564c2be0f340] SPS unavailable in decode_picture_timing
    [h264 @ 0x564c2be0f340] non-existing PPS 0 referenced
    [h264 @ 0x564c2be0f340] sps_id 0 out of range
    [h264 @ 0x564c2be0f340] SPS unavailable in decode_picture_timing
    [h264 @ 0x564c2be0f340] non-existing PPS 0 referenced
    [h264 @ 0x564c2be0f340] decode_slice_header error
    [h264 @ 0x564c2be0f340] no frame!
    [h264 @ 0x564c2be0f340] sps_id 0 out of range
    [h264 @ 0x564c2be0f340] SPS unavailable in decode_picture_timing
    [h264 @ 0x564c2be0f340] non-existing PPS 0 referenced
    [h264 @ 0x564c2be0f340] sps_id 0 out of range
    [h264 @ 0x564c2be0f340] SPS unavailable in decode_picture_timing
    [h264 @ 0x564c2be0f340] non-existing PPS 0 referenced
    [h264 @ 0x564c2be0f340] decode_slice_header error
    [h264 @ 0x564c2be0f340] no frame!

    input.ts FPS 25.000000 0
    Input #0, mpegts, from 'input.ts':
     Duration: 00:19:51.22, start: 127.107911, bitrate: 1109 kb/s
     Program 1
       Stream #0:0[0x105]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(top first), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc
       Stream #0:1[0x106]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 128 kb/s
    Input #1, png_pipe, from '/usr/local/etc/tv-test-pattern-146649_1280.png':
     Duration: N/A, bitrate: N/A
       Stream #1:0: Video: png, rgba(pc), 1280x960, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Input #2, lavfi, from 'anullsrc=channel_layout=5.1:sample_rate=48000':
     Duration: N/A, start: 0.000000, bitrate: 2304 kb/s
       Stream #2:0: Audio: pcm_u8, 48000 Hz, 5.1, u8, 2304 kb/s

    [libx264 @ 0x564c2be5ea80] VBV maxrate specified, but no bufsize, ignored
    [libx264 @ 0x564c2be5ea80] using SAR=1/1
    [libx264 @ 0x564c2be5ea80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
    [libx264 @ 0x564c2be5ea80] profile Constrained Baseline, level 2.0
    [libx264 @ 0x564c2be5ea80] 264 - core 148 r2748 97eaef2 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=0:0:0 analyse=0:0 me=dia subme=0 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250 keyint_min=25 scenecut=0 intra_refresh=0 rc=abr mbtree=0 bitrate=512 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
    [hls @ 0x564c2be40e80] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
       Last message repeated 1 times

    Output #0, hls, to output.m3u8':
     Metadata:
       encoder         : Lavf58.20.100
       Stream #0:0: Video: h264 (libx264), yuv420p, 320x240 [SAR 1:1 DAR 4:3], q=-1--1, 512 kb/s, 30 fps, 90k tbn, 30 tbc (default)
       Metadata:
         encoder         : Lavc58.35.100 libx264
       Side data:
         cpb: bitrate max/min/avg: 512000/0/512000 buffer size: 0 vbv_delay: -1
       Stream #0:1: Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 32 kb/s (default)
       Metadata:
         encoder         : Lavc58.35.100 libfdk_aac
    Stream mapping:
     Stream #0:0 (h264) -> setpts
     Stream #0:1 (ac3) -> asetpts
     Stream #1:0 (png) -> scale
     Stream #2:0 (pcm_u8) -> insert:in1:a0
     insert:out:v0 -> Stream #0:0 (libx264)
     insert:out:a0 -> Stream #0:1 (libfdk_aac)
    Press [q] to stop, [?] for help
    [h264 @ 0x564c2ce43a40] co located POCs unavailable
    [h264 @ 0x564c2ce53600] co located POCs unavailable
    [h264 @ 0x564c2cef1280] error while decoding MB 43 20, bytestream -5=3 drop=0 speed=0.599x    
    [h264 @ 0x564c2cef1280] concealing 5766 DC, 5766 AC, 5766 MV errors in B frame
    [h264 @ 0x564c2ce53600] co located POCs unavailable
    [h264 @ 0x564c2ce9bac0] co located POCs unavailable
    Past duration 1.189308 too largeN/A time=00:00:01.12 bitrate=N/A dup=6 drop=0 speed=0.714x    
    Past duration 0.989311 too large
    Past duration 0.789314 too large
    [hls @ 0x564c2be40e80] Cannot use rename on non file protocol, this may lead to races and temporary partial files
    [h264 @ 0x564c2ce43a40] concealing 1184 DC, 1184 AC, 1184 MV errors in I frame speed=0.971x    
    [h264 @ 0x564c2cef1280] Reference 3 >= 2=00:00:16.56 bitrate=N/A dup=83 drop=0 speed=0.985x    
    [h264 @ 0x564c2cef1280] error while decoding MB 44 32, bytestream 7180
    [h264 @ 0x564c2cef1280] concealing 4325 DC, 4325 AC, 4325 MV errors in B frame
    [h264 @ 0x564c2cf2a340] co located POCs unavailable
    [h264 @ 0x564c2ce43a40] co located POCs unavailable
    [mpegts @ 0x564c2be0a680] PES packet size mismatch02 bitrate=N/A dup=100 drop=0 speed=0.975x
    frame=22321 fps=0.4 q=-1.0 Lsize=N/A time=00:12:24.03 bitrate=N/A dup=3720 drop=0 speed=0.0126x    
    video:46857kB audio:2907kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

    My questions are

    • Why I’m getting "co located POC’s unavailable"
    • sps_id 0 out of range
    • SPS unavailable in decode_picture_timing
  • Error while decoding Raw H264 frames using ffmpeg

    25 avril 2020, par raullalves

    I would really appreciate some help in this issue. I'm new to FFmpeg, therefore forgive me if this is a dumb question

    



    I have an application streamming H264 raw data from a camera via UDP. That communication works fine. The problem is while trying to decoding

    



    I simply want to decode that data I receive, in order to apply a few Computer Vision techniques to another project.

    



    I got error -22 right after calling

    



    avcodec_send_packet


    



    Does any of you know what could it be ? Here is part of my code

    



    Mat DecodificadorH264::h264decode(char* rawH264, int size){
 ...
 ...
AVPacket av_packet;
av_init_packet(&av_packet);
uint8_t data;
data = *rawH264;
av_packet.data = &data;
av_packet.size = size;

cout << "size = "< avcodec_find_decoder(AV_CODEC_ID_H264);

l_pAVCodecContext = avcodec_alloc_context3(l_pCodec);

l_pAVCodecContext->width = FRAME_WIDTH;
l_pAVCodecContext->height = FRAME_HEIGHT;
l_pAVCodecContext->extradata = NULL;

l_pAVCodecContext->pix_fmt = AV_PIX_FMT_YUV420P;

int av_return = avcodec_send_packet(l_pAVCodecContext,
(AVPacket*)&av_packet);
if (av_return == AVERROR(EINVAL))cout << "codec not opened, or it is an encoder" << endl;
 ....


    



    av_return returns "AVERROR(EINVAL)", which is defined as -22

    



    What could be the problem ?

    



    Thanks in advance !

    


  • Decoding of 16bit gray image encoded with FFV1

    15 juin 2018, par Domin W

    I have a problem with decoding of gray images encoded with FFV1 codec.
    I successfully encode 16 bit gray image (with avcodec_receive_packet(...) function) and save AvPacket data to file. Then I read this data from file and try to decode (with avcodec_decode_video2 or avcodec_send_packet/avcodec_receive_frame) with no success :

    • when I try to decode packet with avcodec_decode_video2 function I get an error "Access violation occurred, unable to write location 0x0000000000000000".
    • when I try to decode packet with avcodec_send_packet/avcodec_receive_frame functions I get an error "chroma shift parameters 7 0 are invalid".

    I compared packets after encoding and before decoding and all fields and values seems to be the same. I even try to decode packet just after avcodec_receive_packet (encoding function), however with the same error.

    I use the 4.0 version of ffmpeg and the program is based on decode_video.c and encode_video.c examples.
    When I use containers (eg. avi) to support read/write encoded images from file (based on demuxing_decoding.c and muxing.c examples) I successfully encode and decode frames with FFV1. However I cannot use containers, because I want to encode frames with different resolutions and mix few video sources together. Additionally the compression level is significantly lower (falls from 2.9 to 2.2) for few hundred of images, what is also very surprising.

    So my question is how to correctly save/read (from binary file not container) and prepare AVPacker for decoding with FFV1.

    Any help is greatly appreciated.

    The decoding code :

    extern "C" {
    #include <libavcodec></libavcodec>avcodec.h>
    #include <libavutil></libavutil>opt.h>
    #include <libavutil></libavutil>imgutils.h>
    }
    #pragma warning(disable: 4996)
    #define INBUF_SIZE 4096
    #define FF_INPUT_BUFFER_PADDING_SIZE 64

    uint8_t endcode[4];
    AVCodecContext *c, c2;
    AVCodec *codec;
    int i, ret, x, y;
    AVFrame *frame;
    AVPacket *pkt, *pkt_temp;

    FILE *encodedVideoFile;
    AVDictionary *opts = NULL;
    uint8_t *video_dst_data[4] = { NULL };
    int      video_dst_linesize[4];
    int imageSize;
    uint8_t inbuf[INBUF_SIZE + AV_INPUT_BUFFER_PADDING_SIZE];
    /* flush the encoder */
       frame = NULL;
       encode();
       /* add sequence end code to have a real MPEG file */
       //fwrite(endcode, 1, sizeof(endcode), encodedVideoFile);
       fclose(encodedVideoFile);
       avcodec_free_context(&amp;c);
       av_frame_free(&amp;frame);
       av_packet_free(&amp;pkt);
    }

    void initDecoding(const char *filename)
    {
       /* set end of buffer to 0 (this ensures that no overreading happens for damaged MPEG streams) */
       memset(inbuf + INBUF_SIZE, 0, AV_INPUT_BUFFER_PADDING_SIZE);
       /* find the MPEG-1 video decoder */
       codec = avcodec_find_decoder(AV_CODEC_ID_FFV1);
       if (!codec) {
           fprintf(stderr, "Codec not found\n");
           exit(1);
       }

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

       /* resolution must be a multiple of two */
       c->width = 1280;
       c->height = 484;
       /* frames per second */
       c->time_base.den = 1;
       c->time_base.num = 10;
       c->bits_per_raw_sample = 16;

       c->framerate.den = 10;
       c->framerate.num = 1;

       c->pix_fmt = AV_PIX_FMT_GRAY16;

       //Version of FFV1 codec
       c->level = 3;

       /* Init the decoders, with or without reference counting */
       av_dict_set(&amp;opts, "refcounted_frames", 0 ? "1" : "0", 0);
       if ((ret = avcodec_open2(c, codec, &amp;opts)) &lt; 0) {
           return;
       }

       if (avcodec_open2(c, codec, NULL) &lt; 0) {
           fprintf(stderr, "Could not open codec\n");
           exit(1);
       }

       ret = av_image_alloc(video_dst_data, video_dst_linesize,
           c->width, c->height, c->pix_fmt, 4);
       if (ret &lt; 0) {
           fprintf(stderr, "Could not allocate raw video buffer\n");
       }

       encodedVideoFile = fopen(filename, "rb");
       if (!encodedVideoFile) {
           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);
       }

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

    void closeDecoding()
    {
       fclose(encodedVideoFile);
       av_parser_close(parser);
       avcodec_free_context(&amp;c);
       av_frame_free(&amp;frame);
       av_packet_free(&amp;pkt);
    }

    void decodePacket()
    {
       size_t data_size;
       int *got_frame = 0;

       read_packt_from_file(pkt, encodedVideoFile);        

       ret = av_frame_is_writable(frame);

       //First decoding function
       /*ret = avcodec_decode_video2(c, frame, got_frame, pkt);
       if (ret &lt; 0) {
           fprintf(stderr, "Error decoding video frame (%s)\n");

       }*/

       ret = avcodec_send_packet(c, pkt);
       if (ret &lt; 0) {
           fprintf(stderr, "Error sending a packet for decoding\n");
           exit(1);
       }
       while (ret >= 0) {
           ret = avcodec_receive_frame(c, frame);
           if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
               return;
           else if (ret &lt; 0) {
               fprintf(stderr, "Error during decoding\n");
               exit(1);
           }
           printf("saving frame %3d\n", c->frame_number);

           fflush(stdout);

       }

    }

    size_t read_packt_from_file(AVPacket *packet, FILE *file)
    {
       size_t ret = 0;
       int size;
       uint8_t * data;
       //av_packet_from_data
       ret = fread(packet, sizeof(AVPacket), 1, file);
       size = packet->size;
       data = new uint8_t[size];
       ret = fread(data, size, 1, file);
       av_new_packet(packet, size);
       av_packet_from_data(packet, data, size);

       return ret;
    }
    //To write encoded AVPacket
    size_t write_packt_to_file(AVPacket *packet, FILE *file)
    {
       size_t ret = 0;
       ret = fwrite(packet, sizeof(AVPacket), 1, file);
       ret = fwrite(packet->data, packet->size, 1, file);
       if (packet->buf) {
           fwrite(packet->buf->data, packet->buf->size, 1, file);
       }
       fflush(file);
       return ret;
    }