Recherche avancée

Médias (0)

Mot : - Tags -/médias

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

Autres articles (93)

  • Personnaliser les catégories

    21 juin 2013, par

    Formulaire de création d’une catégorie
    Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
    Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
    On peut modifier ce formulaire dans la partie :
    Administration > Configuration des masques de formulaire.
    Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
    Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Création définitive du canal

    12 mars 2010, par

    Lorsque votre demande est validée, vous pouvez alors procéder à la création proprement dite du canal. Chaque canal est un site à part entière placé sous votre responsabilité. Les administrateurs de la plateforme n’y ont aucun accès.
    A la validation, vous recevez un email vous invitant donc à créer votre canal.
    Pour ce faire il vous suffit de vous rendre à son adresse, dans notre exemple "http://votre_sous_domaine.mediaspip.net".
    A ce moment là un mot de passe vous est demandé, il vous suffit d’y (...)

Sur d’autres sites (6526)

  • 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;
    }
  • encoding with ffmpeg libx265 -pix_fmt gray gives unplayable vid

    9 juin 2017, par netjiro

    What am I missing ?
    I encode an old black and white film clip with ffmpeg libx265 passing -pix_fmt gray. The output is unplayable in both vlc and mplayer (linux), so I assume I’m missing something...

    encoding :

    ffmpeg -i clip.mkv \
       -c:v libx265 -preset slow -x265-params "crf=24" -pix_fmt gray \
       -c:a libopus -b:a 64k \
       -c:s copy \
       out.mkv

    vlc errors :

    [00007f8a3ddfe328] blend blend error: no matching alpha blending routine (chroma: RGBA -> GREY)
    [00007f8a3ddfe328] core blend error: blending RGBA to GREY failed
    ... repeated ...

    mplayer errors :

    Unexpected decoder output format Planar Y800
    ... repeated ...

    ffmpeg encoding output :

    ffmpeg version 3.2.4 Copyright (c) 2000-2017 the FFmpeg developers
     built with gcc 4.9.4 (Gentoo 4.9.4 p1.0, pie-0.6.4)
     configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --docdir=/usr/share/doc/ffmpeg-3.2.4/html --mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc --cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-march=native -O2 -pipe' --disable-static --enable-avfilter --enable-avresample --disable-stripping --enable-nonfree --enable-version3 --disable-indev=oss --disable-indev=jack --disable-outdev=oss --enable-version3 --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-gcrypt --disable-gnutls --disable-gmp --enable-gpl --enable-hardcoded-tables --enable-iconv --enable-lzma --enable-network --enable-openssl --enable-postproc --disable-libsmbclient --enable-ffplay --enable-sdl2 --enable-vaapi --enable-vdpau --enable-xlib --enable-libxcb --enable-libxcb-shm --enable-libxcb-xfixes --enable-zlib --enable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --enable-openal --enable-opengl --enable-libv4l2 --disable-libpulse --enable-libopencore-amrwb --enable-libopencore-amrnb --disable-libfdk-aac --enable-libopenjpeg --enable-libbluray --enable-libcelt --disable-libgme --disable-libgsm --disable-mmal --enable-libmodplug --enable-libopus --disable-libilbc --disable-librtmp --enable-libssh --enable-libschroedinger --enable-libspeex --enable-libvorbis --enable-libvpx --disable-libzvbi --disable-libbs2b --disable-chromaprint --disable-libebur128 --disable-libflite --disable-frei0r --disable-libfribidi --enable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-librubberband --disable-libzimg --enable-libsoxr --enable-pthreads --enable-libvo-amrwbenc --enable-libmp3lame --disable-libkvazaar --disable-nvenc --disable-libopenh264 --enable-libsnappy --enable-libtheora --enable-libtwolame --enable-libwavpack --disable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --disable-amd3dnow --disable-amd3dnowext --disable-fma4 --disable-xop --cpu=host --disable-doc --disable-htmlpages --enable-manpages
     libavutil      55. 34.101 / 55. 34.101
     libavcodec     57. 64.101 / 57. 64.101
     libavformat    57. 56.101 / 57. 56.101
     libavdevice    57.  1.100 / 57.  1.100
     libavfilter     6. 65.100 /  6. 65.100
     libavresample   3.  1.  0 /  3.  1.  0
     libswscale      4.  2.100 /  4.  2.100
     libswresample   2.  3.100 /  2.  3.100
     libpostproc    54.  1.100 / 54.  1.100
    x265 [info]: HEVC encoder version 2.2
    x265 [info]: build info [Linux][GCC 4.9.4][64 bit] 8bit+10bit+12bit
    x265 [info]: using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
    x265 [info]: Unknown profile, Level-3.1 (Main tier)
    x265 [warning]: No thread pool allocated, --wpp disabled
    x265 [warning]: No thread pool allocated, --lookahead-slices disabled
    x265 [info]: Slices                              : 1
    x265 [info]: frame threads / pool features       : 3 / none
    x265 [info]: Coding QT: max CU size, min CU size : 64 / 8
    x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
    x265 [info]: ME / range / subpel / merge         : star / 57 / 3 / 3
    x265 [info]: Keyframe min / max / scenecut / bias: 23 / 250 / 40 / 5.00
    x265 [info]: Lookahead / bframes / badapt        : 25 / 4 / 2
    x265 [info]: b-pyramid / weightp / weightb       : 1 / 1 / 0
    x265 [info]: References / ref-limit  cu / depth  : 4 / on / on
    x265 [info]: AQ: mode / str / qg-size / cu-tree  : 1 / 1.0 / 32 / 1
    x265 [info]: Rate Control / qCompress            : CRF-24.0 / 0.60
    x265 [info]: tools: rect limit-modes rd=4 psy-rd=2.00 rdoq=2 psy-rdoq=1.00
    x265 [info]: tools: rskip signhide tmvp strong-intra-smoothing deblock sao
    Output #0, matroska, to 'out.mkv':
     Metadata:
       encoder         : Lavf57.56.101
       Metadata:
       Stream #0:0(eng): Video: hevc (libx265), gray, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 23.98 fps, 1k tbn, 23.98 tbc (default)
       Metadata:
         encoder         : Lavc57.64.101 libx265
       Stream #0:1(eng): Audio: opus (libopus) ([255][255][255][255] / 0xFFFFFFFF), 48000 Hz, stereo, flt, 64 kb/s (default)
       Metadata:
         encoder         : Lavc57.64.101 libopus
       Stream #0:2(eng): Subtitle: subrip (default)
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
     Stream #0:1 -> #0:1 (eac3 (native) -> opus (libopus))
     Stream #0:3 -> #0:2 (copy)
    Press [q] to stop, [?] for help
    frame= 1439 fps=7.0 q=-0.0 Lsize=    5356kB time=00:01:00.01 bitrate= 731.1kbits/s speed=0.294x    
    video:4940kB audio:382kB subtitle:1kB other streams:0kB global headers:2kB muxing overhead: 0.629434%
    x265 [info]: frame I:      9, Avg QP:22.27  kb/s: 6064.82
    x265 [info]: frame P:    340, Avg QP:23.62  kb/s: 1950.21
    x265 [info]: frame B:   1090, Avg QP:29.65  kb/s: 230.75  
    x265 [info]: Weighted P-Frames: Y:0.9% UV:0.0%
    x265 [info]: consecutive B-frames: 2.9% 0.3% 1.4% 72.5% 22.9%
  • Infrequent ffmpeg in Google Cloud

    17 février 2020, par suztomo

    Which service should I use for my Go program that runs ffmpeg in Google Cloud Platform ?

    The Go program downloads videos from my Google Cloud Storage and runs ffmpeg command to combine them into 5 minutes mp4 file. I use this program only around 10 times in a month.

    I thought of using a compute instance with GPU to get fast ffmpeg processing. However, because of infrequency of the invocation, I don’t want to run the pricey GPU instance for all the time. Cloud Run does not seem to support GPU.

    What service would you choose for such workload ?