Recherche avancée

Médias (0)

Mot : - Tags -/alertes

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (45)

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

  • 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 (...)

  • Use, discuss, criticize

    13 avril 2011, par

    Talk to people directly involved in MediaSPIP’s development, or to people around you who could use MediaSPIP to share, enhance or develop their creative projects.
    The bigger the community, the more MediaSPIP’s potential will be explored and the faster the software will evolve.
    A discussion list is available for all exchanges between users.

Sur d’autres sites (6298)

  • After downloading the file i got 0 byte file size, I dont know how to solve this error ? [closed]

    7 octobre 2024, par Saurabh Chauhan

    This is the handler function which converts a given format to another format but when i provide additional options(like trim audio,bitrate,codec,sample rate etc) to audio and video then it gives me 0 byte file after converting and if i do not include additional options then it gave me correct file.

    


    Please look into this and provide me solution.

    


    const handleConvert = async () => {

  if (!ffmpeg) return;

  setConverting(true);

  for (let uploadedFile of uploadedFiles) {
    const { file } = uploadedFile;
    const fileNameWithoutExtension = getFileNameWithoutExtension(file.name);
    const inputFile = file.name;
    let outputFile;
    let outputFormat;
    const { bitrate, channels, codec, sampleRate, trimStart, trimEnd, volume } = optionsdata;

    try {
      await ffmpeg.writeFile(inputFile, await fetchFile(file));
      let command = ['-i', inputFile];
      // Handle audio conversion with advanced options
> if (supportedAudioFormats.some(ext => file.name.endsWith(ext)) || supportedVideoFormats.some(ext => file.name.endsWith(ext))) {
        outputFile = `${fileNameWithoutExtension}.${audioFormat}`;
        outputFormat = audioFormat;

        // Add trim options if they exist
        if (trimStart && trimEnd) {
          command.push('-ss', trimStart, '-to', trimEnd);
        } else if (trimStart) {
          command.push('-ss', trimStart);
        }

        // Adjust volume if specified
        if (volume && volume !== 'no change') {
          command.push('-filter:a', `volume=${volume}`);
        }
        
        // Apply advanced audio settings like codec, bitrate, and channels
        if (codec) {
          command.push('-c:a', codec);
        }
        if (bitrate) {
          command.push('-b:a', `${bitrate}k`);
        }
> if (channels && channels !== 'no change') {
          command.push('-ac', channels === 'mono' ? '1' : '2');
        }
        if (sampleRate && sampleRate !== 'no change') {
          command.push('-ar', sampleRate);
        }

        // Add output file to the command
        command.push(outputFile);
        console.log('Command Array:', command);
        // Execute FFmpeg command
        await ffmpeg.exec(command);

      } else if (supportedImageFormats.some(ext => file.name.endsWith(ext))) {
        // Image conversion logic
        outputFile = `${fileNameWithoutExtension}.${imageFormat}`;
        outputFormat = imageFormat;
        command.push(outputFile);
        await ffmpeg.exec(command);

      } else if (supportedSubtitleFormats.some(ext => file.name.endsWith(ext))) {
        // Subtitle conversion logic
        outputFile = `${fileNameWithoutExtension}.${subtitleFormat}`;
        outputFormat = subtitleFormat;
        command.push(outputFile);
        await ffmpeg.exec(command);

      } else {
        console.error('Unsupported file type: ', file.name);
        continue; // Skip unsupported files
      }
      // Create Blob and URL for the converted file
      const data = await ffmpeg.readFile(outputFile);
      const convertedBlob = new Blob([data.buffer], {
        type: outputFormat === 'png' ? 'image/png' : `audio/${outputFormat}` || `text/vtt`,
      });
      const convertedUrl = URL.createObjectURL(convertedBlob);

      setConvertedFiles((prevFiles) => [
        ...prevFiles,
        { name: outputFile, url: convertedUrl, format: outputFormat },
      ]);
    } catch (error) {
      console.error('Conversion error:', error);
    }
  }

  setConversionFinished(true);
  setConverting(false);
  setoptionsdata({
    'codec':'',
    'bitrate':'',
    'channels':'',
    'volume':'',
    'sampleRate':'',
    'trimStart':'',
    'trimEnd':''
  });
};



    


  • Pass argument through .bat file to .exe file that converted by 'PyInstaller'

    23 novembre 2019, par Ayoub Ocarina

    I got an error when passing arguments through .bat file to .exe file that converted by PyInstaller
    In my python script I import the following libraries :

    import time
    from contextlib import closing
    from PIL import Image
    import subprocess
    from audiotsm import phasevocoder
    from audiotsm.io.wav import WavReader, WavWriter
    from scipy.io import wavfile
    import numpy as np
    import re
    import math
    from shutil import copyfile, rmtree
    import os
    import argparse
    from pytube import YouTube
    import cv2
    from datetime import datetime
    import datetime
    import os.path
    import shutil
    import webbrowser

    and this is my .bat file content :

    mode con: cols=100 lines=40
    @echo off
    COLOR 0A
    title VideoCuts
    :LOOP
    if "%~1"=="" goto :END
    ShortCut.exe --input_file "%~1" --silent_threshold 0.1 --silent_speed 9999999.00 --frame_margin 5 --sample_rate 48000 --frame_quality 1 --output_file "%~n1_%date:~-10,2%%date:~-7,2%%date:~-4,4%_%time:~0,2%%time:~3,2%%time:~6,2%_videocuts.mp4"
    pause

    I also tested using this .bat file :

    ShortCut.exe --input_file="%~1" --silent_threshold=0.1 --silent_speed=9999999.00 --frame_margin=5 --sample_rate=48000 --frame_quality=1 --output_file="videocuts.mp4"

    this is my error message images during processing

  • download youtube video as audio file, with URL in filename, to a specific output directory

    9 octobre 2018, par thanks_in_advance

    I do this to download a video as an audio file (mp3), with the video’s youtube URL (URI actually) in the audio file’s filename (I like having the URI in the filename because it helps me identify which video I grabbed the audio from) :

    youtube-dl --extract-audio --audio-format mp3 --prefer-ffmpeg --ffmpeg-location "C:\FFMPEG" "https://www.youtube.com/watch?v=k1-TrAvp_xs" --audio-quality 0

    The con with this approach : with this command, the file downloads to the same directory that contains youtube-dl.exe


    I do this to download a youtube video as an audio file (mp3) to a specific output directory :

    youtube-dl -o "C:\Documents\Downloads\%(title)s.%(ext)s" --extract-audio --audio-format mp3 --prefer-ffmpeg --ffmpeg-location "C:\FFMPEG" "https://www.youtube.com/watch?v=k1-TrAvp_xs" --audio-quality 0

    The con with this approach : with this command, the downloaded audio file’s filename doesn’t contain the youtube video’s URI.


    My Question : How can I combine the above 2 commands such that the downloaded audio file doesn’t have either of the cons mentioned above ?