
Recherche avancée
Médias (1)
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (46)
-
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
Submit bugs and patches
13 avril 2011Unfortunately a software is never perfect.
If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
You may also (...)
Sur d’autres sites (8304)
-
Improper use of system() call ?
28 mai 2013, par Dima1982I have a particle system program that generates a
.dat
file with particle coordinates in every iteration. The end goal is to run the program multiple times via a script with different parameters. So, I am trying to setup my program in a way that, for every run, all relevant data are going to be stored in a folder.What I do is to generate
PNGs
from the.dat
files withGnuplot
, callffmpeg
to create a video out of thePNGs
, useWinRAR
to compress the.dat
files and finally clean up, by deleting all the intermediate files. This works, when I do it in the working directory.Now I try to create a new directory and do the same stuff in there. My code :
// Load the proper library to use chdir() function
#ifdef _WIN32
#include
#elif defined __linux__ || defined __APPLE__&&__MACH__
#include
#endif
// Make output directory and change working directory to new directory
ostringstream dirCommand;
dirCommand << "mkdir " << folderName_str;
system(dirCommand.str().c_str());
const char* test = folderName_str.c_str();
#ifdef _WIN32
if(_chdir(test))
{
printf( "Unable to locate the directory: %s\n",test);
return;
}
#elif defined __linux__ || defined __APPLE__&&__MACH__
if(chdir(test))
{
printf( "Unable to locate the directory: %s\n",test);
return;
}
#endif
else
printf("Created output directory...\n");Already for this part, I know that there are going to be objections. I have looked extensively on SO and many people favor
SetCurrentDirectory()
for Windows, or they are skeptical about usingsystem()
. In my defense, I am a novice programmer and my knowledge is really limited...Now, when I try to make the video with
FFMpeg
and then rar/tar my files :// Make video
std::cout << "Generating Video..." << endl;
ostringstream command;
command << "ffmpeg -f image2 -r 1/0.1 -i output_%01d.png -vcodec mpeg4 " << videoName_str << ".avi -loglevel quiet";
std::system(command.str().c_str());
// Clean Up!
std::cout << "Cleaning up!" << endl;
ostringstream command2;
#ifdef _WIN32
command2 << "rar -inul a " << videoName_str << ".rar *.dat settings.gp loadfile.gp";
#elif defined __linux__ || defined __APPLE__&&__MACH__
command2 << "tar cf " << videoName_str << ".tar *.dat settings.gp loadfile.gp";
#endif
std::system(command2.str().c_str());I get very different behaviors in Win/ Linux.
Win 7 x64, Visual Studio 2010/12
In windows, the folder is created. The
.dat
files are generated correctly andgnuplot
plots thePNGs
as well. Whenffmpeg
is called, nothing happens. No error message fromFFMpeg
or anything. The same goes forWinRAR
. Maybe, for the last thing, I can use the command line utility of7z
which is free !Linux Mint 14 x64, Qt 4.8.1
Strangely enough, the behavior is inverted from that of Windows. As soon as the dir is changed, only the first
.dat
file is generated. It is as if every subsequent call I make tofprintf()
for my file generation does not work, or gets lost somewhere.Gnuplot
works, as doffmpeg
andtar
!!I am really perplexed. Any help, would be really appreciated.
-
ffmpeg exit code 429496724 when opening file with {} in name
16 février, par Holly WilsonI'm trying to write a program that will read the names of files in a directory, and parse them for info which it will then write into that file's metadata (seems pointless, I know, but it's more of a trial run for a larger project. If I can figure this out, then I'll be ready to move on to what I actually want to do).
All of my filenames are formatted :


Title, Article* - Subtitle* Cut* [Year]
*if present


The four test videos I'm using are titled :


Test Video 1 [2000]


Test Video 2, A [2000]


Test Video 3 Test Cut [2000]


Test Video 4 - The Testening [2000]


The code seems to be working fine on videos 1, 2, & 4 ; but video 3 is causing me a lot of headache.


//node C:\Users\User\Documents\Coding\Tools\testMDG.js
const fs = require('fs');
const path = require('path');
const ffmpeg = require('fluent-ffmpeg');
const async = require('async');
const directory = path.normalize('F:\\Movies & TV\\Movies\\testDir');
let x = 0;
const fileArray = [];
const succArray = [];
const failArray = [];
// Set the path to the ffmpeg executable
ffmpeg.setFfmpegPath(path.normalize('C:\\ffmpeg\\bin\\ffmpeg.exe'));

// Add this near the start of your script
const tempDir = path.join(directory, 'temp');
if (!fs.existsSync(tempDir)) {
 fs.mkdirSync(tempDir, { recursive: true });
}

const progresscsv = path.normalize('C:\\Users\\User\\Documents\\Coding\\Tools\\progress.csv');
if (fs.existsSync(progresscsv)) {
 fs.unlinkSync(progresscsv);
};

const csvStream = fs.createWriteStream(progresscsv);
csvStream.write('File Name,Status\n');

const CONCURRENCY_LIMIT = 3; // Adjust based on your system capabilities

// Add at the start of your script
const processedFiles = new Set();

function sanitizeFilePath(filePath) {
 return filePath.replace(/([{}])/g, '\\$1');
}

