
Recherche avancée
Autres articles (83)
-
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 -
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 (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ;
Sur d’autres sites (8718)
-
Apply multiple text filters at once and burn into video for captioning without re-encoding, and fix error [ffmpeg-python wrapper]
13 mai, par BaldiIs there any way to burn text into a video without re-encoding ? I ask this because the re-encoding process goes at around 0.1x speed on my device when writing to WEBM. Alternatively, if there is a faster way to render high quality video quickly while still re-encoding that would be great. I vaguely remember someone writing to a temporary file to solve this problem.


Also small error in program, code attatched


def processVideo(self):
 print("creating video")

 # File location management
 font_path = self.input_path / "CalSans-Regular.ttf"
 background_path = self.input_path / "new_video_background.webm"
 audio_path = self.sound_output_path
 video_ouput_path = self.parent_path / "new_result.webm"
 sound_input = ffmpeg.input(str(audio_path))
 video_input = ffmpeg.input(str(background_path))

 # Adding captions
 print(self.text_caption)
 previous_timepoint = 0
 for caption, timepoint in zip(self.text_caption, self.timepoints, strict=False): 
 # Text caption and timepooints are lists where the end of the words in text_caption correspond
 # to the timepoint with the same index in timepoint
 video_input = video_input.drawtext(
 text=caption, 
 fontfile = font_path, 
 x='w-text_w/2', 
 y='h-text_h/2', 
 escape_text=True, 
 fontsize= 32,
 bordercolor = "black",
 borderw = 4,
 enable=f'between(t,{previous_timepoint},{timepoint["timeSeconds"]})'
 )
 previous_timepoint = timepoint["timeSeconds"]
 
 # Combining sound and video and writing output
 command = ffmpeg.output(sound_input, video_input, str(video_ouput_path), codec='copy').overwrite_output().global_args('-shortest')
 print("args =", command)
 print(command.get_args())
 command.run()
 print("done!")



File "c:\Desktop\Projects\video_project\main.py", line 239, in <module>
 post_list[0].processVideo()
 ~~~~~~~~~~~~~~~~~~~~~~~~~^^
 File "c:\Desktop\Projects\video_project\main.py", line 223, in processVideo
 command.run()
 ~~~~~~~~~~~^^
 File "C:\Desktop\Projects\video_project\.venv\Lib\site-packages\ffmpeg\_run.py", line 313, in run
 process = run_async(
 stream_spec,
 ...<5 lines>...
 overwrite_output=overwrite_output,
 )
 File "C:\Desktop\Projects\video_project\.venv\Lib\site-packages\ffmpeg\_run.py", line 284, in run_async
 return subprocess.Popen(
 ~~~~~~~~~~~~~~~~^
 args, stdin=stdin_stream, stdout=stdout_stream, stderr=stderr_stream
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 )
 ^
 File "C:\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 1038, in __init__
 self._execute_child(args, executable, preexec_fn, close_fds,
 ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 pass_fds, cwd, env,
 ^^^^^^^^^^^^^^^^^^^
 ...<5 lines>...
 gid, gids, uid, umask,
 ^^^^^^^^^^^^^^^^^^^^^^
 start_new_session, process_group)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 File "C:\AppData\Local\Programs\Python\Python313\Lib\subprocess.py", line 1550, in _execute_child
 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
 # no special security
 ^^^^^^^^^^^^^^^^^^^^^
 ...<4 lines>...
 cwd,
 ^^^^
 startupinfo)
 ^^^^^^^^^^^^
FileNotFoundError: [WinError 206] The filename or extension is too long
</module>


