
Recherche avancée
Médias (1)
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (64)
-
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 ;
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
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 (10111)
-
Animation rendering using Nodejs on backend server side
17 février 2019, par user9964622I have simple animation created using create js and ffmpegserver.js.
ffmpegserver.js.
This is a simple node server and library that sends canvas frames to the server and uses FFmpeg to compress the video. It can be used standalone or with CCapture.js.
Here is repo : video rendering demo.
on folder public, I have demos eg test3.html and test3.js
Test3.html
<code class="echappe-js"><body onload="init();">Simple Tween Demo
<script src="http://localhost:8081/ffmpegserver/CCapture.js"></script>
<script src="http://localhost:8081/ffmpegserver/ffmpegserver.js"></script>
<script src="https://code.createjs.com/1.0.0/createjs.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tween.js/17.2.0/Tween.js"></script>
<script src='http://stackoverflow.com/feeds/tag/test3.js'></script>
Test3.js
/* eslint-disable eol-last */
/* eslint-disable no-undef */
/* eslint-disable quotes */
var canvas, stage;
function init() {
var framesPerSecond = 60;
var numFrames = framesPerSecond * 5; // a 5 second 60fps video
var frameNum = 0;
var progressElem = document.getElementById("progress");
var progressNode = document.createTextNode("");
progressElem.appendChild(progressNode);
function onProgress(progress) {
progressNode.nodeValue = (progress * 100).toFixed(1) + "%";
}
function showVideoLink(url, size) {
size = size ? (" [size: " + (size / 1024 / 1024).toFixed(1) + "meg]") : " [unknown size]";
var a = document.createElement("a");
a.href = url;
var filename = url;
var slashNdx = filename.lastIndexOf("/");
if (slashNdx >= 0) {
filename = filename.substr(slashNdx + 1);
}
a.download = filename;
a.appendChild(document.createTextNode("Download"));
var container = document.getElementById("container").insertBefore(a, progressElem);
}
var capturer = new CCapture( {
format: 'ffmpegserver',
//workersPath: "3rdparty/",
//format: 'gif',
//verbose: true,
framerate: framesPerSecond,
onProgress: onProgress,
//extension: ".mp4",
//codec: "libx264",
} );
capturer.start();
canvas = document.getElementById("testCanvas");
stage = new createjs.Stage(canvas);
var ball = new createjs.Shape();
ball.graphics.setStrokeStyle(5, 'round', 'round');
// eslint-disable-next-line quotes
ball.graphics.beginStroke('#000000');
ball.graphics.beginFill("#FF0000").drawCircle(0, 0, 50);
ball.graphics.setStrokeStyle(1, 'round', 'round');
ball.graphics.beginStroke('#000000');
ball.graphics.moveTo(0, 0);
ball.graphics.lineTo(0, 50);
ball.graphics.endStroke();
ball.x = 200;
ball.y = -50;
createjs.Tween.get(ball, {loop: -1})
.to({x: ball.x, y: canvas.height - 55, rotation: -360}, 1500, createjs.Ease.bounceOut)
.wait(1000)
.to({x: canvas.width - 55, rotation: 360}, 2500, createjs.Ease.bounceOut)
.wait(1000)
.to({scaleX: 2, scaleY: 2}, 2500, createjs.Ease.quadOut)
.wait(1000)
stage.addChild(ball);
createjs.Ticker.addEventListener("tick", stage);
function render() {
requestAnimationFrame(render);
capturer.capture( canvas );
++frameNum;
if (frameNum < numFrames) {
progressNode.nodeValue = "rendered frame# " + frameNum + " of " + numFrames;
} else if (frameNum === numFrames) {
capturer.stop();
capturer.save(showVideoLink);
}
}
render();
}
[1]: https://github.com/throne1986/video-renderingEverything works fine, you can test it yourself if you want by cloning the repo.
Right now animation rendering happens in client side, I would like this animation rendering to happen in the backend side
What do I need to change to make this animation rendering in backend server side using Nodejs ? any help or suggestions will be appreciated.
-
FFMpeg : ffmpeg failed to execute command error
28 mars 2017, par Richard McFriend OluwamuyiwaI am trying to transcode a video file of 1.2mb file uploaded to my website server via php/html upload, but I keep getting the error :
PHP Fatal error : Uncaught exception ’Alchemy\BinaryDriver\Exception\ExecutionFailureException’ with message ’ffmpeg failed to execute command ’/usr/local/bin/ffmpeg’ ’-y’ ’-i’ ’/home/user/public_html/contents/videos/1490719990_MP4_360p_Short_video_clip_nature_mp4.mp4’ ’-async’ ’1’ ’-metadata:s:v:0’ ’start_time=0’ ’-r’ ’16’ ’-b_strategy’ ’1’ ’-bf’ ’3’ ’-g’ ’9’ ’-vcodec’ ’libx264’ ’-acodec’ ’libmp3lame’ ’-b:v’ ’128k’ ’-refs’ ’6’ ’-coder’ ’1’ ’-sc_threshold’ ’40’ ’-flags’ ’+loop’ ’-me_range’ ’16’ ’-subq’ ’7’ ’-i_qfactor’ ’0.71’ ’-qcomp’ ’0.6’ ’-qdiff’ ’4’ ’-trellis’ ’1’ ’-b:a’ ’8k’ ’-ac’ ’1’ ’-pass’ ’1’ ’-passlogfile’ ’/tmp/ffmpeg-passes58dab05a323b6eknk4/pass-58dab05a32465’ ’/home/user/public_html/contents/videos/1490719990_MP4_360p_Short_video_clip_nature_mp4_22995.mp4’’ in /home/user/public_html/app/ffmpeg/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php:100
Stack trace :0 /home/user/public_html/app/ffmpeg/vendor/alchemy/binary-driver/src/Alchemy/BinaryDriver/ProcessRunner.php(72) : Alch in /home/user/public_html/app/ffmpeg/vendor/php-ffmpeg/php-ffmpeg/src/FFMpeg/Media/Video.php on line 168
Funny thing is that the same server is extracting frames and getting duration of the same file using ffprobe and ffmpeg.
Here is the code I am using to transcode :
$ffmpeg = $ffmpeg = FFMpeg\FFMpeg::create(['timeout'=>3600, 'ffmpeg.thread'=>12, 'ffmpeg.binaries' => '/usr/local/bin/ffmpeg',
'ffprobe.binaries' => '/usr/local/bin/ffprobe']);
$ffprobe_prep = FFMpeg\FFProbe::create(['ffmpeg.binaries' => '/usr/local/bin/ffmpeg',
'ffprobe.binaries' => '/usr/local/bin/ffprobe']);
$ffprobe = $ffprobe_prep->format($video_file);
$video = $ffmpeg->open($video_file);
// Get video duration to ensure our videos are never longer than our video limit.
$duration = $ffprobe->get('duration');
// Use mp4 format and set the audio bitrate to 56Kbit and Mono channel.
// TODO: Try stereo later...
$format = new FFMpeg\Format\Video\X264('libmp3lame', 'libx264');
$format
-> setKiloBitrate(128)
-> setAudioChannels(1)
-> setAudioKiloBitrate(8);
$first = $ffprobe_prep
->streams($video_file)
->videos()
->first();
$width = $first->get('width');
if($width > VIDEO_WIDTH){
// Resize to 558 x 314 and resize to fit width.
$video
->filters()
->resize(new FFMpeg\Coordinate\Dimension(VIDEO_WIDTH, ceil(VIDEO_WIDTH / 16 * 9)));
}
// Trim to videos longer than three minutes to 3 minutes.
if($duration > MAX_VIDEO_PLAYTIME){
$video
->filters()
->clip(FFMpeg\Coordinate\TimeCode::fromSeconds(0), FFMpeg\Coordinate\TimeCode::fromSeconds(MAX_VIDEO_PLAYTIME));
}
// Change the framerate to 16fps and GOP as 9.
$video
->filters()
->framerate(new FFMpeg\Coordinate\FrameRate(16), 9);
// Synchronize audio and video
$video->filters()->synchronize();
$video->save($format, $video_file_new_2);I have contacted my host to no vital assistance. The only useful information they can provide me is that ffmpeg was compiled on the server with libmp3lame support.
This code works perfect on localhost
Any help as to why I may be getting the error and how to correct it is appreciated.
-
CMAKE ExternalProject_Add add unwanted double quote
9 janvier 2021, par Guy BI have a simple CMake project that uses ExternalProject_Add to configure and compile ffmpeg. The CMakeLists.txt looks like this :


