
Recherche avancée
Médias (1)
-
The pirate bay depuis la Belgique
1er avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (85)
-
Mise à jour de la version 0.1 vers 0.2
24 juin 2013, parExplications des différents changements notables lors du passage de la version 0.1 de MediaSPIP à la version 0.3. Quelles sont les nouveautés
Au niveau des dépendances logicielles Utilisation des dernières versions de FFMpeg (>= v1.2.1) ; Installation des dépendances pour Smush ; Installation de MediaInfo et FFprobe pour la récupération des métadonnées ; On n’utilise plus ffmpeg2theora ; On n’installe plus flvtool2 au profit de flvtool++ ; On n’installe plus ffmpeg-php qui n’est plus maintenu au (...) -
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 ) (...)
Sur d’autres sites (11233)
-
How to create a command – Introducing the Piwik Platform
2 octobre 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 publish your plugin or theme on the Piwik Marketplace). This time you’ll learn how to create a new command. For this tutorial you will need to have basic knowledge of PHP.
What is a command ?
A command can execute any task on the command line. Piwik provides currently about 50 commands via the Piwik Console. These commands let you start the archiver, change the number of available custom variables, enable the developer mode, clear caches, run tests and more. You could write your own command to sync users or websites with another system for instance.
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="MyCommandPlugin"
. There should now be a folderplugins/MyCommandPlugin
. - And activate the created plugin under Settings => Plugins.
Let’s start creating a command
We start by using the Piwik Console to create a new command. As you can see there is even a command that lets you easily create a new command :
./console generate:command
The command will ask you to enter the name of the plugin the created command should belong to. I will simply use the above chosen plugin name “MyCommandPlugin”. It will ask you for a command name as well. I will use “SyncUsers” in this example. There should now be a file
plugins/MyCommandPlugin/Commands/Syncusers.php
which contains already an example to get you started easily :- class Syncusers extends ConsoleCommand
- {
- protected function configure()
- {
- $this->setName('mycommandplugin:syncusers');
- $this->setDescription('MyCommandPlugin');
- $this->addOption('name', null, InputOption::VALUE_REQUIRED, 'Your name:');
- }
- /**
- * Execute command like: ./console mycommandplugin:syncusers --name="The Piwik Team"
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $name = $input->getOption('name');
- $output->writeln($message);
- }
- }
Any command that is placed in the “Commands” folder of your plugin will be available on the command line automatically. Therefore, the newly created command can now be executed via
./console mycommandplugin:syncusers --name="The Piwik Team"
.The code template explained
- protected function configure()
- {
- $this->setName('mycommandplugin:checkdatabase');
- $this->setDescription('MyCommandPlugin');
- $this->addOption('name', null, InputOption::VALUE_REQUIRED, 'Your name:');
- }
As the name says the method
configure
lets you configure your command. You can define the name and description of your command as well as all the options and arguments you expect when executing it.- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $name = $input->getOption('name');
- $output->writeln($message);
- }
The actual task is defined in the
execute
method. There you can access any option or argument that was defined on the command line via$input
and write anything to the console via$output
argument.In case anything went wrong during the execution you should throw an exception to make sure the user will get a useful error message. Throwing an exception when an error occurs will make sure the command does exit with a status code different than 0 which can sometimes be important.
Advanced features
The Piwik Console is based on the powerful Symfony Console component. For instance you can ask a user for any interactive input, you can use different output color schemes and much more. If you are interested in learning more all those features have a look at the Symfony console website.
How to test a command
After you have created a command you are surely wondering how to test it. Ideally, the actual command is quite short as it acts like a controller. It should only receive the input values, execute the task by calling a method of another class and output any useful information. This allows you to easily create a unit or integration test for the classes behind the command. We will cover this topic in one of our future blog posts. Just one hint : You can use another command
./console generate:test
to create a test. If you want to know how to test a command have a look at the Testing Commands documentation.Publishing your Plugin on the Marketplace
In case you want to share your commands 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 and best practices when publishing a plugin.
Isn’t it easy to create a command ? We never even created a file ! If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.
-
Probe function in ffmpeg
14 octobre 2014, par eejsI am trying to write a demuxer for STL subtitle format(FFmpeg). I am having trouble understanding how the probe function is referenced in ffmpeg.
I have the following code for my probe :#include "avformat.h"
#include "internal.h"
#include "subtitles.h"
#include "libavutil/intreadwrite.h"
typedef struct {
FFDemuxSubtitlesQueue q;
} STLContext;
static int stl_probe(AVProbeData *p)
{
char c;
const unsigned char *ptr = p->buf;
av_log(0,100,"printing the probe function");
while(*ptr=='\r' || *ptr=='\n' || *ptr=='$' || (ptr[0]=='/' && ptr[1]=='/'))
ptr+=ff_subtitles_next_line(ptr);
if (sscanf(ptr, "%*d:%*d:%*d:%*d , %*d:%*d:%*d:%*d , %c", &c) == 1)
return AVPROBE_SCORE_MAX;
return 0;
}
static int64_t get_pts(char **buf, int *duration)
{
int hh1, mm1, ss1, ms1;
int hh2, mm2, ss2, ms2;
int len=0;
if (sscanf(*buf, "%2d:%2d:%2d:%2d , %2d:%2d:%2d:%2d , %n",
&hh1, &mm1, &ss1, &ms1,
&hh2, &mm2, &ss2, &ms2, &len) >= 8 && len>0) {
int64_t start = (hh1*3600LL + mm1*60LL + ss1) * 100LL + ms1;
int64_t end = (hh2*3600LL + mm2*60LL + ss2) * 100LL + ms2;
*duration = end - start;
*buf+=len;
return start;
}
return AV_NOPTS_VALUE;
}
static int stl_read_header(AVFormatContext *s)
{
STLContext *stl = s->priv_data;
AVStream *st = avformat_new_stream(s, NULL);
if (!st)
return AVERROR(ENOMEM);
avpriv_set_pts_info(st, 64, 1, 100);
st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_id = AV_CODEC_ID_TEXT;
while (!avio_feof(s->pb)) {
char line[4096];
char *p = line;
const int64_t pos = avio_tell(s->pb);
int len = ff_get_line(s->pb, line, sizeof(line));
int64_t pts_start;
int duration;
if (!len)
break;
line[strcspn(line, "\r\n")] = 0;
pts_start = get_pts(&p , &duration);
if (pts_start != AV_NOPTS_VALUE) {
AVPacket *sub;
sub = ff_subtitles_queue_insert(&stl->q, p, strlen(p), 0);
if (!sub)
return AVERROR(ENOMEM);
sub->pos = pos;
sub->pts = pts_start;
sub->duration = duration;
}
}
ff_subtitles_queue_finalize(&stl->q);
return 0;
}
static int stl_read_packet(AVFormatContext *s, AVPacket *pkt)
{
STLContext *stl = s->priv_data;
return ff_subtitles_queue_read_packet(&stl->q, pkt);
}
static int stl_read_seek(AVFormatContext *s, int stream_index,
int64_t min_ts, int64_t ts, int64_t max_ts, int flags)
{
STLContext *stl = s->priv_data;
return ff_subtitles_queue_seek(&stl->q, s, stream_index,
min_ts, ts, max_ts, flags);
}
static int stl_read_close(AVFormatContext *s)
{
STLContext *stl = s->priv_data;
ff_subtitles_queue_clean(&stl->q);
return 0;
}
AVInputFormat ff_stl_demuxer = {
.name = "stl",
.long_name = NULL_IF_CONFIG_SMALL("STL subtitles"),
.priv_data_size = sizeof(STLContext),
.read_probe = stl_probe,
.read_header = stl_read_header,
.read_packet = stl_read_packet,
.read_seek2 = stl_read_seek,
.read_close = stl_read_close,
.extensions = "stl",
};Output of
./ffmpeg -f stl -i Test.stl Test.srt
ffmpeg version N-66838-g9071bab Copyright (c) 2000-2014 the FFmpeg developers
built on Oct 14 2014 12:28:54 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration:
libavutil 54. 10.100 / 54. 10.100
libavcodec 56. 4.101 / 56. 4.101
libavformat 56. 9.100 / 56. 9.100
libavdevice 56. 1.100 / 56. 1.100
libavfilter 5. 1.105 / 5. 1.105
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
Input #0, stl, from '/home/eejya/SubtitleTesting/UK_FINAL_240511.stl':
Duration: N/A, bitrate: N/A
Stream #0:0: Subtitle: text
Output #0, srt, to '/home/eejya/SubtitleTesting/UkTest.srt':
Metadata:
encoder : Lavf56.9.100
Stream #0:0: Subtitle: subrip (srt)
Metadata:
encoder : Lavc56.4.101 srt
Stream mapping:
Stream #0:0 -> #0:0 (text (native) -> subrip (srt))
Press [q] to stop, [?] for help
size= 10kB time=00:27:10.06 bitrate= 0.0kbits/s
video:0kB audio:0kB subtitle:4kB other streams:0kB global headers:0kB muxing overhead: 121.594238%when I run the command
./ffmpeg -i Test.stl Test.srt
I don’t see any output printed by av_log and it says that the probe score is very less which may lead to mis-detection. That would mean only the extension is being checked.So, either my probe function is not being called or the buffer isn’t being read.
How do I check whether my probe function is being called or not ?
Also does the low score warning imply that the function is being called ? -
ffmpeg error : parsed_overlay framesync - Buffer queue overflow, dropping
23 octobre 2014, par TomOn most video files my ffmpeg command works fine. but on some video files I get the following error code. something goes wrong with scaling and overlaying filters. but it depends on input files. I’m still searching for reasons and solutions. Maybe somebody knows more about it ?
[Parsed_overlay_1 @ *] [framesync @ *] Buffer queue overflow, dropping."
Input :
ffmpeg
-i "/var/www/vhosts/domain.com/httpdocs/video/temp/input.wmv"
-i "/var/www/vhosts/domain.com/httpdocs/images/logo_w140.png"
-filter_complex 'scale=trunc(oh*a/2)*2:320,overlay=main_w-overlay_w-10:main_h-overlay_h-10'
-ss 00:00:00 -t 00:00:44 -r 24 -b:v 360k -bt 416k -vcodec libx264
-preset veryslow -ar 11025 -y -acodec libfaac -ac 1 -ab 64k
/var/www/vhosts/domain.com/httpdocs/Protected/41000/output.mp4Output :
ffmpeg version 2.3.2 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 13 2014 16:39:32 with gcc 4.4.5 (Debian 4.4.5-8)
configuration: --enable-avfilter --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64 --enable-libfaac --enable-nonfree --enable-filter=movie --enable-libx264 --enable-gpl --enable-version3 --enable-postproc --enable-libvorbis --enable-libx264 --enable-x11grab --prefix=/usr --enable-libgsm --enable-libdc1394
libavutil 52. 92.100 / 52. 92.100
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.100 / 55. 48.100
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.100 / 4. 11.100
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
[wmv3 @ 0x2451bb0] Extra data: 8 bits left, value: 0
[mjpeg @ 0x2450c70] ignoring invalid SAR: 0/0
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, asf, from '/var/www/vhosts/domain.com/httpdocs/video/temp/input.wmv':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: MP@LL
WMFSDKVersion : 12.0.7601.17514
IsVBR : 0
Duration: 00:00:43.99, start: 0.000000, bitrate: 1584 kb/s
Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg), 320x240, 90k tbr, 90k tbn, 90k tbc
Metadata:
comment : Movie/video screen capture
Stream #0:1(eng): Audio: wmav2 (a[1][0][0] / 0x0161), 48000 Hz, 2 channels, fltp, 96 kb/s
Stream #0:2(eng): Video: wmv3 (Main) (WMV3 / 0x33564D57), yuv420p, 320x240, 1500 kb/s, 30 fps, 30 tbr, 1k tbn, 1k tbc
Input #1, image2, from '/var/www/vhosts/domain.com/httpdocs/images/logo_w140.png':
Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
Stream #1:0: Video: png, rgba, 140x36, 25 tbr, 25 tbn, 25 tbc
[swscaler @ 0x2432d50] deprecated pixel format used, make sure you did set range correctly
[libx264 @ 0x249c3b0] using cpu capabilities: none!
[libx264 @ 0x249c3b0] profile High, level 3.1
[libx264 @ 0x249c3b0] 264 - core 142 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=abr mbtree=1 bitrate=360 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[wmv3 @ 0x245da80] Extra data: 8 bits left, value: 0
Output #0, mp4, to '/var/www/vhosts/domain.com/httpdocs/Protected/41000/b7fe950bc0ea5a3776c3893dc035a973.mp4':
Metadata:
WMFSDKNeeded : 0.0.0.0000
DeviceConformanceTemplate: MP@LL
WMFSDKVersion : 12.0.7601.17514
IsVBR : 0
encoder : Lavf55.48.100
Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 426x320, q=-1--1, 360 kb/s, 24 fps, 12288 tbn, 24 tbc (default)
Metadata:
encoder : Lavc55.69.100 libx264
Stream #0:1(eng): Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 11025 Hz, mono, s16, 64 kb/s
Metadata:
encoder : Lavc55.69.100 libfaac
Stream mapping:
Stream #0:0 (mjpeg) -> scale (graph 0)
Stream #0:2 (wmv3) -> overlay:overlay (graph 0)
overlay (graph 0) -> Stream #0:0 (libx264)
Stream #0:1 -> #0:1 (wmav2 (native) -> aac (libfaac))
Press [q] to stop, [?] for help
[mjpeg @ 0x2452690] ignoring invalid SAR: 0/0
[Parsed_overlay_1 @ 0x244d8c0] [framesync @ 0x244d988] Buffer queue overflow, dropping.
Last message repeated 161 times
frame= 1 fps=0.0 q=0.0 size= 0kB time=00:00:06.73 bitrate= 0.1kbits/s[Parsed_overlay_1 @ 0x244d8c0] [framesync @ 0x244d988] Buffer queue overflow, dropping.
Last message repeated 237 times
frame= 1 fps=1.0 q=0.0 size= 13kB time=00:00:14.44 bitrate= 7.3kbits/s[Parsed_overlay_1 @ 0x244d8c0] [framesync @ 0x244d988] Buffer queue overflow, dropping.
Last message repeated 238 times
frame= 1 fps=0.7 q=0.0 size= 34kB time=00:00:22.43 bitrate= 12.6kbits/s[Parsed_overlay_1 @ 0x244d8c0] [framesync @ 0x244d988] Buffer queue overflow, dropping.
Last message repeated 244 times
frame= 1 fps=0.5 q=0.0 size= 55kB time=00:00:30.23 bitrate= 14.9kbits/s[Parsed_overlay_1 @ 0x244d8c0] [framesync @ 0x244d988] Buffer queue overflow, dropping.
Last message repeated 241 times
frame= 1 fps=0.4 q=0.0 size= 76kB time=00:00:38.12 bitrate= 16.4kbits/s[Parsed_overlay_1 @ 0x244d8c0] [framesync @ 0x244d988] Buffer queue overflow, dropping.
Last message repeated 126 times
frame= 2 fps=0.7 q=-1.0 Lsize= 126kB time=00:00:44.00 bitrate= 23.4kbits/s dup=0 drop=64
video:3kB audio:118kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 4.045506%
[libx264 @ 0x249c3b0] frame I:1 Avg QP:30.19 size: 1778
[libx264 @ 0x249c3b0] frame P:1 Avg QP:34.00 size: 125
[libx264 @ 0x249c3b0] mb I I16..4: 54.1% 44.3% 1.7%
[libx264 @ 0x249c3b0] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 10.7% 0.4% 3.5% 0.0% 0.0% skip:85.4%
[libx264 @ 0x249c3b0] final ratefactor: 25.19
[libx264 @ 0x249c3b0] 8x8 transform intra:44.3% inter:100.0%
[libx264 @ 0x249c3b0] coded y,uvDC,uvAC intra: 20.9% 34.3% 0.2% inter: 0.0% 0.2% 0.0%
[libx264 @ 0x249c3b0] i16 v,h,dc,p: 34% 20% 14% 33%
[libx264 @ 0x249c3b0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 9% 6% 15% 12% 15% 9% 13% 11% 10%
[libx264 @ 0x249c3b0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 8% 44% 14% 6% 4% 10% 5% 3% 5%
[libx264 @ 0x249c3b0] i8c dc,h,v,p: 48% 26% 21% 5%
[libx264 @ 0x249c3b0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x249c3b0] kb/s:182.69