-
Capturing canvas to video in fastes way
28 novembre 2019, par Julien PlancheI’m capturing canvas which contains things like videos, images and text, but I capture each frame per frame, using the
onseeked
event to capture the next frame after seeking the video to the desired frame.
But it’s taking a long time.Is there a way to capture canvas faster ? e.g. Using GPU acceleration or dedicated software.
EDIT :
function download() {
const blob = new Blob(recordedBlobs, {type: 'video/webm'});
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = 'test.webm';
document.body.appendChild(a);
a.click();
setTimeout(() => {
document.body.removeChild(a);
window.URL.revokeObjectURL(url);
}, 100);
}
function handleDataAvailable(event) {
if (event.data && event.data.size > 0) {
recordedBlobs.push(event.data);
}
}
function handleStop(event) {
console.log('Recorder stopped: ', event);
const superBuffer = new Blob(recordedBlobs, {type: 'video/webm'});
document.querySelector('video').src = window.URL.createObjectURL(superBuffer);
}
function stopRecording() {
mediaRecorder.stop();
console.log('Recorded Blobs: ', recordedBlobs);
document.querySelector('video').controls = true;
}
function startRecording() {
videos.forEach(element =>{
element.play();
});
var stream = document.querySelector('canvas').captureStream(30);
let options = {mimeType: 'video/webm'};
recordedBlobs = [];
try {
mediaRecorder = new MediaRecorder(stream, options);
} catch (e0) {
console.log('Unable to create MediaRecorder with options Object: ', e0);
try {
options = {mimeType: 'video/webm,codecs=vp9'};
mediaRecorder = new MediaRecorder(stream, options);
} catch (e1) {
console.log('Unable to create MediaRecorder with options Object: ', e1);
try {
options = 'video/vp8'; // Chrome 47
mediaRecorder = new MediaRecorder(stream, options);
} catch (e2) {
alert('MediaRecorder is not supported by this browser.\n\n' +
'Try Firefox 29 or later, or Chrome 47 or later, ' +
'with Enable experimental Web Platform features enabled from chrome://flags.');
console.error('Exception while creating MediaRecorder:', e2);
return;
}
}
}
mediaRecorder.onstop = handleStop;
mediaRecorder.ondataavailable = handleDataAvailable;
mediaRecorder.start(100); // collect 100ms of data
console.log('MediaRecorder started', mediaRecorder);
const startTime = getTime();
let nextExpTime = startTime;
var curTime = null;
const onTimer = () => {
videos.forEach(element =>{
let dureeTotale = element.duration; // Durée de la vidéo en cours
if(frameNum == 1){
element.play();
element.pause();
}
// let seek = ((frameNum % (dureeTotale * 30 +1)) / 30); // Si dépassement, retour à 0 secondes;
let framerate = numFrames / dureeTotale;
if ((element.currentTime * framerate) === numFrames){
stopRecording();
download();
// capturer.stop();
// capturer.save(showVideoLink);
clearInterval(timer);
return;
}
})
};
onTimer();
const timer = setInterval(onTimer, 0);
}
} -
Issues with Discord JS Music Bot
5 décembre 2020, par ThresioI am in the process of creating a Discord bot with JS, giving it management, auto role, etc. I just got to the music section of it and I can't quite figure out whats wrong.



I believe I have installed FFmpeg correctly, as I have access to it from within the terminal. I have also used npm to bring ytdl-core and opusscript into my program.



What this should do is make the bot join the chat, then play the Youtube link. Currently, I am not error checking the second argument as I just wanted to get it working initially. I have implemented several different instances of .toString() and String() however it always gives the same error listed below.



. The program still throws this error :



TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object

C:\Users\Thresio's PC\Desktop\Discord Bot\node_modules\opusscript\build\opusscript_native_wasm.js:8
var Module=typeof Module!=="undefined"?Module:{};var moduleOverrides={};var
key;for(key in Module){if(Module.hasOwnProperty(key))
{moduleOverrides[key]=Module[key]}}Module["arguments"]=
[];Module["thisProgram"]="./this.program";Module["quit"]=function(status,toThrow) {throw
toThrow};Module["preRun"]=[];Module["postRun"]=[];var ENVIRONMENT_IS_WEB=false;var 
ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_HAS_NODE=false;var 
ENVIRONMENT_IS_SHELL=false;ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof 
importScripts==="function";ENVIRONMENT_HAS_NODE=typeof process==="object"&&typeof 
process.versions==="object"&&typeof 
process.versions.node==="string";ENVIRONMENT_IS_NODE=ENVIRONMENT_HAS_NODE&&!ENVIRONMENT_IS_WEB&&!ENVIRONM
ENT_IS_WORKER;ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;var
scriptDirectory="";function locateFile(path){i
abort(TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type 
string. Received type object). Build with -s ASSERTIONS=1 for more info. 




Here is my code for calling play :



case 'play':

 function play(connection, message){
 var server = servers[message.guild.id];

 server.dispatcher = connection.playStream(ytdl(server.queue[0], {filter: 'audioonly'}));

 server.queue.shift();

 server.dispatcher.on('end', function(){
 if(server.queue[0]){
 play(connection, message);
 }else {
 connection.disconnect();
 }
 })
 }

 if(!args[1]){
 message.channel.send('You need to provide a link!');
 return;
 }

 if(!message.member.voiceChannel){
 message.channel.send('You must be in a voice channel to play music!');
 return;
 }

 if(!servers[message.guild.id]) servers[message.guild.id] = {
 queue: []
 }

 var server = servers[message.guild.id];

 server.queue.push(args[1]);

 if(!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection){
 play(connection, message);
 })
 break;




If anyone could assist with this, I would be very grateful.



EDIT : I unfortunately never figured out my main issue, but I have now found code that works (unlike mine :/).
For anyone else having this issue, I suggest using the code found here.
Works like a charm !