
Recherche avancée
Médias (1)
-
La conservation du net art au musée. Les stratégies à l’œuvre
26 mai 2011
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (63)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
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 (8963)
-
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





-
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.
-
New Piwik 2.0 public beta for testers
16 octobre 2013, par mattDear Piwik community,
We are excited to announce the release of the first public beta version of Piwik 2.0.
This is software still in development and we really don’t recommend that you run it on a production site — set up a test database just to play with the new version.
Piwik 2.0 is a major update from Piwik 1.12 and is the result of 5 months of work on the platform !
What’s changed ?
We focused on upgrading Piwik source code quality and maintainability : upgraded to PHP 5.3 using namespaces, changed templating library to Twig, started using composer, using Less as well as css, improved QA tests, introduced new Screenshots tests, refactored translations to nice JSON format, refactored LOTS of code, added documentation….
There also performance improvements, in particular the “All Websites Dashboard” is now usable with 20,000+ websites !
Several bugs were fixed and we added some very-special-and-exciting new features.
See the list of closed tickets in Piwik 2.0, or learn more about our recent developments in the Development update blog post.
Piwik 2 is the open platform for your analytics data !
How to update to Piwik 2.0 beta ?
- You can tell Piwik to use the latest beta from within the user interface. See this FAQ : [piwik.org]
- or alternatively you may download the latest beta from the build server, upload these files on top of your existing piwik files, and visit Piwik to upgrade.
Beta cycle
The more you test the beta, the more stable our release candidates and our final release will be. If you think you’ve found a bug, you can post it in this forum post. Or, if you’re comfortable writing a reproducible bug report, file one. The stable Piwik 2.0 release is planned for mid-November !Happy testing,
PS : if you are interested in professional support for Piwik, or custom feature development, contact the Piwik experts.