
Recherche avancée
Autres articles (73)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette 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. -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (8790)
-
How to track WooCommerce orders in Matomo
3 janvier 2018, par InnoCraftAccording to several sources (datanyze.com, builtwith.com, …) 20% of all online stores are using the WooCommerce WordPress solution. As a result, we thought some of you would be interested in knowing how you can track WooCommerce orders in Matomo (Piwik) without getting a headache.
What is WooCommerce ?
Some of you may not be familiar with WooCommerce. It is one of the most popular WordPress plugins allowing you to transform your website into an online store with a few clicks.
The main advantages of WooCommerce are :- free of charge
- highly customizable
- easy to install
- huge community
The WooCommerce Analytics plugin for Matomo
Tracking e-commerce websites is always challenging as there are so many things to be taken into consideration. However, the InnoCraft team (the professional branch of Matomo) has developed a premium feature in order to track all orders into Matomo (Piwik).
The Matomo (Piwik) WooCommerce premium feature is straightforward and easy to install and configure. You can find the plugin settings in WooCommerce under “WooCommerce => Settings => Matomo” :
Once done, you will see the data appearing in your Matomo (Piwik) when an order is completed :
The InnoCraft team made sure the plugin will record all completed orders 100% correctly (eg. ignoring failed orders, not missing any completed orders). The plugin will even track orders of customers who use an ad blocker thanks to a server-side tracking technique.
Is the WooCommerce Analytics plugin an alternative to my current Matomo tracking code ?
No. The WooCommerce Analytics plugin only records orders and abandoned carts made through the WooCommerce plugin. It will not record any page views, events or other actions. If you are looking for a great WordPress plugin to insert the Matomo (Piwik) tracking code into your WP website, we strongly recommend WP-Piwik.
Tell us your story
If you are a WooCommerce or WordPress user and would like to tell us about how you use Matomo (Piwik), we would love to hear your story and blog about your WooCommerce or WordPress story !
The post How to track WooCommerce orders in Matomo appeared first on Analytics Platform - Matomo.
-
PHP - Read and write the same file hangs
2 février 2016, par AdracatI’m trying to use FFMPEG to make some works with video on the server, and something I need to do is to get the progress of the process.
I searched a little and I found this solution which tells to write the log into a file and then reading and parsing it.
The problem
What is driving me crazy is that I tell FFMPEG - with
exec
- (process A) to write the log into a file, but when I try to read it - withfile_get_contents()
- (process B) it does not show the contents until process A is finished (or interrupted the PHP script).So, when process A finishes or it says "PHP script timeout", then I can read the file as times as I want, refreshing the page (process B) and showing the contents at the time.
What I’ve tried
I’ve tried to use
fopen()
to create the file withw
,w+
anda
parameters, using - and without using -fclose()
. I’ve tried to use alsoflock()
just in case it gets faster to read to process B if it knows it’s already locked and does not have to wait, but then FFMPEG is not able to write into the file.I’ve searched for multithreading too, but I think there must be an easier and simpler way.
I’ve used also CURL and HTTP context, as this link suggests, but no luck.
I’ve tried, too, to use PHP-FFMPEG but it’s not supporting the last FFMPEG version, so I cannot use it.
When I said before "(or interrupted the PHP script)" is because I tried to wait and, when PHP got a timeout, process B worked alright and the file was still updating.
The code
Process A (fileA.php)
exec('ffmpeg -y -i input_file.mp4 output_file.avi 2> C:\Full\Path\To\File\log.txt 1>&2');
Process B (fileB.php)
$content = file_get_contents($file);
if($content){
//get duration of source
preg_match("/Duration: (.*?), start:/", $content, $matches);
$rawDuration = $matches[1];
//rawDuration is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawDuration));
$duration = floatval($ar[0]);
if (!empty($ar[1])) $duration += intval($ar[1]) * 60;
if (!empty($ar[2])) $duration += intval($ar[2]) * 60 * 60;
//get the time in the file that is already encoded
preg_match_all("/time=(.*?) bitrate/", $content, $matches);
$rawTime = array_pop($matches);
//this is needed if there is more than one match
if (is_array($rawTime)){$rawTime = array_pop($rawTime);}
//rawTime is in 00:00:00.00 format. This converts it to seconds.
$ar = array_reverse(explode(":", $rawTime));
$time = floatval($ar[0]);
if (!empty($ar[1])) $time += intval($ar[1]) * 60;
if (!empty($ar[2])) $time += intval($ar[2]) * 60 * 60;
//calculate the progress
$progress = round(($time/$duration) * 100);
echo "Duration: " . $duration . "<br />";
echo "Current Time: " . $time . "<br />";
echo "Progress: " . $progress . "%";
}The process
I just open
fileA.php
on a Chrome tab and, after a few seconds, I openfileB.php
on another Chrome tab (and it stays as loading).What I need
I need to be able to load the file and show the information I want to show while the file is being written (by
exec
andFFMPEG
or other PHP scripts), so I can update the progress percentage with some AJAX calls.Extra information
At this point, I’m using PHP 5.4 on a IIS 7.5 with Windows 7 Professional.
Thank you everyone for your time, help and patience !
Best regards.
-
Why my ffmpeg video encode codes does not work on other computer ?
10 avril 2022, par Object UnknownI'm writing code to encode some cv::Mat images to a MP4 video. The program can run successfully in my computer which I developed it, but when I copied it (and all dlls it needs) to an other computer, it stopped work.


