Recherche avancée

Médias (39)

Mot : - Tags -/audio

Autres articles (42)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-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

  • Contribute to a better visual interface

    13 avril 2011

    MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
    Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community.

Sur d’autres sites (7042)

  • ffmpeg download mp3 in chunks slower than whole file

    6 août 2021, par loretoparisi

    I'm programmatically downloading in Python mp3 file's as wav chunks, seeking at position with ss and t with ffmpeg resulting in a sequence of ffmpeg commands

    


    ffmpeg -i https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_5MG.mp3 -acodec pcm_s16le -ac 1 -ar 44100 -ss 0:08:55.780000 -t 0:01:00.000000 -sn -vn -y -f wav pipe:1
ffmpeg -i https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_5MG.mp3 -acodec pcm_s16le -ac 1 -ar 44100 -ss -ss 0:09:55.780000 -t 0:01:00.000000 -sn -vn -y -f wav pipe:1
ffmpeg -i https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_5MG.mp3 -acodec pcm_s16le -ac 1 -ar 44100 -ss -ss -ss 0:10:55.780000 -t 0:01:00.000000 -sn -vn -y -f wav pipe:1
...


    


    executed via concurrent.futures.ThreadPoolExecutor in this way :

    


    with concurrent.futures.ThreadPoolExecutor(max_workers=NTHREADS) as executor:
        for i,cmd in enumerate(process_list):
            futures.append(executor.submit(downloader.chunk_download,(cmd,i)))

        for future in concurrent.futures.as_completed(futures):
            try:
                completed.append(future.result())
            except Exception as e:print(e)
    completed.sort() 
    for k,c in enumerate(completed):
        if not k:
            waveform = c[1]
        else:
            waveform = np.append(waveform,c[1])


    


    where chunk_download is concat the chunks into the whole waveform

    


    def chunk_download(self,args):
        cmd=args[0]
        i=args[1]
        print('Downloading chunk n° %i' % i)

        print( ' '.join(cmd))
        process = subprocess.run(cmd,
                            stdout=subprocess.PIPE,
                            stderr=subprocess.PIPE,
                            bufsize=10**8)
        #buffer, stderr = process.communicate()
        buffer = process.stdout
        stderr = process.stderr
        print('chunk n° %i DOWNLOADED' % i)
        # convert to signal
        chunk_waveform = np.frombuffer(buffer=buffer, dtype=np.uint16, offset=8*44)
        chunk_waveform = chunk_waveform.astype(self.dtype)  
        print(len(chunk_waveform)/44100) 

        return i,chunk_waveform


    


    this works ok, but if I download the whole mp3, executing the command in cmd like :

    


    ffmpeg -i https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_5MG.mp3 -acodec pcm_s16le -ac 1 -ar 44100 -sn -vn -y -f wav pipe:1


    


    It will take less time than the concurrent chunks download for the same file length, while I would expect the opposite. Could be this related to ffmpeg threading option (param --thread ?). If not, why the concurrent chunks download operation is slower ?

    


  • How to upload a transcoded file to s3 and create a link to download it

    29 septembre 2022, par Dotun Longe

    I want to download a video after my module "creates" it by combining a picture and audio file. The output goes to my tmp folder. This works, but I don't know how to access it.

    


    My method is to create another Paperclip attachment called "converted" and the module responsible for transcoding should also be responsible for uploading the converted video to a bucket, where I can then access it via @upload.converted.url.

    


    I have no idea how to go about this, and my eyes hurt from searching. If you have a better way for me to be able to download the transcoded video without this option, I will be open to it.

    


    # videocreatingproccessor.rb

require 'streamio-ffmpeg'
require 'fileutils'

