Recherche avancée

Médias (91)

Autres articles (75)

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

  • Keeping control of your media in your hands

    13 avril 2011, par

    The vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
    While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
    MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
    MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

Sur d’autres sites (10547)

  • How to map frame extracted with ffmpeg and subtitle of a video ? (frame accuracy problem)

    14 novembre 2019, par Abitbol

    would like to generate text files for frames extracted with ffmpeg, containing subtitle of the frame if any, on a video for which I have burn the subtitles using ffmpeg also.

    I use a python script with pysrt to open the subrip file and generate the text files.
    What I am doing is that each frames is named with the frame number by ffmpeg, then and since they are extracted at a constant rate, I can easily retrieve the time position of the frame using the formula t1 = fnum/fps, where fnum is the number of the frame retrieved with the filename, and fps is the frequency passed to ffmpeg for the frame extraction.

    Even though I am using the same subtitle file to retrieve the text positions in the timeline, that the one that has been used in the video, I still get accuracy errors. Most I have some text files missing or some that shouldn’t be present.

    Because time is not really continuous when talking about frames, I have tried recalibrating t using the fps of the video wih the hardcoded subtitles, let’s call that fps vfps for video fps (I have ensured that the video fps is the same before and after subtitle burning). I get the formula : t2 = int(t1*vfps)/vfps.
    It still is not 100% accurate.

    For example, my video is at 30fps (vfps=30) and I extracted frames at 4fps (fps=4).
    The extracted frame 166 (fnum=166) shows no subtitle. In the subrip file, the previous subtitle ends at t_prev=41.330 and the next subtitle begins at t_next=41.400, which means that t_sub should satisfy : t_prev < t_sub and t_sub < t_next, but I can’t make this happen.

    Formulas I have tried :

    t1 = fnum/fps  # 41.5 > t_next
    t2 = int(fnum*vfps/fps)/vfps  # 41.5 > t_next
    # is it because of a indexing problem? No:
    t3 = (fnum-1)/fps  # 41.25 < t_prev
    t4 = int((fnum-1)*vfps/fps)/vfps  # 41.23333333 < t_prev
    t5 = int(fnum*vfps/fps - 1)/vfps  # 41.466666 > t_next
    t6 = int((fnum-1)*vfps/fps + 1)/vfps  # 41.26666 < t_prev

    Command used :

    # burning subtitles
    # (previously)
    # ffmpeg -r 25 -i nosub.mp4 -vf subtitles=sub.srt withsub.mp4
    # now:
    ffmpeg -i nosub.mp4 -vf subtitles=sub.srt withsub.mp4
    # frames extraction
    ffmpeg -i withsub.mp4 -vf fps=4 extracted/%05.bmp -hide_banner

    Why does this happen and how can I solve this ?

    One thing I have noticed is that if I extract frames of the original video and the subtitle ones, do a difference of the frames, the result is not only the subtitles, there are variations in the background (that shouldn’t happen). If I do the same experience using the same video two times, the difference is null, which means that the frame extraction is consistant.

    Code for the difference :

    ffmpeg -i withsub.mp4 -vf fps=4 extracted/%05.bmp -hide_banner
    ffmpeg -i no_sub.mp4 -vf fps=4 extracted_no_sub/%05.bmp -hide_banner
    for img in no_sub/*.bmp; do
       convert extracted/${img##*/} $img -compose minus -composite diff/${img##*/}
    done

    Thanks.

  • avformat/dashdec, hls : Update correct pointer to AVDictionary

    7 septembre 2020, par Andreas Rheinhardt
    avformat/dashdec, hls : Update correct pointer to AVDictionary
    

    open_url() in the DASH as well in the hls demuxer share a common bug :
    They modify an AVDictionary (i.e. set a new entry) given to them as
    AVDictionary *, yet if this new entry leads to reallocation and
    relocation of the AVDictionary, the caller's pointer will become
    dangling, leading to use-after-frees. So pass an AVDictionary **.

    (With the current implementation of AVDictionary the above can only
    happen if the AVDictionary was empty initially (in which case the
    new AVDictionary leaks) ; furthermore if the I/O is ordinary (i.e. opened
    by avio_open2() or ffio_open_whitelist()), the dict is never empty (it
    contains an rw_timeout entry from save_avio_options()). So this issue
    could only happen if the caller sets a nondefault io_open callback, but
    no AVIOContext (the AVFMT_FLAG_CUSTOM_IO flag won't be set in this
    case). In case of the HLS demuxer, it was also necessary that setting
    the "seekable" entry failed. Yet one should simply not rely on internals
    of the AVDict API.)

    Reviewed-by : Steven Liu <lq@chinaffmpeg.org>
    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

    • [DH] libavformat/dashdec.c
    • [DH] libavformat/hls.c
  • Perspective transformations

    4 février 2009, par Mikko Koppanen — Imagick, PHP stuff

    Finally (after a long break) I managed to force myself to update the PHP documentation and this time it was distortImage code example. Things have been hectic lately but that does not quite explain the 6 months(?) break between this and the previous post. As a matter of a fact there is no excuse for such a long silence so I will try to update this blog a bit more often from now on.

    Back in the day I used to blog the examples and update the documentation if I remembered but I am trying to fix this bad habit. Most of the latest examples have been updated in to the manual. In the case of the two last examples I updated the documentation first and then blogged on the subject.

    I took some time to actually understand the perspective transformations properly using the excellent ImageMagick examples (mainly created by Anthony Thyssen) as a reference. The basic idea of perspective distortion seems simple : to distort the control points to new locations. Grabbing the syntax for Imagick was easy, an array of control point pairs in the form of :

    1. array(source_x, source_y, dest_x, dest_y ... )

    The following example uses the built-in checkerboard pattern to demonstrate perspective distortion :

    1. < ?php
    2. /* Create new object */
    3. $im = new Imagick() ;
    4.  
    5. /* Create new checkerboard pattern */
    6. $im->newPseudoImage(100, 100, "pattern:checkerboard") ;
    7.  
    8. /* Set the image format to png */
    9. $im->setImageFormat(’png’) ;
    10.  
    11. /* Fill background area with transparent */
    12. $im->setImageVirtualPixelMethod(Imagick: :VIRTUALPIXELMETHOD_TRANSPARENT) ;
    13.  
    14. /* Activate matte */
    15. $im->setImageMatte(true) ;
    16.  
    17. /* Control points for the distortion */
    18. $controlPoints = array( 10, 10,
    19.             10, 5,
    20.  
    21.             10, $im->getImageHeight() - 20,
    22.             10, $im->getImageHeight() - 5,
    23.  
    24.             $im->getImageWidth() - 10, 10,
    25.             $im->getImageWidth() - 10, 20,
    26.  
    27.             $im->getImageWidth() - 10, $im->getImageHeight() - 10,
    28.             $im->getImageWidth() - 10, $im->getImageHeight() - 30) ;
    29.  
    30. /* Perform the distortion */ 
    31. $im->distortImage(Imagick: :DISTORTION_PERSPECTIVE, $controlPoints, true) ;
    32.  
    33. /* Ouput the image */ 
    34. header("Content-Type : image/png") ;
    35. echo $im ;
    36.  ?>

    Here is the source image :
    checker before

    And the result :
    after