Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (37)

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

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

  • De l’upload à la vidéo finale [version standalone]

    31 janvier 2010, par

    Le chemin d’un document audio ou vidéo dans SPIPMotion est divisé en trois étapes distinctes.
    Upload et récupération d’informations de la vidéo source
    Dans un premier temps, il est nécessaire de créer un article SPIP et de lui joindre le document vidéo "source".
    Au moment où ce document est joint à l’article, deux actions supplémentaires au comportement normal sont exécutées : La récupération des informations techniques des flux audio et video du fichier ; La génération d’une vignette : extraction d’une (...)

Sur d’autres sites (2068)

  • ffmpeg crop detect python using subprocess

    12 mai 2015, par JRM

    I want to use python subprocess to call ffmpeg and use crop detect to find all black in a video. The crop detect return I want to put into a string variable and put in a database. At the moment I can get the process running in terminal and but I am unsure about how to grab the specific part of the terminal (stdout) output :

    the script :

    def cropDetect():
       p = subprocess.Popen(["ffmpeg", "-i", "/Desktop/ffprobe_instance/Crop_detect/video_file.mpg", "-vf", "cropdetect=24:16:0", "-vframes", "10", "dummy.mp4"], stdout=subprocess.PIPE)
       result = p.communicate()[0]
       print result


    # SCRIPT
    cropDetect()

    Result in terminal :
    [Parsed_cropdetect_0 @ 0x7fa1d840cb80] x1:719 x2:0 y1:575 y2:0 w :-704 h :-560 x:714 y:570 pos:432142 pts:44102 t:0.490022 crop=-704 :-560:714:570

    How do I take "crop=-704 :-560:714:570" and put it into a variable that I can store in a database ?

    As per update :

    def cropDetect1():
       p = subprocess.check_output(["ffmpeg", "-i", "/Desktop/ffprobe_instance/Crop_detect/video_file.mpg", "-vf", "cropdetect=24:16:0", "-vframes", "10", "dummy.mp4"])
       match = re.search("crop\S+", p)
       crop_result = None
       if match is not None:
           crop_result = match.group()
           print "hello %s" % crop_result

    I can’t seem to print out the "crop_result" - I am presuming that means that the variable is empty ?

    UPDATE : Found it :

    def detectCropFile(localPath):
       fpath = "/xxx/xx/Desktop/Crop_detect/videos/USUV.mp4"
       print "File to detect crop: %s " % fpath
       p = subprocess.Popen(["ffmpeg", "-i", fpath, "-vf", "cropdetect=24:16:0", "-vframes", "500", "-f", "rawvideo", "-y", "/dev/null"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
       infos = p.stderr.read()
       print infos
       allCrops = re.findall(CROP_DETECT_LINE + ".*", infos)
       print allCrops
       mostCommonCrop = Counter(allCrops).most_common(1)
       print "most common crop: %s" % mostCommonCrop
       print mostCommonCrop[0][0]
       global crop
       crop = mostCommonCrop[0][0]
       video_rename()

    Use : p = subprocess.Popen(["ffmpeg", "-i", fpath, "-vf", "cropdetect=24:16:0", "-vframes", "500", "-f", "rawvideo", "-y", "/dev/null"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) to pipe it out

  • PipedInputStream / PipedOutputStream, ImageIO and ffmpeg

    19 avril 2015, par jdevelop

    I have the following code in Scala :

         val pos = new PipedOutputStream()
         val pis = new PipedInputStream(pos)

         Future {
           LOG.trace("Start rendering")
           generateFrames(videoRenderParams.length) {
             img ⇒ ImageIO.write(img, "PNG", pos)
           }
           pos.flush()
           IOUtils.closeQuietly(pos)
           LOG.trace("Finished rendering")
         } onComplete {
           case Success(_) ⇒
             LOG.trace("Complete successfully")
           case Failure(err) ⇒
             LOG.error("Can't render stuff", err)
             IOUtils.closeQuietly(pis)
             IOUtils.closeQuietly(pos)
         }

         val prc = (ffmpegCli #< pis).!(logger)

    the Future simply writes the generated images one by one to the OutputStream. Now the ffmpeg process reads the input images from stdin and converts them to MP4 file.

    That works pretty well, but for some reason sometimes I’m getting the following stacktraces :

    I/O error Pipe closed for process: <input stream="stream" />
    java.io.IOException: Pipe closed
       at java.io.PipedInputStream.checkStateForReceive(PipedInputStream.java:260)
       at java.io.PipedInputStream.receive(PipedInputStream.java:226)
       at java.io.PipedOutputStream.write(PipedOutputStream.java:149)
       at scala.sys.process.BasicIO$.loop$1(BasicIO.scala:236)
       at scala.sys.process.BasicIO$.transferFullyImpl(BasicIO.scala:242)
       at scala.sys.process.BasicIO$.transferFully(BasicIO.scala:223)
       at scala.sys.process.ProcessImpl$PipeThread.runloop(ProcessImpl.scala:159)
       at scala.sys.process.ProcessImpl$PipeSource.run(ProcessImpl.scala:179)

    At the same time I’m getting the following error from another stream :

    javax.imageio.IIOException: I/O error writing PNG file!
       at com.sun.imageio.plugins.png.PNGImageWriter.write(PNGImageWriter.java:1168)
       at javax.imageio.ImageWriter.write(ImageWriter.java:615)
       at javax.imageio.ImageIO.doWrite(ImageIO.java:1612)
       at javax.imageio.ImageIO.write(ImageIO.java:1578)
       at

    So it seems that the streams were broken somewhere in between, so ffmpeg can not read the data, and ImageIO can not write the data.

    What is even more interesting - the problem is reproducible only on certain Linux server (Amazon). It works flawlessly on other Linux boxes. So I wonder if somebody could point me out to the possible causes of this error.

    What I’ve tried so far :

    • use Oracle JDK 8 and OpenJDK
    • use different versions of FFMPEG

    Nothing worked by the moment.

  • Anomalie #3430 (En cours) : les champs multi ne fonctionnent plus si une des rubriques n’est plus ...

    5 mai 2015, par Eric Lupinacci

    Je confirme le bug en 3.1 mais il doit aussi exister en 3.0.
    En fait, dans typo() on appelle à un moment corriger_typo($letexte) sans préciser la langue en cours alors que cela est possible.
    Dans corriger_typo() on appelle ensuite extraire_multi($letexte, $lang, true) mais $lang est la chaine vide car l’argument n’a pas été passé dans l’appel de la fonction.
    De fait, dans extraire_multi() on passe par l’instruction :

    if (!$lang) $lang = $GLOBALS[’spip_lang’] ;
    


    pour déterminer la langue qui est donc celle de l’index spip_lang de $GLOBALS.

    Or, si on suit la boucle de erational on a dans $GLOBALS les valeurs suivantes :
    - pour le titre 10. xxx : $GLOBALS[’spip_lang’] = ’en’ et $GLOBALS[’lang’] = ’en’
    - pour le titre 20. xxx : $GLOBALS[’spip_lang’] = ’fr’ et $GLOBALS[’lang’] = ’en’
    - pour le titre 30. xxx : $GLOBALS[’spip_lang’] = ’fr’ et $GLOBALS[’lang’] = ’en’

    Il est donc normal que pour la deuxième et troisième rubrique on extrait la langue fr.
    Si je patche extraire_multi() en rajoutant la ligne

    if (!$lang and isset($GLOBALS[’lang’])) $lang = $GLOBALS[’lang’] ;
    


    avant l’autre affectation de $lang en considérant que lang est prioritaire sur spip_lang cela fonctionne évidemment.

    Maintenant, je ne connais pas la différence entre spip_lang et lang et je trouve bizarre qu’on laisse tout se faire par défaut dans tous les cas depuis typo(). A votre avis, où faut-il modifier le code pour corriger sans tout casser ?