Recherche avancée

Médias (91)

Autres articles (32)

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

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

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

  • In my django app, celery task converts uploaded video w/ ffmpeg, but converted video won't save to s3 ?

    29 janvier 2013, par GetItDone

    I use Heroku to host my website, and Amazon s3 to store my static and media files. I have a celery task that converts the video file to flv, but the flv doesn't store anywhere. There isn't any error, just there is no file uploaded to my s3 bucket. How can I force the file to save to my s3 bucket after the conversion ? I'm still pretty new web development in general, and I have been stuck trying to get my video conversion working properly for weeks. To be honest, I'm not even sure that I'm doing the right thing with my task. Here is the code in my celery task :

    @task(name='celeryfiles.tasks.convert_flv')
    def convert_flv(video_id):
       video = VideoUpload.objects.get(pk=video_id)
       filename = video.video_upload
       sourcefile = "%s%s" % (settings.MEDIA_URL, filename)
       vidfilename = "%s.flv" % video.id
       targetfile = "%svideos/flv/%s" % (settings.MEDIA_URL, vidfilename)
       ffmpeg = "ffmpeg -i %s -ar 22050 -f flv -s 320x240 %s" % (sourcefile, targetfile)
       #The next lines are code that I couldn't get to work in place of the line above, and are left commented out.
       #I am open to suggestions or alternatives for this also.
       #ffmpeg = "ffmpeg -i %s -acodec libmp3lame -ar 22050 -f flv -s 320x240 %s" % (sourcefile, targetfile)
       #ffmpeg = "ffmpeg -i %s -acodec mp3 -ar 22050 -f flv -s 320x240 %s" % (sourcefile, targetfile)
       try:
           ffmpegresult = commands.getoutput(ffmpeg)
           print "---------------FFMPEG---------------"
           print "FFMPEGRESULT: %s" % ffmpegresult
       except Exception as e:
           ffmpegresult = None
           print("Failed to convert video file %s to %s" % (sourcefile, targetfile))
           print(traceback.format_exc())
       video.flvfilename = vidfilename
       video.save()

    My view :

    def upload_video(request):
       if request.method == 'POST':
           form = VideoUploadForm(request.POST, request.FILES)
           if form.is_valid():
               video_upload=form.save()
               video_id=video_upload.id
               video_conversion = convert_flv.delay(video_id)
               return HttpResponseRedirect('/current_classes/')
       else:
       ...

    Any advice, insight, or ideas in general would be greatly appreciated. Obviously I am missing something, but I can't figure out what. I have been stuck with different aspects of getting my video conversion to work with ffmpeg using a celery task for weeks. Thanks in advance.

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

  • AWS : Best way to generate a thumbnail for every frame of a s3 uploaded video

    4 janvier 2018, par danielfranca

    I need to process a video file, transcode it and generate a thumbnail for every frame.

    It should happen every time there’s a new video on a specific AWS bucket.

    I found out that AWS Lambda should be the best service for that

    However, it is not working as expected and I’ll explain why

    I’ve created a simple Python2.7 file using FFVideo
    It seems that this library doesn’t support Python3.

    It is a nice abstraction on top of ffmpeg

    To deploy the package I had run lld on the FFVideo shared object, and then copied everything to my project directory, as described in their documentation.
    Zipped it and upload to AWS Lambda

    Yet it doesn’t work, I keep getting errors as if the /usr/lib64/libstdc++ is missing, even after copied it to the projecct dir, also tried /usr/lib64 and /lib64

    Then as a second thought I wonder if just running ffmpeg wouldn’t be easier...
    So I just copied ffmpeg to the project dir and did a simple Python script to call it.

    Missing shared objects, ok, lld again and copied everything to the directory.

    Then AWS Lambda seems to be completely broken, I can’t save it anymore and it just says "Fix errors before saving"
    But no error message, nothing

    I even have attempted to write inline a simple code, but now AWS Lambda don’t even open the online editor.
    I also tried to remove all the shared objects I have added, returning to the original state, but still same generic error.
    Same thing if I just create a new lambda function with same old code.

    Doesn’t matter what I do it never even enable the Save button anymore.
    I thought it might be just some AWS unstability, but it been a while.

    I’ve looked to a similar project using Node
    and it doesn’t seem to include anything except ffmpeg

    My other idea is to use SQS to trigger a python script somewhere else to create the thumbnails

    Any idea how is the best approach for that ?