Recherche avancée

Médias (1)

Mot : - Tags -/ogv

Autres articles (79)

  • Organiser par catégorie

    17 mai 2013, par

    Dans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
    Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
    Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

Sur d’autres sites (3063)

  • FFMPEG Runs OK locally but fails when run on Heroku server

    9 mars 2017, par Berni

    I’m working on a project which takes a video and converts it to a sprite sheet image.

    When I run the app locally using npm start the video uploads and the sprite sheet is generated.

    However when I deploy the app to Heroku and perform the same actions I get the following errors from the Heroku log :

    2017-03-09T16:03:43.069886+00:00 app[web.1]: error: ffmpeg exited with code 1: Error while opening encoder for output stream #23:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    2017-03-09T16:03:43.069897+00:00 app[web.1]:
    2017-03-09T16:03:43.069922+00:00 app[web.1]: stdout:

    2017-03-09T16:03:43.069989+00:00 app[web.1]: stderr:   split:output4 (graph 0) -> Stream #5:0 (png)

    2017-03-09T16:03:43.070083+00:00 app[web.1]: Error while opening encoder for output stream #23:0 - maybe incorrect parameters such as bit_rate, rate, width or height

    I’ve checked that the bit_rate, rate, width and height are all correctly set.

    Any advice on how to get this resolved would be appreciated :)

  • How to extract small video chunk with ffmpeg ?

    3 décembre 2017, par Édouard Lopez

    I’m writing a script to split a video in multiple small files based on subtitles timing. Each chunk illustrated how to sign a word LSF (French Sign Language).

    However, some file are blank once extracted and when converted to webm they are 0kb.

    Timing data

    I extract the timing from a .ass file to get this kind of file

    0:00:01.01 0:00:04.07
    0:00:04.09 0:00:07.00
    0:00:07.00 0:00:10.36
    0:00:10.36 0:00:13.28

    First column is start_time, second is end_time

    Extraction

    extract_word_chunk() {
     ffmpeg \
       -i "$INPUT_FILE" \
       -ss "$start" \
       -to "$end" \
       -vcodec copy \
       -acodec copy \
       -loglevel error \
       "$chunk" < /dev/null
    }

    Conversion to webm

    convert_to_webm() {
     ffmpeg \
       -y \
       -i "$chunk" \
       -acodec libvorbis \
       -codec:v libvpx \
       -b:v 192k \
       -b:a 96k \
       -minrate 128k \
       -maxrate 256k \
       -bufsize 192k \
       -quality good \
       -cpu-used 2 \
       -deadline best \
       -loglevel error \
     "$chunk.webm" < /dev/null
    }

    Output

    # extract_word_chunk
    ffmpeg \
     -i 'assets/raw/partie 1: Apprendre 300 mots du quotidien en LSF.jauvert laura.mkv' \
     -ss 0:00:01.01 \
     -to 0:00:04.07 \
     -vcodec copy \
     -acodec copy \
     -loglevel error \
     assets/raw/0:00:01.01.mkv

    # convert_to_webm
    ffmpeg -y \
     -i assets/raw/0:00:01.01.mkv \
     -acodec libvorbis \
     -codec:v libvpx \
     -b:v 192k \
     -b:a 96k \
     -minrate 128k \
     -maxrate 256k \
     -bufsize 192k \
     -quality good \
     -cpu-used 2 \
     -deadline best \
     -loglevel error \
     assets/raw/0:00:01.01.mkv.webm

    Error

    [buffer @ 0x16d8be0] Unable to parse option value "-1" as pixel format
       Last message repeated 1 times
    [buffer @ 0x16d8be0] Error setting option pix_fmt to value -1.
    [graph 0 input from stream 0:0 @ 0x16e6fc0] Error applying options to the filter.

    Question

    Only some chunk are blank/empty.

    How do I prevent my video to be blank/empty ?

  • ffmpeg memory leak in the avcodec_open2 method

    21 août 2019, par unresolved_external

    I’ve developed an application which handles live video stream. The problem is that it should run as a service and over time I am noticing some memory increase. When I check the application with valgrind - it did not find any leak related issues.
    So I’ve check it with google profile tools. This is a result(substracting the one of the first dumps from the latest) after approximately 6 hour run :

      30.0  35.7%  35.7%     30.0  35.7% av_malloc
       28.9  34.4%  70.2%     28.9  34.4% av_reallocp
       24.5  29.2%  99.4%     24.5  29.2% x264_malloc

    When I check the memory on the graph I see, that these allocations are related to avcodec_open2. The client code is :

    `           g_EncoderMutex.lock();
               ffmpeg_encoder_start(OutFileName.c_str(), AV_CODEC_ID_H264, m_FPS, width, height);
               for (pts = 0; pts < VideoImages.size(); pts++) {                
                   m_frame->pts = pts;
                   ffmpeg_encoder_encode_frame(VideoImages[pts].RGBimage[0]);
               }
               ffmpeg_encoder_finish();
               g_EncoderMutex.unlock()

    The ffmpeg_encoder_start method is :

    void VideoEncoder::ffmpeg_encoder_start(const char *filename, int codec_id, int fps, int width, int height)
           {
               int ret;
               m_FPS=fps;
               AVOutputFormat * fmt = av_guess_format(filename, NULL, NULL);
               m_oc = NULL;
               avformat_alloc_output_context2(&m_oc, NULL, NULL, filename);

               m_stream = avformat_new_stream(m_oc, 0);
               AVCodec *codec=NULL;

               codec =  avcodec_find_encoder(codec_id);    
               if (!codec)
               {
                   fprintf(stderr, "Codec not found\n");
                   return; //-1
               }

               m_c=m_stream->codec;

               avcodec_get_context_defaults3(m_c, codec);

               m_c->bit_rate = 400000;
               m_c->width = width;
               m_c->height = height;
               m_c->time_base.num = 1;
               m_c->time_base.den = m_FPS;
               m_c->gop_size = 10;
               m_c->max_b_frames = 1;
               m_c->pix_fmt = AV_PIX_FMT_YUV420P;
               if (codec_id == AV_CODEC_ID_H264)
                   av_opt_set(m_c->priv_data, "preset", "ultrafast", 0);

               if (m_oc->oformat->flags & AVFMT_GLOBALHEADER)
                   m_c->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
               avcodec_open2( m_c, codec, NULL );

               m_stream->time_base=(AVRational){1, m_FPS};

               if (avio_open(&m_oc->pb, filename, AVIO_FLAG_WRITE) < 0)
               {
                   printf( "Could not open '%s'\n", filename);
                   exit(1);
               }            

               avformat_write_header(m_oc, NULL);
               m_frame = av_frame_alloc();
               if (!m_frame) {
                   printf( "Could not allocate video frame\n");
                   exit(1);
               }
               m_frame->format = m_c->pix_fmt;
               m_frame->width  = m_c->width;
               m_frame->height = m_c->height;
               ret = av_image_alloc(m_frame->data, m_frame->linesize, m_c->width, m_c->height, m_c->pix_fmt, 32);
               if (ret < 0) {
                   printf("Could not allocate raw picture buffer\n");
                   exit(1);
               }
           }

    The ffmpeg_encoder_encode_frame is :

    void VideoEncoder::ffmpeg_encoder_encode_frame(uint8_t *rgb)
    {
       int ret, got_output;
       ffmpeg_encoder_set_frame_yuv_from_rgb(rgb);
       av_init_packet(&m_pkt);
       m_pkt.data = NULL;
       m_pkt.size = 0;

       ret = avcodec_encode_video2(m_c, &m_pkt, m_frame, &got_output);
       if (ret < 0) {
           printf("Error encoding frame\n");
           exit(1);
       }
       if (got_output)
       {

            av_packet_rescale_ts(&m_pkt,
                           (AVRational){1, m_FPS}, m_stream->time_base);
           m_pkt.stream_index = m_stream->index;
           int ret = av_interleaved_write_frame(m_oc, &m_pkt);

           av_packet_unref(&m_pkt);

       }

    }

    ffmpeg_encoder_finish code is :

    void VideoEncoder::ffmpeg_encoder_finish(void)
           {
               int got_output, ret;

               do {

                   ret = avcodec_encode_video2(m_c, &m_pkt, NULL, &got_output);
                   if (ret < 0) {
                       printf( "Error encoding frame\n");
                       exit(1);
                   }
                   if (got_output) {

                       av_packet_rescale_ts(&m_pkt,
                                   (AVRational){1, m_FPS}, m_stream->time_base);
                       m_pkt.stream_index = m_stream->index;
                       int ret = av_interleaved_write_frame(m_oc, &m_pkt);

                       av_packet_unref(&m_pkt);
                   }
               } while (got_output);

               av_write_trailer(m_oc);
               avio_closep(&m_oc->pb);

               avformat_free_context(m_oc);

               av_freep(&m_frame->data[0]);
               av_frame_free(&m_frame);

               av_packet_unref(&m_pkt);
               sws_freeContext(m_sws_context);
           }

    This code runs multiple times in the loop.
    So my question is - what am I doing wrong ? maybe ffmpeg is using some kind of internal buffering ? If so, how to disable it ? Because such an increase in memory usage is unacceptable at all.