
Recherche avancée
Autres articles (50)
-
Demande de création d’un canal
12 mars 2010, parEn 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 à (...) -
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Déploiements possibles
31 janvier 2010, parDeux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
Version mono serveur
La version mono serveur consiste à n’utiliser qu’une (...)
Sur d’autres sites (5845)
-
Cannot use pydub.AudioSegment on audio files downloaded by youtube-dl library
26 octobre 2018, par Han MAfter I download a audio clip from a youtube link by the youtube-dl library, I cannot use pydub.AudioSegment to slice the audio file. The following is the information about my code.
import youtube_dl
options = {
'format': 'bestaudio/best',
'extractaudio': True, # only keep the audio
'audio-format': "wav", # convert to wav
'outtmpl': whole_path, # name the file the ID of the video
'noplaylist': True, # only download single song, not playlist
'audioquality': 1
}
with youtube_dl.YoutubeDL(options) as ydl:
print('url is:', web_url)
ydl.download([web_url])
from pydub import AudioSegment
audio_data = AudioSegment.from_wav(path_to_downloaded_file)Then, I got an error as follows first on Mac and second on Linux :
b'avconv version 12.3, Copyright (c) 2000-2018 the Libav developers\n built on Jul 26 2018 18:08:50 with Apple LLVM version 9.1.0 (clang-902.0.39.2)\n/Users/***/random17560390.wav: Invalid data found when processing input\n'
b'ffmpeg version 2.8.15-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers\n built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609\n configuration: --prefix=/usr --e
xtra-version=0ubuntu0.16.04.1 --build-suffix=-ffmpeg --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --cc=cc --cxx=g++ --enable-gpl --enable-
shared --disable-stripping --disable-decoder=libopenjpeg --disable-decoder=libschroedinger --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-li
bbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmod
plug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libsnappy --enable-libsoxr --enable-li
bspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxvid --enable-libzvbi --e
nable-openal --enable-opengl --enable-x11grab --enable-libdc1394 --enable-libiec61883 --enable-libzmq --enable-frei0r --enable-libx264 --enable-libopencv\n libavutil 54. 31.100 / 54.
31.100\n libavcodec 56. 60.100 / 56. 60.100\n libavformat 56. 40.101 / 56. 40.101\n libavdevice 56. 4.100 / 56. 4.100\n libavfilter 5. 40.101 / 5. 40.101\n libavresa
mple 2. 1. 0 / 2. 1. 0\n libswscale 3. 1.101 / 3. 1.101\n libswresample 1. 2.101 / 1. 2.101\n libpostproc 53. 3.100 / 53. 3.100\n[wav @ 0x20854c0] invalid start
code [0][0][0][28] in RIFF header\n/home/users/test_download/random10485395.wav: Invalid data found when processing input\n'I think the problem might be about the encoding on the downloaded files by youtube-dl. I can use pydub.AudioSegment on other normal .wav files. After checking the details of the downloaded file by youtube-dl, I found the following feature :
Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
It is different from other normal .wav files, which have the following :
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 44100 Hz, 2 channels, s16, 1411 kb/s
-
varying RTP stream result from custom SIP implementation
1er février, par Nik HendricksI am in the process of creating my own SIP implementation in Node.js. As well as a b2bua as a learning project.


Finding people wise in the ways of SIP has proved to be difficult elsewhere but here I have had good results


this is the GitHub of my library so far node.js-sip


this is the GitHub of my PBX so far FlowPBX


Currently, everything is working as I expect. Although I really have some questions on possible errors in my implementation.


My main issue is with RTP streams. Currently I am utilizing ffmpeg.


my function goes as follows


start_stream(call_id, sdp){
 console.log('Starting Stream')
 let port = sdp.match(/m=audio (\d+) RTP/)[1];
 let ip = sdp.match(/c=IN IP4 (\d+\.\d+\.\d+\.\d+)/)[1];
 let codec_ids = sdp.match(/m=audio \d+ RTP\/AVP (.+)/)[1].split(' ');
 let ffmpeg_codec_map = {
 'opus': 'libopus',
 'PCMU': 'pcm_mulaw',
 'PCMA': 'pcm_alaw',
 'telephone-event': 'pcm_mulaw',
 'speex': 'speex',
 'G722': 'g722',
 'G729': 'g729',
 'GSM': 'gsm',
 'AMR': 'amr',
 'AMR-WB': 'amr_wb',
 'iLBC': 'ilbc',
 'iSAC': 'isac',
 }

 let codecs = [];
 sdp.split('\n').forEach(line => {
 if(line.includes('a=rtpmap')){
 let codec = line.match(/a=rtpmap:(\d+) (.+)/)[2];
 let c_id = line.match(/a=rtpmap:(\d+) (.+)/)[1];
 codecs.push({ 
 name: codec.split('/')[0],
 rate: codec.split('/')[1],
 channels: codec.split('/')[2] !== undefined ? codec.split('/')[2] : 1,
 id: c_id
 })
 }
 })

 console.log('codecs')
 console.log(codecs)

 let selected_codec = codecs[0]
 if(selected_codec.name == 'telephone-event'){
 selected_codec = codecs[1]
 console.log(selected_codec)
 }

 //see if opus is available
 codecs.forEach(codec => {
 if(codec.name == 'opus'){
 selected_codec = codec;
 }
 })

 if(selected_codec.name != 'opus'){
 //check if g729 is available
 codecs.forEach(codec => {
 if(codec.name == 'G729'){
 selected_codec = codec;
 }
 })
 }

 console.log('selected_codec')
 console.log(selected_codec)

 let spawn = require('child_process').spawn;
 let ffmpegArgs = [
 '-re',
 '-i', 'song.mp3',
 '-acodec', ffmpeg_codec_map[selected_codec.name],
 '-ar', selected_codec.rate,
 '-ac', selected_codec.channels,
 '-payload_type', selected_codec.id,
 '-f', 'rtp', `rtp://${ip}:${port}`
 ];

 let ffmpeg = spawn('ffmpeg', ffmpegArgs);

 ffmpeg.stdout.on('data', (data) => {
 console.log(`stdout: ${data}`);
 });
 ffmpeg.stderr.on('data', (data) => {
 console.error(`stderr: ${data}`);
 });




}



