
Recherche avancée
Autres articles (102)
-
Gestion de la ferme
2 mars 2010, parLa ferme est gérée dans son ensemble par des "super admins".
Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
Dans un premier temps il utilise le plugin "Gestion de mutualisation" -
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Contribute to a better visual interface
13 avril 2011MediaSPIP 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 (10566)
-
FFmpeg get buffer from stream
4 janvier 2020, par nonoomI have an express route, the user gives me a youtube url, with ytdl-core, i get the stream,
and finally pass it to fluent-ffmpeg, and I need to get a buffer from the ffmpeg stream to finally send the picture to another api (i don’t save it)
My code looks like :router.get("/youtubegifupload", (req,res)=>{ //get video youtube + informations --> create gif --> upload aws s3
try{
stream = ytdl("https://www.youtube.com/watch?v=xYQfk5275NA"); //i took random url for test purposes
}catch(error){
res.status(500).json({success : false, message: "Error while getting youtube video ! "})
}
buffer= []
modifiedstream = ffmpeg(stream)
.fps(30)
.setStartTime(10)
.duration(20)
.noAudio()
.videoCodec('gif')
.format('gif')
.save('./jpp3.gif')
.on('progress', (prog)=>{
console.log(prog);
})
.on('data',(buffer)=>{
})
.on('error', ((error)=>{
res.status(500).json({success : false, message: "Error while modifying youtube video ! "})
}))
.on('end', ()=>{
console.log("send to imgur")
//request imgur - pass buffer as image
})
});Everything worked well with save(path) at the end of the ffmpeg operations, but it was for test purposes (actually i don’t want to save),
Now, my goal is to get a buffer, so i tried to add .on(’data’, .. add the buffer to the array, and concat.
But here is my problem :
Without save(), it do not even launch progress(), ffmpeg is printing nothing, no end, ...How to make it work without save() ? How to get this stream and concat into a buffer ?
*I tried : *
-Verified imports, added const ffmpegPath = require(’@ffmpeg-installer/ffmpeg’).path ;
-https://github.com/fluent-ffmpeg/node-fluent-ffmpeg/issues/747 - added videoCodec
Thanks for your help
-
Transcription via OpenAi's whisper : AssertionError : incorrect audio shape
1er avril 2024, par muratowskiI'm trying to use OpenAI's open source Whisper library to transcribe audio files.


Here is my script's source code :


import whisper

model = whisper.load_model("large-v2")

# load the entire audio file
audio = whisper.load_audio("/content/file.mp3")
#When i write that code snippet here ==> audio = whisper.pad_or_trim(audio) the first 30 secs are converted and without any problem they are converted.

# make log-Mel spectrogram and move to the same device as the model
mel = whisper.log_mel_spectrogram(audio).to(model.device)

# detect the spoken language
_, probs = model.detect_language(mel)
print(f"Detected language: {max(probs, key=probs.get)}")

# decode the audio
options = whisper.DecodingOptions(fp16=False)
result = whisper.decode(model, mel, options)

# print the recognized text if available
try:
 if hasattr(result, "text"):
 print(result.text)
except Exception as e:
 print(f"Error while printing transcription: {e}")

# write the recognized text to a file
try:
 with open("output_of_file.txt", "w") as f:
 f.write(result.text)
 print("Transcription saved to file.")
except Exception as e:
 print(f"Error while saving transcription: {e}")



In here :


# load the entire audio file
audio = whisper.load_audio("/content/file.mp3")



when I write below : " audio = whisper.pad_or_trim(audio) ", the first 30 secs of the sound file is transcribed without any problem and language detection works as well,


but when I delete it and want the whole file to be transcribed, I get the following error :




AssertionError : incorrect audio shape




What should I do ? Should I change the structure of the sound file ? If yes, which library should I use and what type of script should I write ?


-
FFMPEG Multiple outputs from BlackMagic input
24 septembre 2018, par leo_dragonsI’m currently needing help to achieve multiple outputs from one input.
Right now, the outputs are set like this :ffmpeg -re -f decklink -i "DeckLink Mini Recorder" -y -pix_fmt yuv420p -c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 128k -ar 44100 -async 1 -b:v 2300k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 1280x720 -bufsize 1000k -maxrate 3072k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_720p"
ffmpeg -re -i "rtmp://10.0.0.172:1935/Testing/live_720p" -c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 900k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 854x480 -bufsize 400k -maxrate 1000k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_480p_hq"
ffmpeg -re -i "rtmp://10.0.0.172:1935/Testing/live_720p" -c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 550k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 854x480 -bufsize 400k -maxrate 500k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_480p_lq"
ffmpeg -re -i "rtmp://10.0.0.172:1935/Testing/live_720p" -c:v h264 -preset fast -tune zerolatency -c:a aac -ac 2 -b:a 114k -ar 44100 -async 1 -b:v 450k -g 5 -probesize 32 -framerate 30 -movflags +faststart -s 640x360 -bufsize 400k -maxrate 500k -shortest -f flv "rtmp://10.0.0.172:1935/Testing/live_360p"This uses quite a lot of processing power, and also generates unnecessary latency (since I have to stream to WOWZA first, then back to FFMPEG and then back to WOWZA).
And I want to optimize this.
I’ve been trying several methods, but I only managed to overflow the decklink buffer. How could I solve this ?