
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (86)
-
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 (...) -
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
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 (9927)
-
no video above 360P with sound ytdl-core
26 juin 2021, par AshishI am able to download youtube separate videos and audios. but merging not working. 0 KB file is downloading


let info = await ytdl.getInfo(req.body.videoId);
let formatVideo = ytdl.chooseFormat(info.formats, { quality: req.body.format.itag, filter: 'videoonly' });
let formatAudio = ytdl.chooseFormat(info.formats, { quality: req.body.audioTag });
// res.json({video: formatVideo, audio: formatAudio});
const tracker = {
 start: Date.now(),
 audio: { downloaded: 0, total: Infinity },
 video: { downloaded: 0, total: Infinity },
 merged: { frame: 0, speed: '0x', fps: 0 },
};
res.header('Content-Disposition', `attachment; filename=${fileName}`);

cp.exec(`ffmpeg -i ${videoStream} -i ${audioStream} -c copy ${fileName}`, (error, success) => {
 if (!error) {
 console.log(success);
 } else {
 console.log(error);
 }
});
// Prepare the progress bar
let progressbarHandle = null;
const progressbarInterval = 1000;
const showProgress = () => {
 console.log('test');
 readline.cursorTo(process.stdout, 0);
 const toMB = i => (i / 1024 / 1024).toFixed(2);

 process.stdout.write(`Audio | ${(tracker.audio.downloaded / tracker.audio.total * 100).toFixed(2)}% processed `);
 process.stdout.write(`(${toMB(tracker.audio.downloaded)}MB of ${toMB(tracker.audio.total)}MB).${' '.repeat(10)}\n`);

 process.stdout.write(`Video | ${(tracker.video.downloaded / tracker.video.total * 100).toFixed(2)}% processed `);
 process.stdout.write(`(${toMB(tracker.video.downloaded)}MB of ${toMB(tracker.video.total)}MB).${' '.repeat(10)}\n`);

 process.stdout.write(`Merged | processing frame ${tracker.merged.frame} `);
 process.stdout.write(`(at ${tracker.merged.fps} fps => ${tracker.merged.speed}).${' '.repeat(10)}\n`);

 process.stdout.write(`running for: ${((Date.now() - tracker.start) / 1000 / 60).toFixed(2)} Minutes.`);
 readline.moveCursor(process.stdout, 0, -3);
};

// Start the ffmpeg child process
const ffmpegProcess = cp.spawn(ffmpeg, [
 // Remove ffmpeg's console spamming
 '-loglevel', '8', '-hide_banner',
 // Redirect/Enable progress messages
 '-progress', 'pipe:3',
 // Set inputs
 '-i', 'pipe:4',
 '-i', 'pipe:5',
 // Map audio & video from streams
 '-map', '0:a',
 '-map', '1:v',
 // Keep encoding
 '-c:v', 'copy',
 // Define output file
 `${fileName}`,
], {
 windowsHide: true,
 stdio: [
 /* Standard: stdin, stdout, stderr */
 'inherit', 'inherit', 'inherit',
 /* Custom: pipe:3, pipe:4, pipe:5 */
 'pipe', 'pipe', 'pipe', 'pipe'
 ],
});
ffmpegProcess.on('close', () => {
 console.log('done');
 // Cleanup
 process.stdout.write('\n\n\n\n');
 clearInterval(progressbarHandle);
 console.log(tracker, '146');
});

// Link streams
// FFmpeg creates the transformer streams and we just have to insert / read data
ffmpegProcess.stdio[3].on('data', chunk => {
 console.log(chunk, '152');
 // Start the progress bar
 if (!progressbarHandle) progressbarHandle = setInterval(showProgress, progressbarInterval);
 // Parse the param=value list returned by ffmpeg
 const lines = chunk.toString().trim().split('\n');
 const args = {};
 for (const l of lines) {
 const [key, value] = l.split('=');
 args[key.trim()] = value.trim();
 }
 tracker.merged = args;
 // console.log(tracker.merged, '162');
});
// audio.pipe(ffmpegProcess.stdio[4]);
// video.pipe(ffmpegProcess.stdio[5]);
const audioStream = await requestObj.get(formatAudio.url);
const videoStream = await requestObj.get(formatVideo.url);
audioStream.pipe(ffmpegProcess.stdio[4]);
videoStream.pipe(ffmpegProcess.stdio[5]);
ffmpegProcess.stdio[6].pipe(res);



here requestObj is a node js 'request' module


-
Video editing in UWP apps
23 septembre 2021, par MatS2510I'm creating an video downloading app in C# and Universal Windows Platform. App downloads movies in three different file sets depending on the source :


- 

- .ts audio & video file
- .mp4 only video file and .webm only audio file
- .mp4 audio & video file
The video lenghts, on which I tested the app, range from a few seconds to several hours. Video qualities are standard YouTube qualities.








The next step is video editing. User can specify start and end trimming timestamp. Video can be saved in three different modes :


- 

- Audio & Video
- Only audio
- Only video








This is where the problem begins.


I can't use FFmpeg as executable, because UWP framework doesn't allow to run external app.


So I tried to use Windows.Media.Editing library. It works fine with all .mp4 audio & video files and some .ts files (but only with short videos up to an hour). Other cases throws two types of exceptions :


- 

