Recherche avancée

Médias (91)

Autres articles (62)

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

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

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (6205)

  • ffmpeg Attach file from stream

    5 juin 2020, par Tobias Brohl

    I have a flac source file with an embedded cover art, and what to convert it into an mka while retaining the cover art. The problem being that matroska requires cover arts to be attached.
I can extract the original cover using

    



    ffmpeg -i target.flac -vcodec copy cover.jpg

    



    and later add it to the mka using -attach. My question is, whether there is any way not to load the attached data from a file, but instead from the first command (as stream) and do this inline.

    


  • Celery task execution never stops

    2 janvier 2015, par Dmitry Mikhaylov

    I don’t know why but my task never stops executing, it just starts from the beginning.

    Here’s the code :

    @task
    def create_screenshots(video_id):
       from videos.models import Video

       video = Video.objects.get(id=video_id)
       filename = os.path.join(settings.MEDIA_ROOT, video.file.name)
       cmd = ["ffprobe", "-of", "json", "-show_format", "-show_streams", filename]
       info = json.loads(check_output(cmd))
       streams = info['streams']
       frames = 0

       for stream in streams:
           if stream['codec_type'] == 'video':
               frames = stream['nb_frames']
               break

       rate = int(frames) / (settings.FRAMES_NUMBER + 1)

       output_filename = os.path.join('/tmp', '%s_tile.jpg' % os.path.basename(video.file.name))

       # create thumbnails tile
       cmd = ["ffmpeg", "-i", filename, "-vf",
              "select=not(mod(n\\, %d)),scale=231:160,tile=1x10" % int(rate), "-y",
              output_filename]
       call(cmd)
       video.screenshots_sprite.save("%d.jpg" % video.id, File(open(output_filename)), save=False)

       # create cover
       output_filename = os.path.join('/tmp', '%s_cover.jpg' % os.path.basename(video.file.name))
       cmd = ["ffmpeg", "-i", filename, "-vf", "select=gte(n\,%d)" % (int(frames) / 2,),
              "-vframes", "1", "-y", output_filename]
       call(cmd)
       video.cover.save("%d.jpg" % video.id, File(open(output_filename)), save=False)
       video.save()

    What I do here is just run ffmpeg to get video thumbnails and cover file. I don’t see any loop here.

  • How to write unit tests for your plugin – Introducing the Piwik Platform

    17 novembre 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 How to verify user permissions). This time you’ll learn how to write unit tests in Piwik. For this tutorial you will need to have basic knowledge of PHP, PHPUnit and the Piwik platform.

    When is a test a unit test ?

    There are many different opinions on this and it can be sometimes hard to decide. At Piwik we consider a test as a unit test if only a single method or class is being tested and if a test does not have a dependency to the filesystem, web, config, database or to any other plugin.

    If a test is slow it can be an indicator that it is not a unit test. “Slow” is of course a bit vague. We will cover how to write other type of tests, such as integration tests, in one of our next blog posts.

    Getting started

    In this post, we assume that you have already installed Piwik 2.9.0 or later via git, 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.

    Let’s create a unit test

    We start by using the Piwik Console to create a new unit test :

    ./console generate:test --testtype unit

    The command will ask you to enter the name of the plugin the created test should belong to. I will use the plugin name “Insights”. Next it will ask you for the name of the test. Here you usually enter the name of the class you want to test. I will use “Widgets” in this example. There should now be a file plugins/Insights/tests/Unit/WidgetsTest.php which contains already an example to get you started easily :

    1. /**
    2.  * @group Insights
    3.  * @group WidgetsTest
    4.  * @group Plugins
    5.  */
    6. class WidgetsTest extends \PHPUnit_Framework_TestCase
    7. {
    8.  
    9.     public function testSimpleAddition()
    10.     {
    11.         $this->assertEquals(2, 1+1);
    12.     }
    13.  
    14. }

    Télécharger

    We don’t want to cover how you should write your unit test. This is totally up to you. If you have no experience in writing unit tests yet, we recommend to read articles on the topic, or a book, or to watch videos or anything else that will help you learn best.

    Running a test

    To run a test we will use the command tests:run which allows you to execute a test suite, a specific file or a group of tests.

    To verify whether the created test works we will run it as follows :

    ./console tests:run WidgetsTest

    This will run all tests having the group WidgetsTest. As other tests can use the same group you might want to pass the path to your test file instead :

    ./console tests:run plugins/Insights/tests/Unit/Widgets.php

    If you want to run all tests within your plugin pass the name of your plugin as an argument :

    ./console tests:run insights

    Of course you can also define multiple arguments :

    ./console tests:run insights WidgetsTest

    This will execute all tests within the insights plugin having the group WidgetsTest. If you only want to run unit tests within your plugin you can do the following :

    ./console tests:run insights unit

    Advanced features

    Isn’t it easy to create a unit test ? We never even created a file ! You can accomplish even more if you want : You can generate other type of tests, you can run tests on Amazon’s AWS and more. Unfortunately, not everything is documented yet so we recommend to discover more features by executing the commands ./console list tests and ./console help tests:run.

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