Recherche avancée

Médias (1)

Mot : - Tags -/musée

Autres articles (66)

  • D’autres logiciels intéressants

    12 avril 2011, par

    On ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
    La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
    On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
    Videopress
    Site Internet : (...)

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

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

Sur d’autres sites (6632)

  • AWS Lambda subprocess OSError : [Errno 2] No such file or directory

    11 septembre 2016, par Lev

    I’m trying to create a lambda function that makes collection of thumbnails from a video on amazon s3 using ffmpeg. ffmpeg binary is included into fuction package.

    function code :

    # -*- coding: utf-8 -*-

    import stat
    import shutil
    import boto3
    import logging
    import subprocess as sp
    import os
    import threading

    thumbnail_prefix = 'thumb_'
    thumbnail_ext = '.jpg'
    time_delta = 1
    video_frames_path = 'media/videos/frames'

    print('Loading function')
    logger = logging.getLogger()
    logger.setLevel(logging.INFO)

    lambda_tmp_dir = '/tmp'  # Lambda fuction can use this directory.

    # ffmpeg is stored with this script.
    # When executing ffmpeg, execute permission is requierd.
    # But Lambda source directory do not have permission to change it.
    # So move ffmpeg binary to `/tmp` and add permission.
    ffmpeg_bin = "{0}/ffmpeg.linux64".format(lambda_tmp_dir)
    shutil.copyfile('/var/task/ffmpeg.linux64', ffmpeg_bin)

    os.chmod(ffmpeg_bin, 777)

    # tried also:
    # os.chmod(ffmpeg_bin, os.stat(ffmpeg_bin).st_mode | stat.S_IEXEC)

    s3 = boto3.client('s3')


    def get_thumb_filename(num):
       return '{prefix}{num:03d}{ext}'.format(prefix=thumbnail_prefix, num=num, ext=thumbnail_ext)


    def create_thumbnails(video_url):
       i = 1
       filenames_list = []
       filename = None
       while i == 1 or os.path.isfile(os.path.join(os.getcwd(), get_thumb_filename(i-1))):
           if filename:
               filenames_list.append(filename)
           time = time_delta * (i - 1)
           filename = get_thumb_filename(i)
           print(ffmpeg_bin)
           if os.path.isfile(ffmpeg_bin):
               print('ok')
           sp.call(['sudo',
                    ffmpeg_bin,
                    '-ss',
                    str(time),
                    '-i',
                    video_url,
                    '-frames:v',
                    '1',
                    get_thumb_filename(i)])
           i += 1
       print(filenames_list)
       return filenames_list


    def s3_upload_file(file_path, key, bucket, acl, content_type):
       file = open(file_path, 'r')
       s3.put_object(
           Bucket=bucket,
           ACL=acl,
           Body=file,
           Key=key,
           ContentType=content_type
       )
       logger.info("file {0} moved to {1}/{2}".format(file_path, bucket, key))


    def s3_upload_files_in_threads(filenames_list, dir_path, bucket, s3path, acl, content_type):
       for filename in filenames_list:
           if os.path.isfile(os.path.join(dir_path, filename)):
               print(os.path.join(dir_path, filename))
           t = threading.Thread(target=s3_upload_file,
                                args=(os.path.join(dir_path, filename),
                                      '{0}/{1}'.format(s3path, filename),
                                      bucket,
                                      acl,
                                      content_type)).start()


    def lambda_handler(event, context):
       bucket = event['Records'][0]['s3']['bucket']['name']
       video_key = event['Records'][0]['s3']['object']['key']
       video_name = video_key.split('/')[-1].split('.')[0]
       video_url = 'http://{0}/{1}'.format(bucket, video_key)
       filenames_list = create_thumbnails(video_url)
       s3_upload_files_in_threads(filenames_list,
                                  os.getcwd(),
                                  bucket,
                                  '{0}/{1}'.format(video_frames_path, video_name),
                                  'public-read',
                                  'image/jpeg')
       return

    during the execution I get following logs :

    Loading function

    /tmp/ffmpeg.linux64

    ok

    [Errno 2] No such file or directory: OSError
    Traceback (most recent call last):
    File "/var/task/lambda_function.py", line 112, in lambda_handler
    filenames_list = create_thumbnails(video_url)
    File "/var/task/lambda_function.py", line 77, in create_thumbnails
    get_thumb_filename(i)])
    File "/usr/lib64/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
    File "/usr/lib64/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
    File "/usr/lib64/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
    OSError: [Errno 2] No such file or directory

    When I use the same sp.call() with the same ffmpeg binary on my ec2 instance it works fine.

  • How to use (django-celery,RQ) worker to execute a video filetype conversion (ffmpeg) in django on heroku (My code works locally)

    15 janvier 2013, par GetItDone

    One part of my website includes a form that allows users to upload video. I use ffmpeg to convert the video to flv. My media and static files are stored on Amazon S3. I can get everything to work perfectly locally, however I can't seem to figure out how to use a worker to run the video conversion subprocess in production. I have dj-celery and rq installed in my app. The code in my view that I was able to get to work locally is :

    #views.py
    def upload_broadcast(request):
       if request.method == 'POST':
           form = VideoUploadForm(request.POST, request.FILES)
           if form.is_valid():
               new_video=form.save()
               def convert_to_flv(video):
                   filename = video.video_upload
                   sourcefile = "%s%s" % (settings.MEDIA_ROOT, filename)
                   flvfilename = "%s.flv" % video.id
                   imagefilename = "%s.png" % video.id
                   thumbnailfilename = "%svideos/flv/%s" % (settings.MEDIA_ROOT, imagefilename)
                   targetfile = "%svideos/flv/%s" % (settings.MEDIA_ROOT, flvfilename)
                   ffmpeg = "ffmpeg -i %s -acodec mp3 -ar 22050 -f flv -s 320x240 %s" % (sourcefile, targetfile)
                   grabimage = "ffmpeg -y -i %s -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320x240 %s" % (sourcefile, thumbnailfilename)
                   print ("SOURCE: %s" % sourcefile)
                   print ("TARGET: %s" % targetfile)
                   print ("TARGET IMAGE: %s" % thumbnailfilename)
                   print ("FFMPEG TASK CODE: %s" % ffmpeg)
                   print ("IMAGE TASK CODE: %s" % grabimage)
                   try:
                       ffmpegresult = subprocess.call(ffmpeg)
                       print "---------------FFMPEG---------------"
                       print ffmpegresult
                   except:
                       print "Not working."
                   try:
                       videothumbnail = subprocess.call(grabimage)
                       print "---------------IMAGE---------------"
                       print videothumbnail
                   except:
                       print "Not working."
                   video.flvfilename = flvfilename
                   video.videothumbnail = imagefilename
                   video.save()

               convert_to_flv(new_video)

               return HttpResponseRedirect('/video_list/')
       else:
    ...

    This is my first time trying to use a worker (or ever pushing a project to production), so even with the documentation it is still unclear to me what I need to do. I have tried several different things but nothing seems to work. Is there just a simple way to tell celery to run the ffmpegresult = subprocess.call(ffmpeg) ? Thanks in advance for any help or insight.

    EDIT- Added heroku logs

    2013-01-10T20:58:57+00:00 app[web.1]: TARGET: /media/videos/flv/8.flv
    2013-01-10T20:58:57+00:00 app[web.1]: IMAGE TASK CODE: ffmpeg -y -i /media/videos/practice.wmv -vframes 1 -ss 00:00:02 - an -vcodec png -f rawvideo -s 320x240 /media/videos/flv/8.png
    2013-01-10T20:58:57+00:00 app[web.1]: SOURCE: /media/videos/practice.wmv
    2013-01-10T20:58:57+00:00 app[web.1]: FFMPEG TASK CODE: ffmpeg -i /media/videos/practice.wmv -acodec mp3 -ar 22050 -f fl v -s 320x240 /media/videos/flv/8.flv
    2013-01-10T20:58:57+00:00 app[web.1]: TARGET IMAGE: /media/videos/flv/8.png
    2013-01-10T20:58:57+00:00 app[web.1]: Not working.
    2013-01-10T20:58:57+00:00 app[web.1]: Not working.

    NEWER EDIT

    I tried adding a tasks.py and added the task :

    celery = Celery('tasks', broker='redis://guest@localhost//')

    @celery.task
    def ffmpeg_task(video):
       converted_file = subprocess.call(video)
       return converted_file

    then I changed the relevant section of my view to :

    ...
    try:
       ffmpeg_task.delay(ffmpeg)
       print "---------------FFMPEG---------------"
       print ffmpegresult
    except:
       print "Not working."
    ...

    My new logs are :

    2013-01-15T13:19:52+00:00 app[web.1]: TARGET IMAGE: /media/videos/flv/12.png
    2013-01-15T13:19:52+00:00 app[web.1]: SOURCE: /media/videos/practice.wmv
    2013-01-15T13:19:52+00:00 app[web.1]: FFMPEG TASK CODE: ffmpeg -i /media/videos/practice.wmv -acodec mp3 -ar 22050 -f fl v -s 320x240 /media/videos/flv/12.flv
    2013-01-15T13:19:52+00:00 app[web.1]: IMAGE TASK CODE: ffmpeg -y -i /media/videos/practice.wmv -vframes 1 -ss 00:00:02 -an -vcodec png -f rawvideo -s 320x240 /media/videos/flv/12.png
    2013-01-15T13:19:52+00:00 app[web.1]: TARGET: /media/videos/flv/12.flv
    2013-01-15T13:20:17+00:00 app[web.1]: 2013-01-15 13:20:17 [2] [CRITICAL] WORKER TIMEOUT (pid:12)
    2013-01-15T13:20:17+00:00 app[web.1]: 2013-01-15 13:20:17 [2] [CRITICAL] WORKER TIMEOUT (pid:12)
    2013-01-15T13:20:17+00:00 app[web.1]: 2013-01-15 13:20:17 [19] [INFO] Booting worker with pid: 19

    Am I completely missing something ? I'll keep trying, but will be very appreciative of any direction or assistance.

  • How to make your plugin multilingual – Introducing the Piwik Platform

    29 octobre 2014, par Thomas Steur — Development

    This is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was Generating test data – Introducing the Piwik Platform). This time you’ll learn how to equip your plugin with translations. Users of your plugin will be very thankful that they can use and translate the plugin in their language !

    Getting started

    In this post, we assume that you have already set up your development environment and created a plugin. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik and other Guides that help you to develop a plugin.

    Managing translations

    Piwik is available in over 50 languages and comes with many translations. The core itself provides some basic translations for words like “Visitor” and “Help”. They are stored in the directory /lang. In addition, each plugin can provide its own translations for wordings that are used in this plugin. They are located in /plugins/*/lang. In those directories you’ll find one JSON file for each language. Each language file consists in turn of tokens that belong to a group.

    {
       "MyPlugin":{
           "BlogPost": "Blog post",
           "MyToken": "My translation",
           "InteractionRate": "Interaction Rate"
       }
    }

    A group usually represents the name of a plugin, in this case “MyPlugin”. Within this group, all the tokens are listed on the left side and the related translations on the right side.

    Building a translation key

    As you will later see to actually translate a word or a sentence you’ll need to know the corresponding translation key. This key is built by combining a group and a token separated by an underscore. You can for instance use the key MyPlugin_BlogPost to get a translation of “Blog post”. Defining a new key is as easy as adding a new entry to the “MyPlugin” group.

    Providing default translations

    If a translation cannot be found then the English translation will be used as a default. Therefore, you should always provide a default translation in English for all keys in the file en.json (ie, /plugins/MyPlugin/lang/en.json).

    Adding translations for other languages

    This is as easy as creating new files in the lang subdirectory of your plugin. The filename consists of a 2 letter ISO 639-1 language code completed by the extension .json. This means German translations go into a file named de.json, French ones into a file named fr.json. To see a list of languages you can use have a look at the /lang directory.

    Reusing translations

    As mentioned Piwik comes with quite a lot of translations. You can and should reuse them but you are supposed to be aware that a translation key might be removed or renamed in the future. It is also possible that a translation key was added in a recent version and therefore is not available in older versions of Piwik. We do not currently announce any of such changes. Still, 99% of the translation keys do not change and it is therefore usually a good idea to reuse existing translations. Especially when you or your company would otherwise not be able to provide them. To find any existing translation keys go to Settings => Translation search in your Piwik installation. The menu item will only appear if the development mode is enabled.

    Translations in PHP

    Use the Piwik::translate() function to translate any text in PHP. Simply pass any existing translation key and you will get the translated text in the language of the current user in return. The English translation will be returned in case none for the current language exists.

    $translatedText = Piwik::translate('MyPlugin_BlogPost');

    Translations in Twig Templates

    To translate text in Twig templates, use the translate filter.

    {{ 'MyPlugin_BlogPost'|translate }}

    Contributing translations to Piwik

    Did you know you can contribute translations to Piwik ? In case you want to improve an existing translation, translate a missing one or add a new language go to Piwik Translations and sign up for an account. You won’t need any knowledge in development to do this.

    Advanced features

    Of course there are more useful things you can do with translations. For instance you can use placeholders like %s in your translations and you can use translations in JavaScript as well. In case you want to know more about those topics check out our Internationalization guide. Currently, this guide only covers translations but we will cover more topics like formatting numbers and handling currencies in the future.

    Congratulations, you have learnt how to make your plugin multilingual !

    If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.