- System.Exception
HResult=0xC00DA7FC
Message=Stream is not in a state to handle the request. Stream is not in a state to handle the request.
Source=System.Private.CoreLib
- System.Exception
HResult=0xC00D6D60
Message=A valid type has not been set for this stream or a stream that it depends on. (Exception from HRESULT : 0xC00D6D60)
Source=System.Private.CoreLib






I wrote a separate question about it : Exception when rendering a video in UWP . Here is also a link to an example (In comments with sample videos, which causes an error. Link to github repository.) that downloads and tries to convert the .ts file to the .mp4 file.


So I decided to try the most complicated solution. I created a C++ DLL project and set build output destination to the new folder in the main app project folder (and set this folder to copy to build output directory). I installed an ffmpeg libraries by vcpkg and imported them in C++ project.
Here is the .cpp file :


#include "pch.h"
#include "mux.h"

extern "C" {
 #include "libavformat/avformat.h"
}

int test() {
 av_register_all();
 return 0;
}



Here is the header :


#pragma once

#ifdef FFMPEGLIB_EXPORTS
#define FFMPEGLIB_API __declspec(dllexport)
#else
#define FFMPEGLIB_API __declspec(dllimport)
#endif

extern "C" FFMPEGLIB_API int test();



And here is the C# class where is imported C++ function :


class FFmpeg
{
 [DllImport(@"FFmpeg\FFmpegLib.dll")] private static extern int test();

 public static void Test()
 {
 test();
 }
}



But calling an Test() void throws an error :
System.DllNotFoundException : 'Unable to load DLL 'FFmpeg\FFmpegLib.dll' or one of its dependencies : The specified module could not be found. (Exception from HRESULT : 0x8007007E)'


There are also ffmpeg libraries (avcodec-58.dll, avformat-58.dll, avutil-56.dll, swresample-3.dll) in FFmpeg folder.
I also tried to import avformat-58.dll directly in C# (main app project) and call av_register_all() function, but it throws the same exception. I also checked if I could include "libavformat/avformat.h" in C++ UWP app, but it shows error "cannot open source file "libavformat/avformat.h"". I guess that C libraries are incompatible with UWP, but I'm not sure.


I have no more ideas. If it is not possible to use the methods I have mentioned, my question is Are there any other ways to process videos in UWP app ?


-
Concatenating audio files and superimposing over video
25 avril 2022, par kahI'm trying to write a program that takes a bunch of videos from a folder, compiles them, and then takes another bunch of audio files from a folder and concatenates them to then overlay the combined audio on top of the final video (hope that makes sense). I'm able to process the videos into one final output video, but I keep running into trouble combining the audio. Below I've provided two small sections of code pertaining to audio comp, I'm using moviepy to process the videos and attempting to use it for audio as well.


songDirectory = './songs/'
songList = []
songs = []
audioclip=''

def makeCompilation():
 for filename in os.listdir(songDirectory):
 f = os.path.join(songDirectory, filename)
 if os.path.isfile(f) and filename.endswith(".mp3"):
 audioclip = moviepy.editor.AudioFileClip(f)
 songList.append(filename)


 for song in os.listdir(songDirectory):
 c = os.path.join(songDirectory, song)
 audio_clips = moviepy.editor.AudioFileClip(c)
 audio_output = moviepy.editor.concatenate_audioclips(audio_clips)
 finalClip = concatenate_videoclips(videos, method="compose")
 final_duration = finalClip.duration 
 final_audio_output = audio_output.set_duration(final_duration)
 final_output= finalClip.set_audio(final_audio_output).fx(afx.audio_fadein, 3.0)


 audio_path = "./songs/tempaudiofile.m4a"

 #print(description)
 # Create compilation
 final_output.write_videofile(outputFile, threads=8, temp_audiofile=audio_path, remove_temp=True, codec="libx264", audio_codec="aac")

 return description



The program appeared to be able to find the audio directory, but I needed to be able to use os.path.join(songDirectory, filename) to point directly to each mp3 file so I messed around with it until I got the above code. And when I attempted to iterate through songList, I, as expected, got an error saying that 'str' wasn't iterable, and other errors saying that 'str' has no attribute 'duration'. Essentially, all I need it to do is iterate though the input folder and combine the files by whatever means. Code currently returns the output :


🌲Free Fredobagz x Aflacko x Flint type beat - 'Default_Dance' [prod. kah]-jro0v6ogZ0Y.mp4
225.05
Total Length: 225.05
225.05
Traceback (most recent call last):
 File "/Users/daddyK/Desktop/comp_ bot/make_compilation3.py", line 127, in <module>
makeCompilation(path = "./videos/",
 File "/Users/daddyK/Desktop/comp_ bot/make_compilation3.py", line 110, in makeCompilation
audio_output = moviepy.editor.concatenate_audioclips(audio_clips)
 File "/Users/daddyK/Library/Python/3.10/lib/python/site-packages/moviepy/audio/AudioClip.py", line 315, in concatenate_audioclips
durations = [c.duration for c in clips]
TypeError: 'AudioFileClip' object is not iterable
</module>



At this point I'm a bit stumped, so if anybody could offer some insight as to what I should do to resolve the error and/or if I'm headed in the right direction code-wise I'd greatly appreciate it ! Sorry if the code doesn't make any sense I'll post the whole .py file if needed