Recherche avancée

Médias (1)

Mot : - Tags -/MediaSPIP 0.2

Autres articles (61)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une 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 statuts des instances de mutualisation

    13 mars 2010, par

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

  • Contribute to documentation

    13 avril 2011

    Documentation is vital to the development of improved technical capabilities.
    MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
    To contribute, register to the project users’ mailing (...)

Sur d’autres sites (3984)

  • If a MP3 file contains the string NSVs, the NSV probe will think it is a NSV file...

    12 mai 2011, par Thierry Foucu

    If a MP3 file contains the string NSVs, the NSV probe will think it is a NSV file...

  • Cannot convert video file to audio file inside AWS lambda function using Node js

    21 février 2019, par Arun

    I cannot convert a video file into an audio file inside AWS lambda function using Node JS. While running my lambda function it doesn’t throw any error it executes without any error. But the audio file size is still 0 MB size. I am not able to find bugs or any issues in my code.

    Here is my code,

    const fs = require('fs');
    const childProcess = require('child_process');
    const AWS = require('aws-sdk');
    const path = require('path');
    AWS.config.update({
       region : 'us-east-2'
    });
    const s3 = new AWS.S3({apiVersion: '2006-03-01'});


    exports.handler = (event, context, callback) => {
       process.env.PATH = process.env.PATH + ':/tmp/';
       process.env['FFMPEG_PATH'] = '/tmp/ffmpeg';
       const BIN_PATH = process.env['LAMBDA_TASK_ROOT'];
       process.env['PATH'] = process.env['PATH'] + ':' + BIN_PATH;

       childProcess.exec(
           'cp /var/task/ffmpeg /tmp/.; chmod 755 /tmp/ffmpeg;',
           function (error, stdout, stderr) {
               if (error) {
                   console.log('Error occured',error);
               } else {
                   var ffmpeg = '/tmp/ffmpeg';
                   var createStream = fs.createWriteStream("/tmp/video.mp3");
                   createStream.end();
                   var params = {
                       Bucket: "test-bucket",
                       Key: event.Records[0].s3.object.key
                   };
                   s3.getObject(params, function(err, data) {
                       if (err) {
                           console.log("Error", err);
                       }
                       fs.writeFile("/tmp/vid.mp4", data.Body, function (err) {
                           if (err) console.log(err.code, "-", err.message);
                           return callback(err);
                       }, function() {
                           try {
                               var stats = fs.statSync("/tmp/vid.mp4");
                               console.log("size of the file1 ", stats["size"]);
                               try {
                                   console.log("Yeah");
                                   const inputFilename = "/tmp/vid.mp4";
                                   const mp3Filename = "/tmp/video.mp3";
                                   // // Convert the FLV file to an MP3 file using ffmpeg.
                                   const ffmpegArgs = [
                                       '-i', inputFilename,
                                       '-vn', // Disable the video stream in the output.
                                       '-acodec', 'libmp3lame', // Use Lame for the mp3 encoding.
                                       '-ac', '2', // Set 2 audio channels.
                                       '-q:a', '6', // Set the quality to be roughly 128 kb/s.
                                       mp3Filename,
                                   ];
                                   try {
                                       const process = childProcess.spawnSync(ffmpeg, ffmpegArgs);
                                       console.log("stdout ", process.stdout);
                                       console.log("stderr ", process.stderr);
                                       console.log("tmp files ");
                                       fs.readdir('/tmp/', (err, files) => {
                                           files.forEach(file => {
                                               var stats = fs.statSync(`/tmp/${file}`);
                                               console.log("size of the file2 ", stats["size"]);
                                             console.log(file);
                                           });
                                         });

                                   } catch (e) {
                                       console.log("error while converting video to audio ", e);
                                   }

                                   // return process;
                               } catch (e) {
                                   console.log(e);
                               }
                           } catch (e) {
                               console.log("file is not complete", e);
                           }
                       }, function () {
                           console.log("checking ");
                           var stats = fs.statSync("/tmp/video.mp3");
                           console.log("size of the file2 ", stats["size"]);
                       });

                       return callback(err);
                   });
               }
           }
       )
    }

    Code workflow

    First of all, I have downloaded ffmpeg binary exec file and put into my project directory. After that, I compressed my project and put it into the lambda function. This lambda function will be triggered whenever the new files are uploaded into an S3 bucket. I have checked /tmp/ storage files and the audio file .mp3 present but the size is 0 MB.

    Note

    And also, in my code the below is not calling or this part is not reaching. When I look into Cloudwatch logs I can’t see this console log messages. I don’t know why this function is not calling.

    function () {
           console.log("checking ");
           var stats = fs.statSync("/tmp/video.mp3");
           console.log("size of the file2 ", stats["size"]);
       });

    Please help me to find the solution of this issue. I have spent a lot of times to figure out this issue. But I am not able to find the solution. Any suggestions are welcome !!
    Thanks,

  • python : can't open file 'F :\\Episode Split\\Episode' : [Errno 2] No such file or directory [closed]

    26 février 2024, par Rafa Segovia

    everyone !

    


    I'm trying to write a python script to split a video into parts based on a list of expressions from a docx file, comparing them to the dialogue on an srt file.
I think I have everything installed on my Windows 10 pc.
I keep getting this error.

    


    python : can't open file 'F :\Episode Split\Episode' : [Errno 2] No such file or directory

    


    It's like it detects a space somewhere and stops reading a path.
There's no file called "Episode" anywhere mentioned on the script.
Can you take a look at the script and pinpoint how I can fix this error ?

    


    Thank you

    


    import os
import re
import cv2
import unicodedata
import chardet
from fuzzywuzzy import fuzz
import docx
from bs4 import BeautifulSoup
import xml.etree.ElementTree as ET

# Define variables
expressions_per_cut = 4
max_time_per_cut_seconds = 20
fuzzy_ratio = 60
input_parent_folder = r'F:\Episode Split'
xml_output_folder = r'F:\Episode Split'



    


    I tried removing spaces in the paths by using hyphens among other things.