Recherche avancée

Médias (91)

Autres articles (99)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (12215)

  • Node.JS : FFmpeg piped video encoding no thumbnail created

    12 avril 2013, par Sascha Heim

    I want to pipe the video during upload to ffmpeg for realtime thumbnail creation.
    All went fine but no thumbnail.jpg was created and the ffmpeg stderr hangs after the libraries version display.

    Updated : Ive updated my code but it also doesnt create a valid thumbnail.

    var formidable = require('formidable'),
           http = require('http'),
           sys = require('sys'),
           spawn = require('child_process').spawn;

    function spawnFfmpeg(exitCallback) {
       var args = ['-i', 'pipe:0', '-c:v', 'mjpeg', '-ss', '00:00:13', '-vframes', '1', '-s', '100x80', 'thumbnail.jpg']
       var ffmpeg = spawn('ffmpeg', args);
       console.log('Spawning ffmpeg ' + args.join(' '));

       ffmpeg.on('exit', exitCallback);
       ffmpeg.stderr.on('data', function(data) {
           console.log('grep stderr: ' + data);
       });
       return ffmpeg;
    }

    http.createServer(function(req, res) {
       if (req.url == '/' && req.method.toLowerCase() == 'get') {
           // show a file upload form
           res.writeHead(200, {'content-type': 'text/html'});
           res.end
                   (&#39;<form action="/upload" enctype="multipart/form-data" method="post">&#39;
                           + &#39;<input type="text" /><br />&#39;
                           + &#39;<input type="file" multiple="multiple" /><br />&#39;
                           + &#39;<input type="submit" value="Upload" />&#39;
                           + &#39;</form>&#39;
                           );
       } else if (req.url == &#39;/upload&#39; &amp;&amp; req.method.toLowerCase() == &#39;post&#39;) {
           // parse a file upload
           var form = new formidable.IncomingForm();
           form.maxFieldsSize = 29 * 1024 * 1024;
           // Handle each part of the multi-part post
           var ffmpeg = spawnFfmpeg(function(code) {
               console.log(&#39;child process exited with code &#39; + code);
               res.end();
           });

           var form = new formidable.IncomingForm();
           // Handle each part of the multi-part post
           form.onPart = function(part) {
               // Handle each data chunk as data streams in
               part.addListener(&#39;data&#39;, function(data) {
                   ffmpeg.stdout.pipe(res);
                   res.pipe(ffmpeg.stdin);
                   // Write each chunk to disk
                   //savedFile.write(data);
               });
           };

           // Do it
           form.parse(req);
           return;
       }
    }).listen(80, "127.0.0.1");

    process.on(&#39;uncaughtException&#39;, function(err) {
    });
  • Video encoding and keyframes

    24 février 2013, par Tishu

    I am transcoding a video frame by frame and using x264+ffmpeg to encode. The original video plays fine, but the first few frames of my transcoded vide show grey artefacts. I understand this is because of time compression and these artefacts disappear after a few frames.

    See these two pictures which are the first and second frames. The third frame is normal (i.e. no grey artefact and not blurry like the second one)
    First frame
    Second frame

    How can I force the first frame to be a key frame (ie fully encoded in my output video) so that these artefacts do not show ?

    Edit - more details

    Here is what I am doing more in details. I used bit form differents tutorials to read a video frame by frame and reencode each frame to a new video. My encoding parameters are the following :

    avcodec_get_context_defaults3(c, *codec);
    c->codec_id = codec_id;
    c->bit_rate = output_bitrate;
    /* Resolution must be a multiple of two. */
    c->width    = output_width;
    c->height   = output_height;
    /* timebase: This is the fundamental unit of time (in seconds) in terms
    * of which frame timestamps are represented. For fixed-fps content,
    * timebase should be 1/framerate and timestamp increments should be
    * identical to 1. */
    st->r_frame_rate.num = output_framerate_num;
    st->r_frame_rate.den = output_framerate_den;
    c->time_base.den = output_timebase_den;
    c->time_base.num = output_timebase_num;
    c->gop_size      = 3; /* emit one intra frame every twelve frames at most */
    c->pix_fmt       = STREAM_PIX_FMT;
    if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
       /* just for testing, we also add B frames */
       c->max_b_frames = 2;
    }
    if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
       /* Needed to avoid using macroblocks in which some coeffs overflow.
        * This does not happen with normal video, it just happens here as
        * the motion of the chroma plane does not match the luma plane. */
       c->mb_decision = 2;
    }
    c->max_b_frames = 2;
    c->scenechange_threshold = 0;
    c->rc_buffer_size = 0;
    c->me_method = ME_ZERO;

    Then I process each frame, probably doing something wrong there. The decoding bit :

    while(av_read_frame(gFormatCtx, &amp;packet)>=0) {
       // Is this a packet from the video stream?
       if(packet.stream_index==gVideoStreamIndex) {
           // Decode video frame
           avcodec_decode_video2(gVideoCodecCtx, pCurrentFrame, &amp;frameFinished, &amp;packet);
           // Did we get a video frame?
           if(frameFinished) {
               [...]
               if(firstPts == -999) /*Initial value*/
                   firstPts = packet.pts;
               deltaPts = packet.pts - firstPts;
               double seconds = deltaPts*av_q2d(gFormatCtx->streams[gVideoStreamIndex]->time_base);
               [...]
               muxing_writeVideoFrame(pCurrentFrame, packet.pts);
           }
       }
    }

    The actual writing :

    int muxing_writeVideoFrame(AVFrame *frame, int64_t pts)
    {
    frameCount = frameCount +1;
    if(frameCount > 0)
    {
       if (video_st)
           video_pts = (double)video_st->pts.val * video_st->time_base.num /
                       video_st->time_base.den;
       else
           video_pts = 0.0;

       if (video_st &amp;&amp; !(video_st &amp;&amp; audio_st &amp;&amp; audio_pts &lt; video_pts))
       {
           frame->pts = pts;//av_rescale_q(frame_count, video_st->codec->time_base, video_st->time_base);
           write_video_frame(oc, video_st, frame);
       }
    }

    return 0;
    }

    static int write_video_frame(AVFormatContext *oc, AVStream *st, AVFrame *frame)
    {
       int ret;
       static struct SwsContext *sws_ctx;
       //LOGI(10, frame_count);
       AVCodecContext *c = st->codec;

       /* encode the image */
       AVPacket pkt;
       int got_output;
       av_init_packet(&amp;pkt);
       pkt.data = NULL;    // packet data will be allocated by the encoder
       pkt.size = 0;
    ret = avcodec_encode_video2(c, &amp;pkt, frame, &amp;got_output);
    if (ret &lt; 0) {
       fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret));
       exit(1);
    }
    /* If size is zero, it means the image was buffered. */
    if (got_output) {
       if (c->coded_frame->key_frame)
           pkt.flags |= AV_PKT_FLAG_KEY;
       pkt.stream_index = st->index;
       /* Write the compressed frame to the media file. */
       ret = av_interleaved_write_frame(oc, &amp;pkt);
    } else {
       ret = 0;
    }

       if (ret != 0) {
           LOGI(10, av_err2str(ret));
           exit(1);
       }
       frame_count++;
       return got_output;
    }
  • Scrape mp4 file from a URL ? [on hold]

    22 juillet 2013, par TJE

    I am running ffmpeg on my server and am using it with PHP. I was wondering if it was possible to enter a URL of a web page and have it search the source code for a .mp4 file. Then use that as the uploaded file in the HTML form and process it with PHP. I would also like to be able to scrape other data found on the page.

    Can someone recommend a good tutorial or lesson for scraping data by just entering a URL in an HTML form ? Or just answer my question if it's simple. I am a bit of a noob at this.