
Recherche avancée
Autres articles (62)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...) -
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...)
Sur d’autres sites (6311)
-
Trouble with Cross-Origin Headers : Stripe and ffmpeg Integration in Next.js
7 février 2024, par DukeI'm using this excellent template from vercel as a base for my project :


https://vercel.com/templates/next.js/subscription-starter



I've used it for many projects and the Stripe integration works flawlessly. However for a new project I needed to incorporate ffmpeg which relies on SharedArrayBuffer :


https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer



So I need to set the appropriate HTTP response header which i've set in my next.config.js file as below :


{
 source: '/(.*)',
 headers: [
 {
 key: 'Cross-Origin-Embedder-Policy',
 value: 'credentialless'
 // value: 'require-corp'
 },
 {
 key: 'Cross-Origin-Opener-Policy',
 value: 'same-origin-allow-popups'
 }
 ]
 }



Now the issue is that settings these breaks Stripe. It blocks the request :


https://js.stripe.com/v3/m-outer-3437aaddcdf6922d623e172c2d6f9278.html



Which appearently loads more resources that are needed for the checkout session to function. The customer portal works but checkout doesn't. I've literally tired every possible permutation of headers with different values but in all cases either Stripe works but ffmepg doesn't (cause SharedArrayBuffer doesn't work) or vice versa. It's been a week and I've tired everything and can't find anything online that works. Not even ChatGPT can help which ironcelly asks me to contact Stripe customer support. I would highly appreciate if anyone could even point me in the right direction. I Thank you in advance good Sir/Maam.


Note that Checkout works fine with just :


key: 'Cross-Origin-Opener-Policy',
value: 'same-origin'



Just
Cross-Origin-Embedder-Policy
breaks it

-
demucs.api or demucs.pretrained aren't working
9 décembre 2023, par user22801597I 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)



-
h265_videotoolbox for Apple Chips Not working with ffmpeg
22 janvier 2024, par Martin JulienI have a 16-inch Macbook Pro.
System :
Model Name : MacBook Pro
Chip : Apple M1 Max
Total Number of Cores : 10 (8 performance and 2 efficiency)
Memory : 64 GB


You can take advantage of apple chips to encode faster by replacing the usual line :

-c:v libx265
by-c:v h265_videotoolbox
.

Here's an example.
Since h265 doesn't work at the moment, here's a line that works just fine :


for i in *.mp4; do ffmpeg -i "$i" -c:v h264_videotoolbox -b:v 2000k -c:a aac -b:a 192k -s 1920x1080 -threads 8 "${i%.*}_1.mp4"; done


The version of ffmpeg installed on my mac is the latest : 6.1.1


My problem :
I want to encode in h265. My command line is :

for i in *.mp4; do ffmpeg -i "$i" -c:v h265_videotoolbox -b:v 2000k -c:a aac -b:a 192k -s 1920x1080 -threads 8 "${i%.*}_1.mp4"; done


Everything should work in theory. But I get this from the Shell :


[vost#0:0 @ 0x150f06fd0] Unknown encoder 'h265_videotoolbox' [vost#0:0 @ 0x150f06fd0] Error selecting an encoder Error opening output file Denis_1.mp4. Error opening output files: Encoder not found


My attempts :


I spent a lot of time with ChatGPT to solve the problem, but nothing worked. So I'm asking the question here to see if anyone has had the same problem as me and if there's a solution to fix it.


Thank you for your help,


best regards,
Martin