module VideoCreatingProcessor
  def self.convert_to_video (path_to_audio_file, path_to_image_file)
    movie = FFMPEG::Movie.new(path_to_audio_file)
    options = {
      video_codec: "libx264",
      frame_rate: 60,
      resolution: "960x720",
      x264_vprofile: "high",
      x264_preset: "slow",
      pixel_format: "720p",
      audio_codec: "libfaac",
      audio_bitrate: 32,
      audio_sample_rate: 44100,
      audio_channels: 2,
      threads: 2,
    }

    woptions = { watermark: path_to_image_file, resolution: "960x720", watermark_filter: { padding_x: 10, padding_y: 10 } }

    movie.transcode("tmp/output.mp4",woptions ,options )
  end
end


    


    # uploads_controller.rb

class UploadsController < ApplicationController
  before_action :set_upload, only: [:show, :edit, :update, :destroy]

  def index
    @uploads = Upload.all
  end

  def paudioaddress
    "https:" + @upload.audio.url
  end

  def pimageaddress
    "https:" + @upload.image.url
  end

   def show
    require "video_creating_processor"
    newvideo = VideoCreatingProcessor.convert_to_video(paudioaddress, pimageaddress)
   end

   # ....
end


    


  • download and fill file on fly

    4 mai 2017, par Gianluca Calabria

    I’m trying to create a service for a client which takes some audio chunks and concatenate them. For this I’m using FFmpeg. The user should also be able to download the result on the fly without waiting for the conversion/concatenation to finish. The idea is to "fill" the file as the process goes on. I cannot work my way around it, is it possible to do ? I’m using a RESTful service which calls a class like this one

    public ReadableRepresentation serveDownloadRequest(Representation entity) throws SystemInitializationException {
       InputStreamChannel inputStreamChannel;
       Form reqParameters=getQuery();
       try {

           String parameters = readStringParameter(reqParameters, AudioCutAndJoinParameters.PARAMETERS, AudioCutAndJoinParameters.PARAMETERS_MANDATORY);
           trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.PARAMETERS + "=" + parameters);

           String inputUri = readStringParameter(reqParameters, AudioCutAndJoinParameters.INPUT_URI, AudioCutAndJoinParameters.INPUT_URI_MANDATORY);
           trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.INPUT_URI + "=" + inputUri);

           String markInRelative = readStringParameter(reqParameters, AudioCutAndJoinParameters.MARKIN_ID_RELATIVE, AudioCutAndJoinParameters.MARKIN_ID_RELATIVE_MANDATORY);
           trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.MARKIN_ID_RELATIVE + "=" + markInRelative);

           String parametersString = readStringParameter(reqParameters, AudioCutAndJoinParameters.PARAMETERS_STRING, AudioCutAndJoinParameters.PARAMETERS_STRING_MANDATORY);
           trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.PARAMETERS_STRING + "=" + parametersString);

           String cmdFolder = readStringParameter(reqParameters, AudioCutAndJoinParameters.COMMAND_FOLDER, AudioCutAndJoinParameters.COMMAND_FOLDER_MANDATORY);
           trace.debug(this.getClass().getSimpleName() + " parameter " + AudioCutAndJoinParameters.COMMAND_FOLDER + "=" + cmdFolder);

           Map markInIdRelativeMap=JsonEntityManager.getInstance().deserializeMap(markInRelative);
           Map parametersMap=JsonEntityManager.getInstance().deserializeMap(parameters);
           List <string> InputUri= JsonEntityManager.getInstance().deserializeList(inputUri);

           InputStream transcodeOutput = Services.getInstance().runAudioCutAndJoin(parametersMap,markInIdRelativeMap,InputUri,parametersString,cmdFolder);
           inputStreamChannel = new InputStreamChannel(transcodeOutput);

           ReadableRepresentation result = new ReadableRepresentation(inputStreamChannel, MediaType.AUDIO_ALL);

           Disposition disp = new Disposition(Disposition.TYPE_ATTACHMENT);

           disp.setFilename("test-cut.wav");
           result.setDisposition(disp);

           return result;
    </string>

    I’m using the process.getInputStream() as return of my runAudioCutAndJoin but no download happens until the process of conversion/concatenation is done. Can somebody please help me out ?