
Recherche avancée
Autres articles (105)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
Sur d’autres sites (11568)
-
Filter complex apply on ffmpeg for android outputs low quality video
17 septembre 2014, par AlinI finally managed to build ffmpeg as detailed in here : https://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/ and in the end, I have a ffmpeg library which accepts command arguments.
I am trying to apply a watermark image over the video so for it I am using preparing this ffmpeg command :
ffmpeg -i input.avi -i logo.png -filter_complex 'overlay=10:main_h-overlay_h-10' output.avi
I have first tried it on windows using ffmpeg.exe and the result was as expected.
I have tried it on android using the compiled android and the output is as follows :
09-17 01:16:57.156: I/Videokit(1229): Loading native library compiled at 22:33:10 Sep 15 2014
09-17 01:16:57.156: I/Videokit(1229): Option: ffmpeg
09-17 01:16:57.156: I/Videokit(1229): Option: -loglevel
09-17 01:16:57.156: I/Videokit(1229): Option: debug
09-17 01:16:57.156: I/Videokit(1229): Option: -i
09-17 01:16:57.156: I/Videokit(1229): Option: /storage/emulated/0/mute.mp4
09-17 01:16:57.156: I/Videokit(1229): Option: -i
09-17 01:16:57.156: I/Videokit(1229): Option: /storage/emulated/0/logo.png
09-17 01:16:57.156: I/Videokit(1229): Option: -filter_complex
09-17 01:16:57.156: I/Videokit(1229): Option: overlay=10:main_h-overlay_h-10
09-17 01:16:57.156: I/Videokit(1229): Option: /storage/emulated/0/outVid.mp4
09-17 01:16:57.156: I/Videokit(1229): Running main
09-17 01:16:57.163: D/Videokit(1229): Splitting the commandline.
09-17 01:16:57.163: D/Videokit(1229): Reading option '-loglevel' ...
09-17 01:16:57.163: D/Videokit(1229): matched as option 'loglevel' (set logging level) with argument 'debug'.
09-17 01:16:57.163: D/Videokit(1229): Reading option '-i' ...
09-17 01:16:57.163: D/Videokit(1229): matched as input file with argument '/storage/emulated/0/mute.mp4'.
09-17 01:16:57.163: D/Videokit(1229): Reading option '-i' ...
09-17 01:16:57.163: D/Videokit(1229): matched as input file with argument '/storage/emulated/0/logo.png'.
09-17 01:16:57.163: D/Videokit(1229): Reading option '-filter_complex' ...
09-17 01:16:57.163: D/Videokit(1229): matched as option 'filter_complex' (create a complex filtergraph) with argument 'overlay=10:main_h-overlay_h-10'.
09-17 01:16:57.163: D/Videokit(1229): Reading option '/storage/emulated/0/outVid.mp4' ...
09-17 01:16:57.163: D/Videokit(1229): matched as output file.
09-17 01:16:57.163: D/Videokit(1229): Finished splitting the commandline.
09-17 01:16:57.163: D/Videokit(1229): Parsing a group of options: global .
09-17 01:16:57.163: D/Videokit(1229): Applying option loglevel (set logging level) with argument debug.
09-17 01:16:57.163: D/Videokit(1229): Applying option filter_complex (create a complex filtergraph) with argument overlay=10:main_h-overlay_h-10.
09-17 01:16:57.163: D/Videokit(1229): Successfully parsed a group of options.
09-17 01:16:57.163: D/Videokit(1229): Parsing a group of options: input file /storage/emulated/0/mute.mp4.
09-17 01:16:57.163: D/Videokit(1229): Successfully parsed a group of options.
09-17 01:16:57.163: D/Videokit(1229): Opening an input file: /storage/emulated/0/mute.mp4.
09-17 01:16:57.296: D/Videokit(1229): Successfully opened the file.
09-17 01:16:57.296: D/Videokit(1229): Parsing a group of options: input file /storage/emulated/0/logo.png.
09-17 01:16:57.296: D/Videokit(1229): Successfully parsed a group of options.
09-17 01:16:57.296: D/Videokit(1229): Opening an input file: /storage/emulated/0/logo.png.
09-17 01:16:57.304: D/Videokit(1229): Successfully opened the file.
09-17 01:16:57.304: D/Videokit(1229): Parsing a group of options: output file /storage/emulated/0/outVid.mp4.
09-17 01:16:57.304: D/Videokit(1229): Successfully parsed a group of options.
09-17 01:16:57.304: D/Videokit(1229): Opening an output file: /storage/emulated/0/outVid.mp4.
09-17 01:16:57.312: D/Videokit(1229): Successfully opened the file.
09-17 01:16:57.351: I/Videokit(1229): Stream mapping:
09-17 01:16:57.351: I/Videokit(1229): Stream #0:0 (h264) -> overlay:main
09-17 01:16:57.351: I/Videokit(1229): Stream #1:0 (png) -> overlay:overlay
09-17 01:16:57.351: I/Videokit(1229): overlay
09-17 01:16:57.351: I/Videokit(1229): -> Stream #0:0 (mpeg4)
09-17 01:16:57.351: I/Videokit(1229): Press [q] to stop, [?] for help
09-17 01:16:57.890: I/Videokit(1229): frame= 12 fps=0.0 q=24.3 size= 113kB time=00:00:00.40 bitrate=2314.9kbits/s
09-17 01:16:58.413: I/Videokit(1229): frame= 26 fps= 25 q=31.0 size= 154kB time=00:00:00.86 bitrate=1455.1kbits/s
09-17 01:16:58.953: I/Videokit(1229): frame= 38 fps= 24 q=31.0 size= 180kB time=00:00:01.26 bitrate=1165.0kbits/s
09-17 01:17:00.085: I/Videokit(1229): frame= 50 fps= 24 q=31.0 size= 205kB time=00:00:01.66 bitrate=1006.8kbits/s
09-17 01:17:00.163: I/Videokit(1229): frame= 51 fps= 19 q=31.0 size= 206kB time=00:00:01.70 bitrate= 992.8kbits/s
09-17 01:17:00.632: I/Videokit(1229): frame= 64 fps= 20 q=31.0 size= 230kB time=00:00:02.13 bitrate= 883.9kbits/s
09-17 01:17:01.156: I/Videokit(1229): frame= 78 fps= 21 q=31.0 size= 254kB time=00:00:02.60 bitrate= 798.5kbits/s
09-17 01:17:01.679: I/Videokit(1229): frame= 92 fps= 21 q=31.0 size= 275kB time=00:00:03.06 bitrate= 734.7kbits/s
09-17 01:17:02.179: I/Videokit(1229): frame= 106 fps= 22 q=31.0 size= 296kB time=00:00:03.53 bitrate= 684.8kbits/s
09-17 01:17:02.726: I/Videokit(1229): frame= 121 fps= 23 q=24.8 size= 325kB time=00:00:04.03 bitrate= 660.1kbits/s
09-17 01:17:03.249: I/Videokit(1229): frame= 134 fps= 23 q=31.0 size= 344kB time=00:00:04.47 bitrate= 629.8kbits/s
09-17 01:17:03.781: I/Videokit(1229): frame= 147 fps= 23 q=31.0 size= 368kB time=00:00:04.90 bitrate= 614.2kbits/s
09-17 01:17:04.335: I/Videokit(1229): frame= 159 fps= 23 q=31.0 size= 390kB time=00:00:05.30 bitrate= 602.1kbits/s
09-17 01:17:04.921: I/Videokit(1229): frame= 171 fps= 23 q=31.0 size= 412kB time=00:00:05.70 bitrate= 591.3kbits/s
09-17 01:17:05.437: I/Videokit(1229): frame= 183 fps= 23 q=31.0 size= 432kB time=00:00:06.10 bitrate= 579.8kbits/s
09-17 01:17:05.937: I/Videokit(1229): frame= 196 fps= 23 q=31.0 size= 453kB time=00:00:06.53 bitrate= 568.0kbits/s
09-17 01:17:06.453: I/Videokit(1229): frame= 210 fps= 23 q=31.0 size= 483kB time=00:00:07.00 bitrate= 565.2kbits/s
09-17 01:17:06.976: I/Videokit(1229): frame= 224 fps= 23 q=31.0 size= 513kB time=00:00:07.47 bitrate= 562.3kbits/s
09-17 01:17:07.515: I/Videokit(1229): frame= 239 fps= 24 q=31.0 size= 538kB time=00:00:07.97 bitrate= 553.1kbits/s
09-17 01:17:08.007: I/Videokit(1229): frame= 249 fps= 23 q=31.0 size= 559kB time=00:00:08.30 bitrate= 551.2kbits/s
09-17 01:17:08.531: I/Videokit(1229): frame= 262 fps= 24 q=31.0 size= 581kB time=00:00:08.74 bitrate= 544.6kbits/s
09-17 01:17:09.359: I/Videokit(1229): frame= 272 fps= 23 q=31.0 size= 602kB time=00:00:09.07 bitrate= 543.1kbits/s
09-17 01:17:09.882: I/Videokit(1229): frame= 284 fps= 23 q=31.0 size= 624kB time=00:00:09.47 bitrate= 539.5kbits/s
09-17 01:17:10.374: I/Videokit(1229): frame= 296 fps= 23 q=31.0 size= 651kB time=00:00:09.87 bitrate= 540.2kbits/s
09-17 01:17:10.898: I/Videokit(1229): frame= 309 fps= 23 q=31.0 size= 682kB time=00:00:10.31 bitrate= 542.1kbits/s
09-17 01:17:11.406: I/Videokit(1229): frame= 324 fps= 23 q=31.0 size= 710kB time=00:00:10.81 bitrate= 538.3kbits/s
09-17 01:17:11.929: I/Videokit(1229): frame= 343 fps= 24 q=31.0 size= 749kB time=00:00:11.44 bitrate= 536.2kbits/s
09-17 01:17:12.437: I/Videokit(1229): frame= 361 fps= 24 q=24.8 size= 787kB time=00:00:12.04 bitrate= 535.3kbits/s
09-17 01:17:12.953: I/Videokit(1229): frame= 379 fps= 24 q=31.0 size= 821kB time=00:00:12.64 bitrate= 531.8kbits/s
09-17 01:17:13.460: I/Videokit(1229): frame= 397 fps= 25 q=24.8 size= 869kB time=00:00:13.24 bitrate= 537.2kbits/s
09-17 01:17:13.960: I/Videokit(1229): frame= 413 fps= 25 q=31.0 size= 903kB time=00:00:13.78 bitrate= 537.0kbits/s
09-17 01:17:14.468: I/Videokit(1229): frame= 430 fps= 25 q=31.0 size= 942kB time=00:00:14.34 bitrate= 537.7kbits/s
09-17 01:17:14.601: V/Videokit(1229): No more output streams to write to, finishing.
09-17 01:17:14.609: I/Videokit(1229): frame= 435 fps= 25 q=31.0 Lsize= 959kB time=00:00:14.51 bitrate= 541.2kbits/s
09-17 01:17:14.609: I/Videokit(1229): video:956kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.275524%
09-17 01:17:14.609: D/Videokit(1229): 439 frames successfully decoded, 0 decoding errors
09-17 01:17:14.617: I/Videokit(1229): Main ended with status 0The problem is that the output on android has very poor quality How can I make ffmpeg build a video with a quality close to the original file. I presume that filter_complex forces a new video encode.
-
How to make your plugin configurable – Introducing the Piwik Platform
18 septembre 2014, par Thomas Steur — DevelopmentThis is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to add new pages and menu items to Piwik). This time you will learn how to define settings for your plugin. For this tutorial you will need to have basic knowledge of PHP.
What can I do with settings ?
The Settings API offers you a simple way to make your plugin configurable within the Admin interface of Piwik without having to deal with HTML, JavaScript, CSS or CSRF tokens. There are many things you can do with settings, for instance let users configure :
- connection infos to a third party system such as a WordPress installation.
- select a metric to be displayed in your widget
- select a refresh interval for your widget
- which menu items, reports or widgets should be displayed
- and much more
Getting started
In this series of posts, we assume that you have already set up your development environment. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik.
To summarize the things you have to do to get setup :
- Install Piwik (for instance via git).
- Activate the developer mode :
./console development:enable --full
. - Generate a plugin :
./console generate:plugin --name="MySettingsPlugin"
. There should now be a folderplugins/MySettingsPlugin
. - And activate the created plugin under Settings => Plugins.
Let’s start creating settings
We start by using the Piwik Console to create a settings template :
./console generate:settings
The command will ask you to enter the name of the plugin the settings should belong to. I will simply use the above chosen plugin name “MySettingsPlugin”. There should now be a file
plugins/MySettingsPlugin/Settings.php
which contains already some examples to get you started easily. To see the settings in action go to Settings => Plugin settings in your Piwik installation.Adding one or more settings
Settings are added in the
init()
method of the settings class by calling the methodaddSetting()
and passing an instance of a UserSetting or SystemSetting object. How to create a setting is explained in the next chapter.Customising a setting
To create a setting you have to define a name along some options. For instance which input field should be displayed, what type of value you expect, a validator and more. Depending on the input field we might automatically validate the values for you. For example if you define available values for a select field then we make sure to validate and store only a valid value which provides good security out of the box.
For a list of possible properties have a look at the SystemSetting and UserSetting API reference.
class Settings extends \Piwik\Plugin\Settings
{
public $refreshInterval;
protected function init()
{
$this->setIntroduction('Here you can specify the settings for this plugin.');
$this->createRefreshIntervalSetting();
}
private function createRefreshIntervalSetting()
{
$this->refreshInterval = new UserSetting('refreshInterval', 'Refresh Interval');
$this->refreshInterval->type = static::TYPE_INT;
$this->refreshInterval->uiControlType = static::CONTROL_TEXT;
$this->refreshInterval->uiControlAttributes = array('size' => 3);
$this->refreshInterval->description = 'How often the value should be updated';
$this->refreshInterval->inlineHelp = 'Enter a number which is >= 15';
$this->refreshInterval->defaultValue = '30';
$this->refreshInterval->validate = function ($value, $setting) {
if ($value < 15) {
throw new \Exception('Value is invalid');
}
};
$this->addSetting($this->refreshInterval);
}
}In this example you can see some of those properties. Here we create a setting named “refreshInterval” with the display name “Refresh Interval”. We want the setting value to be an integer and the user should enter this value in a text input field having the size 3. There is a description, an inline help and a default value of 30. The validate function makes sure to accept only integers that are at least 15, otherwise an error in the UI will be shown.
You do not always have to specify a PHP
type
and auiControlType
. For instance if you specify a PHP type boolean we automatically display a checkbox by default. Similarly if you specify to display a checkbox we assume that you want a boolean value.Accessing settings values
You can access the value of a setting in a widget, in a controller, in a report or anywhere you want. To access the value create an instance of your settings class and get the value like this :
$settings = new Settings();
$interval = $settings->refreshInterval->getValue()Type of settings
The Piwik platform differentiates between UserSetting and SystemSetting. User settings can be configured by any logged in user and each user can configure the setting independently. The Piwik platform makes sure that settings are stored per user and that a user cannot see another users configuration.
A system setting applies to all of your users. It can be configured only by a user who has super user access. By default, the value can be read only by a super user as well but often you want to have it readable by anyone or at least by logged in users. If you set a setting readable the value will still be only displayed to super users but you will always be able to access the value in the background.
Imagine you are building a widget that fetches data from a third party system where you need to configure an API URL and token. While no regular user should see the value of both settings, the value should still be readable by any logged in user. Otherwise when logged in users cannot read the setting value then the data cannot be fetched in the background when this user wants to see the content of the widget. Solve this by making the setting readable by the current user :
$setting->readableByCurrentUser = !Piwik::isUserIsAnonymous();
Publishing your Plugin on the Marketplace
In case you want to share your settings or your plugin with other Piwik users you can do this by pushing your plugin to a public GitHub repository and creating a tag. Easy as that. Read more about how to distribute a plugin.
Advanced features
Isn’t it easy to create settings for plugins ? We never even created a file ! The Settings API already offers many possibilities but it might not yet be as flexible as your use case requires. So let us know in case you are missing something and we hope to add this feature at some point in the future.
If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us. -
How to make your plugin configurable – Introducing the Piwik Platform
18 septembre 2014, par Thomas Steur — DevelopmentThis is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to add new pages and menu items to Piwik). This time you will learn how to define settings for your plugin. For this tutorial you will need to have basic knowledge of PHP.
What can I do with settings ?
The Settings API offers you a simple way to make your plugin configurable within the Admin interface of Piwik without having to deal with HTML, JavaScript, CSS or CSRF tokens. There are many things you can do with settings, for instance let users configure :
- connection infos to a third party system such as a WordPress installation.
- select a metric to be displayed in your widget
- select a refresh interval for your widget
- which menu items, reports or widgets should be displayed
- and much more
Getting started
In this series of posts, we assume that you have already set up your development environment. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik.
To summarize the things you have to do to get setup :
- Install Piwik (for instance via git).
- Activate the developer mode :
./console development:enable --full
. - Generate a plugin :
./console generate:plugin --name="MySettingsPlugin"
. There should now be a folderplugins/MySettingsPlugin
. - And activate the created plugin under Settings => Plugins.
Let’s start creating settings
We start by using the Piwik Console to create a settings template :
./console generate:settings
The command will ask you to enter the name of the plugin the settings should belong to. I will simply use the above chosen plugin name “MySettingsPlugin”. There should now be a file
plugins/MySettingsPlugin/Settings.php
which contains already some examples to get you started easily. To see the settings in action go to Settings => Plugin settings in your Piwik installation.Adding one or more settings
Settings are added in the
init()
method of the settings class by calling the methodaddSetting()
and passing an instance of a UserSetting or SystemSetting object. How to create a setting is explained in the next chapter.Customising a setting
To create a setting you have to define a name along some options. For instance which input field should be displayed, what type of value you expect, a validator and more. Depending on the input field we might automatically validate the values for you. For example if you define available values for a select field then we make sure to validate and store only a valid value which provides good security out of the box.
For a list of possible properties have a look at the SystemSetting and UserSetting API reference.
class Settings extends \Piwik\Plugin\Settings
{
public $refreshInterval;
protected function init()
{
$this->setIntroduction('Here you can specify the settings for this plugin.');
$this->createRefreshIntervalSetting();
}
private function createRefreshIntervalSetting()
{
$this->refreshInterval = new UserSetting('refreshInterval', 'Refresh Interval');
$this->refreshInterval->type = static::TYPE_INT;
$this->refreshInterval->uiControlType = static::CONTROL_TEXT;
$this->refreshInterval->uiControlAttributes = array('size' => 3);
$this->refreshInterval->description = 'How often the value should be updated';
$this->refreshInterval->inlineHelp = 'Enter a number which is >= 15';
$this->refreshInterval->defaultValue = '30';
$this->refreshInterval->validate = function ($value, $setting) {
if ($value < 15) {
throw new \Exception('Value is invalid');
}
};
$this->addSetting($this->refreshInterval);
}
}In this example you can see some of those properties. Here we create a setting named “refreshInterval” with the display name “Refresh Interval”. We want the setting value to be an integer and the user should enter this value in a text input field having the size 3. There is a description, an inline help and a default value of 30. The validate function makes sure to accept only integers that are at least 15, otherwise an error in the UI will be shown.
You do not always have to specify a PHP
type
and auiControlType
. For instance if you specify a PHP type boolean we automatically display a checkbox by default. Similarly if you specify to display a checkbox we assume that you want a boolean value.Accessing settings values
You can access the value of a setting in a widget, in a controller, in a report or anywhere you want. To access the value create an instance of your settings class and get the value like this :
$settings = new Settings();
$interval = $settings->refreshInterval->getValue()Type of settings
The Piwik platform differentiates between UserSetting and SystemSetting. User settings can be configured by any logged in user and each user can configure the setting independently. The Piwik platform makes sure that settings are stored per user and that a user cannot see another users configuration.
A system setting applies to all of your users. It can be configured only by a user who has super user access. By default, the value can be read only by a super user as well but often you want to have it readable by anyone or at least by logged in users. If you set a setting readable the value will still be only displayed to super users but you will always be able to access the value in the background.
Imagine you are building a widget that fetches data from a third party system where you need to configure an API URL and token. While no regular user should see the value of both settings, the value should still be readable by any logged in user. Otherwise when logged in users cannot read the setting value then the data cannot be fetched in the background when this user wants to see the content of the widget. Solve this by making the setting readable by the current user :
$setting->readableByCurrentUser = !Piwik::isUserIsAnonymous();
Publishing your Plugin on the Marketplace
In case you want to share your settings or your plugin with other Piwik users you can do this by pushing your plugin to a public GitHub repository and creating a tag. Easy as that. Read more about how to distribute a plugin.
Advanced features
Isn’t it easy to create settings for plugins ? We never even created a file ! The Settings API already offers many possibilities but it might not yet be as flexible as your use case requires. So let us know in case you are missing something and we hope to add this feature at some point in the future.
If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.