The function which reporting error : (I got it from StackOverflow, and added some changes)


int uns::VideoWriter::Remux()
{
 AVFormatContext* ifmt_ctx = NULL, * ofmt_ctx = NULL;
 int err = 0, ret = 0;
 int64_t ts = 0;
 AVStream* inVideoStream = NULL;
 AVStream* outVideoStream = NULL;
 if ((err = avformat_open_input(&ifmt_ctx, VIDEO_TMP_FILE.c_str(), 0, 0)) < 0)
 {
 if(callback != nullptr) 
 callback("[uns::VideoWriter/Remux] Failed to open input file for remuxing", err);
 ret = -1;
 goto end;
 }
 if ((err = avformat_find_stream_info(ifmt_ctx, 0)) < 0) 
 {
 if(callback != nullptr) 
 callback("[uns::VideoWriter/Remux] Failed to retrieve input stream information", err);
 ret = -2;
 goto end;
 }
 if ((err = avformat_alloc_output_context2(&ofmt_ctx, NULL, NULL, FINAL_FILE_NAME.c_str())))
 {
 if(callback != nullptr) 
 callback("[uns::VideoWriter/Remux] Failed to allocate output context", err);
 ret = -3;
 goto end;
 }
 inVideoStream = ifmt_ctx->streams[0];
 outVideoStream = avformat_new_stream(ofmt_ctx, NULL);
 if (!outVideoStream) 
 {
 if(callback != nullptr) 
 callback("[uns::VideoWriter/Remux] Failed to allocate output video stream", 0);
 ret = -4;
 goto end;
 }
 outVideoStream->time_base = { 1, fps };
 if ((err = avcodec_parameters_copy(outVideoStream->codecpar, inVideoStream->codecpar)) < 0)
 {
 if (callback != nullptr)
 callback("[uns::VideoWriter/Remux] Failed to copy stream information", err);
 return -4;
 goto end;
 }
 outVideoStream->codecpar->codec_tag = 0;
 if (!(ofmt_ctx->oformat->flags & AVFMT_NOFILE)) 
 {
 if ((err = avio_open(&ofmt_ctx->pb, FINAL_FILE_NAME.c_str(), AVIO_FLAG_WRITE)) < 0)
 {
 if(callback != nullptr) 
 callback("[uns::VideoWriter/Remux] Failed to open output file", err);
 ret = -5;
 goto end;
 }
 }
 ofmt_ctx->streams[0]->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
 ofmt_ctx->streams[0]->time_base.num = 1;
 ofmt_ctx->streams[0]->time_base.den = fps;
 if ((err = avformat_write_header(ofmt_ctx, 0)) < 0) 
 {
 if(callback != nullptr) 
 callback("[uns::VideoWriter/Remux] Failed to write header to output file", err);
 ret = -6;
 goto end;
 }
 AVPacket videoPkt;
 while (true) 
 {
 if ((err = av_read_frame(ifmt_ctx, &videoPkt)) < 0) 
 {
 break;
 }
 videoPkt.stream_index = outVideoStream->index;
 videoPkt.pts = ts;
 videoPkt.dts = ts;
 videoPkt.duration = av_rescale_q(videoPkt.duration, inVideoStream->time_base, outVideoStream->time_base);
 ts += videoPkt.duration;
 videoPkt.pos = -1;
 if ((err = av_interleaved_write_frame(ofmt_ctx, &videoPkt)) < 0) 
 {
 if(callback != nullptr) 
 callback("[uns::VideoWriter/Remux] Failed to mux packet", err);
 av_packet_unref(&videoPkt);
 break;
 }
 av_packet_unref(&videoPkt);
 }
 av_write_trailer(ofmt_ctx);
end:
 if (ifmt_ctx) 
 {
 avformat_close_input(&ifmt_ctx);
 }
 if (ofmt_ctx && !(ofmt_ctx->oformat->flags & AVFMT_NOFILE)) 
 {
 avio_closep(&ofmt_ctx->pb);
 }
 if (ofmt_ctx) 
 {
 avformat_free_context(ofmt_ctx);
 }
 return ret;
}



Notes :




callback
is a function which prints error messsage and error code.
The error I recived is
[uns::VideoWriter/Remux] Failed to write header to output file, error code: -22




I want to know what is causing this and how to resolve it please.


Other Informations :




Developing Env :




OS : Windows 11 Professional Workstation build 22593.ni_release

IDE : Visual Studio 2022

ffmpeg : 4.4.1

Installed ffmpeg library :
ffmpeg[avcodec],ffmpeg[avdevice],ffmpeg[avfilter],ffmpeg[avfilter],ffmpeg[avformat],ffmpeg[openh264],ffmpeg[swresample],ffmpeg[swscale]

Compile Settings : x64 Release







Running Env which causing error :




OS : Windows Server 2019 DataCenter

With all dlls VS2022 copied to release folder