// Create a queue
const queue = async.queue(async (task, callback) => {
 const { file, filePath, tempFilePath, movieMetadata } = task;
 try {
 await new Promise((resolve, reject) => {
 console.log(`ffmpeg reading: ${sanitizeFilePath(filePath)}`);
 ffmpeg(sanitizeFilePath(filePath))
 .outputOptions([
 '-y',
 '-c', 'copy',
 '-map', '0',
 '-metadata', `title=${movieMetadata.title}`,
 '-metadata', `subtitle=${movieMetadata.subtitle || ''}`,
 '-metadata', `comment=${movieMetadata.cut || ''}`,
 '-metadata', `year=${movieMetadata.year}`
 ])
 .on('error', (err) => reject(err))
 .on('end', () => resolve())
 .saveToFile(tempFilePath);
 });
 
 // Handle success
 console.log(`Successfully processed: ${file}`);
 succArray.push(file);
 // Only call callback once
 if (callback && typeof callback === 'function') {
 callback();
 }
 } catch (err) {
 // Handle error
 console.error(`Error processing ${file}: ${err.message}`);
 failArray.push(file);
 // Only call callback once with error
 if (callback && typeof callback === 'function') {
 callback(err);
 }
 }
}, CONCURRENCY_LIMIT);

fs.readdir(directory, (err, files) => {
 if (err) {
 console.error(`Error reading directory: ${err.message}`);
 return;
 }
 console.log(directory);

 // Filter for files only
 files = files.filter(file => fs.statSync(path.join(directory, file)).isFile());
 console.log(files);

 for (const file of files) {
 x++;
 const filePath = path.join(directory, file);
 let desort = file.replace(/(.*),\s(the\s|an\s|a\s)/i, '$2'+'$1 ') || file;
 
 // Create task object for queue
 const task = {
 file,
 filePath: filePath,
 tempFilePath: path.join(directory, 'temp', `temp_${x}_${path.parse(file).name
 .replace(/[^a-zA-Z0-9]/g, '_')}${path.extname(file)}`),
 movieMetadata: {
 title: desort.replace(/(\s[\-\{\[].*)/gi, ``),
 subtitle: desort.includes('-') ? desort.replace(/(.*)\-\s(.*?)[\{\[].*/gi, '$2') : null,
 cut: desort.includes('{') ? desort.replace(/.*\{(.*)\}.*/gi, '$1') : null,
 year: desort.replace(/.*\[(.*)\].*/gi, '$1')
 }
 };
 
 // Add to processing queue
 queue.push(task, (err) => {
 if (!processedFiles.has(task.file)) {
 processedFiles.add(task.file);
 if (err) {
 csvStream.write(`${task.file},Failed\n`);
 } else {
 csvStream.write(`${task.file},Processed\n`);
 }
 }
 });
 }
});

// Add queue completion handler
queue.drain(() => {
 console.log('All files have been processed');
 console.log(`Success: ${succArray.length} files: ${succArray}`);
 console.log(`Failed: ${failArray.length} files: ${failArray}`);
});

//node C:\Users\User\Documents\Coding\Tools\testMDG.js



And the console is logging :


PS C:\Users\User> node C:\Users\User\Documents\Coding\Tools\testMDG.js
F:\Movies & TV\Movies\testDir
[
 'Test Video 1 [2020].mp4',
 'Test Video 2, A [2020].mp4',
 'Test Video 3 {Test Cut} [2020].mp4',
 'Test Video 4 - The Testening [2020].mp4'
]
ffmpeg reading: F:\Movies & TV\Movies\testDir\Test Video 1 [2020].mp4
ffmpeg reading: F:\Movies & TV\Movies\testDir\Test Video 2, A [2020].mp4
ffmpeg reading: F:\Movies & TV\Movies\testDir\Test Video 3 \{Test Cut\} [2020].mp4
Error processing Test Video 3 {Test Cut} [2020].mp4: ffmpeg exited with code 4294967294: Error opening input file F:\Movies & TV\Movies\testDir\Test Video 3 \{Test Cut\} [2020].mp4.
Error opening input files: No such file or directory

ffmpeg reading: F:\Movies & TV\Movies\testDir\Test Video 4 - The Testening [2020].mp4
Successfully processed: Test Video 1 [2020].mp4
Successfully processed: Test Video 2, A [2020].mp4
Successfully processed: Test Video 4 - The Testening [2020].mp4
All files have been processed
Success: 3 files: Test Video 1 [2020].mp4,Test Video 2, A [2020].mp4,Test Video 4 - The Testening [2020].mp4
Failed: 1 files: Test Video 3 {Test Cut} [2020].mp4



I've tried so many different solutions in the sanitizeFilePath function. Escaping the {} characters (as included below), escaping all non-alphanumeric characters, putting the filepath in quotes, etc. VSCode's CoPilot is just pulling me round in circles, suggesting solutions I've already tried.


-
Creating Thumbnails From Ffmpeg Hangs Php
30 octobre 2012, par Piyush AroraI have been working on a php webservice, which receives videos(uploaded) from iphone and upload them to Amazon cloudFront. After uploading videos, I need to generate thumbnails for video from the Amazon link generated. I am using ffmpeg with
shell_exec
command for it. Here is the code for the same :public function createThumbnail($userId,$fileUrl,$imageName){
//$imageUrl = 'http://184.168.116.177:81/json_api/json/bin/';
if(!is_dir("images/".$userId)){
mkdir("images/".$userId);
}
// path of installed ffmpeg
$ffmpeg = $_SERVER['DOCUMENT_ROOT'] .'bin/ffmpeg';
$cmd = "$ffmpeg -itsoffset -1 -i $fileUrl -vcodec mjpeg -vframes 1 -an -f rawvideo -s 320x240 images/".$userId."/".$imageName;
shell_exec($cmd);
return "images/".$userId."/".$imageName;
}The above code generates the thumbnail, but script does not execute after shell_exec command. So, there is no response sent to iphone end about the thumbnail link. This function works well video is uploaded from web browser of pc. If I comment, shell_exec command, then response is sent to iphone end, but obviousely image is not created.
Thanks in advance.