Recherche avancée

Médias (91)

Autres articles (86)

  • Les sons

    15 mai 2013, par
  • Soumettre bugs et patchs

    10 avril 2011

    Un logiciel n’est malheureusement jamais parfait...
    Si vous pensez avoir mis la main sur un bug, reportez le dans notre système de tickets en prenant bien soin de nous remonter certaines informations pertinentes : le type de navigateur et sa version exacte avec lequel vous avez l’anomalie ; une explication la plus précise possible du problème rencontré ; si possibles les étapes pour reproduire le problème ; un lien vers le site / la page en question ;
    Si vous pensez avoir résolu vous même le bug (...)

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

  • demucs.api or demucs.pretrained aren't working

    9 décembre 2023, par user22801597

    I created my environment and installed several packages for CUDA 11.8.0 (including demucs, pytorch, torchaudio, ffmpeg...). I want to separate a track with demucs with a python code in spyder (i don't want to do it on the anaconda prompt) however I've tried several codes and they seem not be working. I get errors like :

    


      

    • AttributeError : module 'demucs' has no attribute 'Separator' (1)
    • 


    • ImportError : cannot import name 'load_pretrained' from 'demucs.pretrained' (2) (C :\Users\User\anaconda3\envs\Pytorch\Lib\site-packages\demucs\pretrained.py)
    • 


    • ModuleNotFoundError : No module named 'demucs.api' (3)
    • 


    • ModuleNotFoundError : No module named 'demucs.model'(4)
    • 


    


    So through the errors I assume my demucs package isn't working correctly but I don't know why. I've done the following (I'Ve found this either in google or in chatgpt) :

    


      

    • Checked Library Versions
    • 


    • Upgraded demucs and other packages
-deinstalled and reinstalled it
Can someone please help me to solve this ? What am I doing worng or why is demucs not working correctly ?
    • 


    


    This are the different codes I tested according to their errors above :

    


    (1)

    


       import demucs
   separator = demucs.Separator()
   model = demucs.load_pretrained('demucs')
   audio_sources = separator.separate('Zweite_Aufnahme_mit_Piano.wav')
   for source_name, source_audio in audio_sources.items():
       source_audio.to_file(source_name + '.wav')



    


    (2)

    


       import torchaudio
   from demucs.pretrained import load_pretrained
   import soundfile as sf
   import os

   input_audio_file = 'Zweite_Aufnahme_mit_Piano.wav'
   output_directory = 'Separated_audios'

   model = load_pretrained('demucs_quantized')

   audio, _ = torchaudio.load(input_audio_file)

   sources = model(audio)

   os.makedirs(output_directory, exist_ok=True)

   for i, source in enumerate(sources):
       source_path = os.path.join(output_directory, f'source_{i}.wav')
       sf.write(source_path, source[0].numpy(), 44100)

   print("Source separation complete. Separated sources saved in the output directory.")



    


    (3)

    


       from pydub import AudioSegment
   import IPython
   import numpy as np
   import demucs.api
   import pathlib
   import torch

   audiosegment = AudioSegment.from_mp3("Zweite_Aufnahme_mit_Piano.wav")
   arr = audiosegment.get_array_of_samples()
   sr = audiosegment.frame_rate
   ch = audiosegment.channels
   aac = np.array(arr, dtype=np.float32).reshape((-1, ch))
   aac = aac[30*sr:40*sr,:]
   IPython.display.Audio(aac[:, 0], rate=sr)

   separator = demucs.api.Separator()
   model = separator.load_model()
   input = torch.from_numpy(aac.reshape((ch, -1)))
   separator.add_track("born", input)
   separated = separator.separate_loaded_audio()
   for (file, stems) in separated:
       for stem, waveform in stems.items():
         print(stem)
         print(waveform.shape)
         aac_again = waveform.numpy().reshape((-1, ch))
         IPython.display.display(IPython.display.Audio(aac_again[:,0], rate=sr))



    


    (4)

    


       import torchaudio
   from demucs.model import load_pretrained

   audio, sample_rate = torchaudio.load('Zweite_Aufnahme_mit_Piano.wav')
   model = load_pretrained('demucs')
   separated_sources = model(audio)
   torchaudio.save('vocals.wav', separated_sources['vocals'], sample_rate)
   torchaudio.save('accompaniment.wav', separated_sources['accompaniment'], sample_rate)
   torchaudio.save('drums.wav', separated_sources['drums'], sample_rate)
   torchaudio.save('bass.wav', separated_sources['bass'], sample_rate)


    


  • FFMPEG 360 mp4 to SBS for Google cardboard

    3 mai 2022, par mike

    I've created some 360 degree mp4 videos froma GoPro max camera.
I would like to display these on Google cardboard (side by side) in the same way as Youtube, whilst modifying the playback speed with FFMPEG.

    


    I haven't found the right flags to convert the image to SBS with v360 or stereo3d

    


    Any suggestions ?

    


  • Use Google Fonts In ffmpeg fontfile

    9 mars 2020, par Randy Thomas

    I am wanting to use Google Fonts in my ffmpeg video creations for text. Here is what I have and it’s not working at all.

    $font = "//fonts.googleapis.com/css?family=Aclonica";

    $cmd .= "drawtext=enable='between(t,".$fi.",".$li.")':fontfile=".$font.":fontsize=".$fontsize.":fontcolor=".$color.":x=(w-text_w)/2:y=(h/2)+".$n.":text='".$arr[$j]."',";

    Of course, this works with .ttf fonts but I really want to use Google Fonts.

    I have also tried $font = "https://fonts.googleapis.com/css?family=Aclonica" that does not work either.

    I have a feeling that ffmpeg does not use woff2 fonts but I have seen a site that does this I just can’t say 100% for sure that they use Google Fonts in the creation, but they do use them in the selection of the font which leads me to believe they use them in the creation of the video.