
Recherche avancée
Médias (1)
-
MediaSPIP Simple : futur thème graphique par défaut ?
26 septembre 2013, par
Mis à jour : Octobre 2013
Langue : français
Type : Video
Autres articles (21)
-
Les formats acceptés
28 janvier 2010, parLes commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
ffmpeg -codecs ffmpeg -formats
Les format videos acceptés en entrée
Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
Les formats vidéos de sortie possibles
Dans un premier temps on (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Publier sur MédiaSpip
13 juin 2013Puis-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
Sur d’autres sites (2986)
-
"Cannot read property 'url' of undefined" even though it's already defined
28 novembre 2020, par Levi StanczI'm making a Discord music Bot and I'm having trouble with an error saying


TypeError: Cannot read property 'url' of undefined



I tried console logging it and it showed me the
url
, so I don't understand what is the problem with my code.

Here's my code :


//musicBOT
const Discord = require('discord.js');
const client = new Discord.Client();
const ytdl = require('ytdl-core');
const mcPrefix = '.';

const queue = new Map();

client.on('ready', () => console.log('Music bot ready!'));

client.on('message', async message => {
 if(message.author.bot) return;
 if(!message.content.startsWith(mcPrefix)) return;

 const args = message.content.substring(mcPrefix.length).split(" ");
 const serverQueue = queue.get(message.guild.id);

 if(message.content.startsWith(`${mcPrefix}play`)) {

 const voiceChannel = message.member.voice.channel;
 if(!voiceChannel) return message.channel.send("Hang-szobában kell lenned zenelejátszáshoz.");
 const permissions = voiceChannel.permissionsFor(message.client.user);
 if(!permissions.has('CONNECT')) return message.channel.send("Nincs jogosultságom csatlakozni a hangszobához.");
 if(!permissions.has('SPEAK')) return message.channel.send("Nincs jogosultságom megszólalni ebben a hangszobában.");

 const songInfo = await ytdl.getInfo(args[1])
 const song = {
 title: songInfo.title,
 url: songInfo.videoDetails.video_url
 }

 if(!serverQueue) {
 const queueConstruct = {
 textChannel: message.channel,
 voiceChannel: voiceChannel,
 connection: null,
 songs: [],
 volume: 5,
 playing: true
 }
 queue.set(message.guild.id, queueConstruct)

 queueConstruct.songs.push(song)

 try{
 var connection = await voiceChannel.join();
 message.channel.send(`${song.title} lejátszása.`)
 queueConstruct.connection = connection
 play(message.guild, queueConstruct.songs[0])
 }catch(e){
 console.log(`Hiba csatlakozás közben itt: ${e}`);
 queue.delete(message.guild.id)
 return message.channel.send(`Hiba volt a csatlakozás közben itt: ${e}`)
 }
 } else{
 serverQueue.songs.push(song)
 return message.channel.send(`**${song.title}** hozzáadva a lejátszási listához.`)
 }
 return undefined
 

 
 }else if (message.content.startsWith(`${mcPrefix}stop`)) {
 if(!message.member.voice.channel) return message.channel.send("Hang-szobában kell lenned ahhoz, hogy leállítsd a zenét.")
 if(!serverQueue) return message.channel.send("There is nothing playing")
 serverQueue.songs= []
 serverQueue.connection.dispatcher.end()
 message.channel.send("Sikeresen megálltottad a zenét.")
 return undefined
 }else if(message.content.startsWith(`${mcPrefix}skip`)){
 if(!message.member.voice.channel) return message.channel.send("Hang-szobában kell lenned a skip parancshoz.")
 if(!serverQueue) return message.channel.send("There is nothing playing")
 serverQueue.connection.dispatcher.end()
 message.channel.send("Zene továbbléptetve.")
 message.channel.send(`${song.title} játszása.`)
 
 return undefined
 }

 function play(guild, song) {
 const serverQueue = queue.get(guild.id)
 
 if(!serverQueue.songs){
 serverQueue.voiceChannel.leave()
 queue.delete(guild.id)
 return
 }
 
 const dispatcher = serverQueue.connection.play(ytdl(song.url))
 .on('finish', () => {
 serverQueue.songs.shift()
 play(guild, serverQueue.songs[0])
 })
 .on('error', error => {
 console.log(error)
 })
 dispatcher.setVolumeLogarithmic(serverQueue.volume / 5)
 }

})
//musicBOT



and here is the full error :


const dispatcher = serverQueue.connection.play(ytdl(songInfo.url))
 ^
TypeError: Cannot read property 'url' of undefined
 at play (C:\Users\Levi\Desktop\Discord BOT Javascript\bot.js:97:70)
 at StreamDispatcher.<anonymous> (C:\Users\Levi\Desktop\Discord BOT Javascript\bot.js:100:17)
 at StreamDispatcher.emit (node:events:388:22)
 at finish (node:internal/streams/writable:734:10)
 at processTicksAndRejections (node:internal/process/task_queues:80:21)
</anonymous>


I started searching on the internet but found nothing about it, I guess my basic javascript knowledge is just not enough.


-
Why does my nginx endpoint streaming audio via ffmpeg fail with "An unexpected TLS packet was received"
6 décembre 2020, par rajaman0I'm using nginx to proxy requests to a flask/gunicorn API. For most of my endpoints, it works perfectly - however, I have one endpoint which serves an audio response (through ffmpeg) which doesn't seem to work no matter what I try. Running everything through docker.


Here's my nginx config :


server {
 listen $PORT;
 root /usr/share/nginx/html;
 index index.html index.html;

 access_log /var/log/nginx/reverse-access.log;
 error_log /var/log/nginx/reverse-error.log;

 location / {
 try_files $uri /index.html =404;
 }

 location /api/stream_audio_file {
 proxy_pass http://backend;
 proxy_http_version 1.1;
 proxy_set_header Connection "keep-alive";
 proxy_set_header Host $host;

 proxy_set_header X-Real-IP $remote_addr;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Host $server_name;
 }



Here's the core of the python code for http://backend/api/stream_audio_file (run through flask, gunicorn)


ffmpeg_options = ['-i', 'https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3']
ffmpeg_options += ["-f", "mp3"]
ffmpeg_options += ["-to", '00:00:02.000']
ffmpeg_options += ["-vn"]
ffmpeg_options += ["-ab", "256k"]
ffmpeg_options += ["-strict", "-2"]
ffmpeg_options += ["-loglevel", "trace"]
p = Popen(["ffmpeg"] + ffmpeg_options + ["-"],
 stdout=PIPE)
max_bytes = 256000
output = p.stdout.read(max_bytes)
return Response(output, headers={
 "Content-Type": "audio/mp3",
 "icy-name": yt_info['title'].encode('latin-1', 'ignore'),
 "icy-bitrate": "256",
 "ice-audio-info": "bitrate=256",
 "Cache-Control": "no-cache"
})



When I test out this endpoint, I've pasted the full ffmpeg logs here : https://pastebin.com/wMMpmL6M
Of import, it seems to fetch the mp3 url appropriately but fails with error :


[tls @ 0x555bf3011a80] An unexpected TLS packet was received.
https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3: I/O error
[out_0_0 @ 0x555bf302ab00] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.



I've tried quite a few things :


- 

- This endpoint works without nginx. I tried querying just the endpoint running w/ just gunicorn, and responses are streamed back correctly. Thus the error HAS to be nginx related ?
- The error being TLS related is confusing - I've tried setting up nginx w/ ssl on and adding certs, but that doesn't help / change the error in any way.
- I've tried playing around with headers in both nginx and on the python side, following some of the examples here : https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/. Doesn't work.
Response(stream_with_context(..)
in flask doesn't work either.- Don't know much about nginx, but tried some other suggestions e.g. buffering / no buffering through nginx, etc, nothing seems to work :(.
- When I ssh into my docker container, and run the same ffmpeg command
ffmpeg -i https://www.soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3 -f mp3 -to 00:00:02.000 -vn -ab 256k -strict -2 -loglevel trace
outside of the request context, it works ! - Tried compiling ffmpeg with both openssl and gnutls, neither works. However : the openssl version fails w/

tls @ error:1408F1BB:SSL routines:ssl3_get_record:bad record type
instead.
















Please let me know what other debugging info would be helpful / if anyone has any hypothesis I can test out.


-
FFMPEG, macOS Catalina : "ffmpeg stderr : /private/tmp/com.apple.launchd.ID/org.macosforge.xquartz:0 : Operation not supported on socket"
11 février 2021, par Bogdan SlyusarenkoI'm trying to record selenium test run with FFMPEG, for automation testing of web extensions (selenium+js/ts).
FFMPEG initiated by command :


const { spawn } = require("child_process");
 ffmpeg = spawn("ffmpeg", [
 "-x265-params",
 "-f",
 "xcbgrab", 
 "-video_size",
 "1280x1024", 
 "-i",
 process.env.DISPLAY, // "/private/tmp/com.apple.launchd.ID/org.macosforge.xquartz:0"
 "-loglevel",
 "debug", 
 "-y", 
 "-pix_fmt",
 "yuv420p",
 videoPath, 
 ]);



Return constantly error,related to process.DISPLAY, I'm not sure why it's so :


ffmpeg stderr: /private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0: Operation not supported on socket



Full debug login is :


ffmpeg stderr: ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
ffmpeg stderr: built with Apple clang version 12.0.0 (clang-1200.0.32.28)
ffmpeg stderr: configuration: --prefix=/usr/local/Cellar/ffmpeg/4.3.1_9 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack
ffmpeg stderr: libavutil 56. 51.100 / 56. 51.100
ffmpeg stderr: libavcodec 58. 91.100 / 58. 91.100
ffmpeg stderr: libavformat 58. 45.100 / 58. 45.100
ffmpeg stderr: libavdevice 58. 10.100 / 58. 10.100
ffmpeg stderr: libavfilter 7. 85.100 / 7. 85.100
ffmpeg stderr: libavresample 4. 0. 0 / 4. 0. 0
ffmpeg stderr: libswscale 5. 7.100 / 5. 7.100
ffmpeg stderr: libswresample 3. 7.100 / 3. 7.100
ffmpeg stderr: libpostproc 55. 7.100 / 55. 7.100
ffmpeg stderr: Splitting the commandline.
ffmpeg stderr: Reading option '-x265-params' ...
ffmpeg stderr: matched as AVOption 'x265-params' with argument '-f'.
ffmpeg stderr: Reading option 'xcbgrab' ...
ffmpeg stderr: matched as output url.
ffmpeg stderr: Reading option '-video_size' ...
ffmpeg stderr: matched as AVOption 'video_size' with argument '1280x1024'.
ffmpeg stderr: Reading option '-i' ... matched as input url with argument '/private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0'.
ffmpeg stderr: Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
ffmpeg stderr: Reading option '-y' ...
ffmpeg stderr: matched as option 'y' (overwrite output files) with argument '1'.
ffmpeg stderr: Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
ffmpeg stderr: Reading option '/Volumes/MacHD2/Upprojects/TEST/log/Checkout-Google.com-Search-on-Google.mp4' ... matched as output url.
ffmpeg stderr: Finished splitting the commandline.
ffmpeg stderr: Parsing a group of options: global .
ffmpeg stderr: Applying option loglevel (set logging level) with argument debug.
ffmpeg stderr: Applying option y (overwrite output files) with argument 1.
ffmpeg stderr: Successfully parsed a group of options.
ffmpeg stderr: Parsing a group of options: input url /private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0.
ffmpeg stderr: Successfully parsed a group of options.
ffmpeg stderr: Opening an input file: /private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0.
ffmpeg stderr: [NULL @ 0x7fcf80016800] Opening '/private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0' for reading
ffmpeg stderr: [file @ 0x7fcf7f507a00] Setting default whitelist 'file,crypto,data'
ffmpeg stderr: /private/tmp/com.apple.launchd.W851FkeNXz/org.macosforge.xquartz:0: Operation not supported on socket




Any feedback appreciated