cmake_minimum_required(VERSION 3.2)

project(FFMpeg)

include(ExternalProject)

set(PRIVATE_LIBRARY_PATH "home/user/local/lib")
set(PRIVATE_PKG_CONFIG "home/user/local/pkgconfig")

set(FFMPEG_CONFIGURE_COMMAND echo)
if(NOT (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/FFMpeg/config.h))
 set(FFMPEG_CONFIGURE_COMMAND ./configure)
 set(FFMPEG_DEBUG_CONFIGURE_ARGS "--enable-x86asm --disable-doc --extra-libs=-lpthread --extra-libs=-ldl --enable-shared --enable-static --disable-avx512 --disable-optimizations --extra-cflags=-g3 --extra-cflags=-fno-omit-frame-pointer --enable-debug=3 --extra-cflags=-fno-inline --disable-stripping")
endif()

ExternalProject_Add(ffmpeg
 SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ffmpeg
 CONFIGURE_COMMAND export LD_LIBRARY_PATH=${PRIVATE_LIBRARY_PATH} PKG_CONFIG_PATH=${PRIVATE_PKG_CONFIG}/usr/lib/pkgconfig && ${FFMPEG_CONFIGURE_COMMAND} ${FFMPEG_DEBUG_CONFIGURE_XMA_ARGS}
 BUILD_COMMAND export LD_LIBRARY_PATH=${PRIVATE_LIBRARY_PATH} PKG_CONFIG_PATH=${PRIVATE_PKG_CONFIG}/usr/lib/pkgconfig && make V=1
 INSTALL_COMMAND make install
 INSTALL_DIR ""
 BUILD_IN_SOURCE 1
 BUILD_ALWAYS 1)



But when the CONFIGURE_COMMAND of the ExternalProject_Add is being executed the command add double quotes between the expanded string FFMPEG_DEBUG_CONFIGURE_ARGS and thus the ffmpeg configure script dismiss the arguments :


./configure "--enable-x86asm --disable-doc --extra-libs=-lpthread --extra-libs=-ldl --enable-shared --enable-static --disable-avx512 --disable-optimizations --extra-cflags=-g3 --extra-cflags=-fno-omit-frame-pointer --enable-debug=3 --extra-cflags=-fno-inline --disable-stripping"



How can I change the CONFIGURE_COMMAND command line to have the double quote removed to allow the FFMpeg configure script to properly recognize the argument ?