When using zoiper to test it works great. I have seen the mobile version negotiate speex
and the desktop version negotiate opus mostly for the codec.


today I tried to register a grandstream phone to my pbx and the rtp stream is blank audio.
opus is available and I have tried to prefer that in my stream but still even when selecting that I cannot get audio to the grandstream phone. This is the same case for a yealink phone. I can only get zoiper to work so far.


what could be causing this behavior ? there is a clear path of communication between everything just like the zoiper client's I have used.


Additionally in my sip implementation,
how important is the concept of a dialog ? currently, I just match messages by
Call-ID


and then choose what to send based on the method or response. is there any other underlying dialog functionality that I may need to implement ?


It would just be awesome to get someone who really knows what they are talking about eyes on some of my code to direct this large codebase in the right direction but I realize that a big ask lol.


-
How To Make A Music Command Discord.py
14 juin 2021, par Coder999I'm trying to make a music bot, but it just doesn't seem to work. Here's what I have so far.


import asyncio
import functools
import itertools
import math
import random
from keep_alive import keep_alive
import discord
import nacl
import youtube_dl
from async_timeout import timeout
from discord.ext import commands
import os

bot = commands.Bot(command_prefix='+')

@bot.event
async def on_ready():
 print('Logged in as:\n{0.user.name}\n{0.user.id}'.format(bot))

youtube_dl.utils.bug_reports_message = lambda: ''

ytdl_format_options = {
 'format': 'bestaudio/best',
 'restrictfilenames': True,
 'noplaylist': True,
 'nocheckcertificate': True,
 'ignoreerrors': False,
 'logtostderr': False,
 'quiet': True,
 'no_warnings': True,
 'default_search': 'auto',
 'source_address': '0.0.0.0' # bind to ipv4 since ipv6 addresses cause issues sometimes
}

ffmpeg_options = {
 'options': '-vn'
}

ytdl = youtube_dl.YoutubeDL(ytdl_format_options)

class YTDLSource(discord.PCMVolumeTransformer):
 def __init__(self, source, *, data, volume=0.5):
 super().__init__(source, volume)
 self.data = data
 self.title = data.get('title')
 self.url = ""

 @classmethod
 async def from_url(cls, url, *, loop=None, stream=False):
 loop = loop or asyncio.get_event_loop()
 data = await loop.run_in_executor(None, lambda: ytdl.extract_info(url, download=not stream))
 if 'entries' in data:
 # take first item from a playlist
 data = data['entries'][0]
 filename = data['title'] if stream else ytdl.prepare_filename(data)
 return filename

@bot.command(name='join', help='Tells the bot to join the voice channel')
async def join(ctx):
 if not ctx.message.author.voice:
 await ctx.send("{} is not connected to a voice channel".format(ctx.message.author.name))
 return
 else:
 channel = ctx.message.author.voice.channel
 await channel.connect()
 await ctx.send(f'Joined channel `{channel}`')

@bot.command(name='leave', help='To make the bot leave the voice channel')
async def leave(ctx):
 voice_client = ctx.message.guild.voice_client
 if voice_client.is_connected():
 channel = ctx.message.author.voice.channel
 await voice_client.disconnect()
 await ctx.send(f'Left channel `{channel}`')
 else:
 await ctx.send("The bot is not connected to a voice channel.")

@bot.command(name='play', help='To play song')
async def play(ctx,url):
 try :
 server = ctx.message.guild
 voice_channel = server.voice_client

 async with ctx.typing():
 filename = await YTDLSource.from_url(url, loop=bot.loop)
 voice_channel.play(discord.FFmpegPCMAudio(executable="ffmpeg.exe", source=filename))
 await ctx.send('**Now playing:** {}'.format(filename))
 except:
 await ctx.send("The bot is not connected to a voice channel.")



I have installed PyNaCl and all that stuff and my leave and join commands are working but my play command isnt. It says that it's not connected to a channel but it clearly is.