
Recherche avancée
Autres articles (60)
-
Pas question de marché, de cloud etc...
10 avril 2011Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
sur le web 2.0 et dans les entreprises qui en vivent.
Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...) -
Activation de l’inscription des visiteurs
12 avril 2011, parIl est également possible d’activer l’inscription des visiteurs ce qui permettra à tout un chacun d’ouvrir soit même un compte sur le canal en question dans le cadre de projets ouverts par exemple.
Pour ce faire, il suffit d’aller dans l’espace de configuration du site en choisissant le sous menus "Gestion des utilisateurs". Le premier formulaire visible correspond à cette fonctionnalité.
Par défaut, MediaSPIP a créé lors de son initialisation un élément de menu dans le menu du haut de la page menant (...) -
(Dés)Activation de fonctionnalités (plugins)
18 février 2011, parPour gérer l’ajout et la suppression de fonctionnalités supplémentaires (ou plugins), MediaSPIP utilise à partir de la version 0.2 SVP.
SVP permet l’activation facile de plugins depuis l’espace de configuration de MediaSPIP.
Pour y accéder, il suffit de se rendre dans l’espace de configuration puis de se rendre sur la page "Gestion des plugins".
MediaSPIP est fourni par défaut avec l’ensemble des plugins dits "compatibles", ils ont été testés et intégrés afin de fonctionner parfaitement avec chaque (...)
Sur d’autres sites (11689)
-
avcodec/sanm : codec37 : reimplement comp4
11 mars, par Manuel Laussavcodec/sanm : codec37 : reimplement comp4
Compression 4 code 0 means copy from delta buffer without mv,
AND start of a skip run. This gets rid of the extra case and column
index manipulation and implements this as it is implemented in the
original game exe, i.e. as a special case for after mv copy.Signed-off-by : Manuel Lauss <manuel.lauss@gmail.com>
-
How do i gain access to subproccess.py ?
15 décembre 2023, par Kronik71So, my bot for some reason wants to access a folder in
\WindowsApps\PythonSoftwareFoundation.Python.bunch_of_numbers\Lib
calledsubproccess.py
but it always gives the error :PermissionError: [WinError 5] Access is denied
. I think it has to do with ffmpeg.

Here's the full traceback (kinda long) :


Traceback (most recent call last):
 File "C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.bunch_of_numbers\LocalCache\local-packages\Python310\site-packages\interactions\client\client.py", line 1900, in __dispatch_interaction
 response = await callback
 File "C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.bunch_of_numbers\LocalCache\local-packages\Python310\site-packages\interactions\client\client.py", line 1771, in _run_slash_command
 return await command(ctx, **ctx.kwargs)
 File "C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.bunch_of_numbers\LocalCache\local-packages\Python310\site-packages\interactions\models\internal\command.py", line 132, in __call__
 await self.call_callback(self.callback, context)
 File "C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.bunch_of_numbers\LocalCache\local-packages\Python310\site-packages\interactions\models\internal\application_commands.py", line 802, in call_callback
 return await self.call_with_binding(callback, ctx)
 File "C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.bunch_of_numbers\LocalCache\local-packages\Python310\site-packages\interactions\models\internal\callback.py", line 43, in call_with_binding
 return await callback(*args, **kwargs)
 File "C:\Users\myuser\OneDrive\Desktop\button.py", line 38, in press
 voice_client.play(discord.FFmpegPCMAudio(executable=r"C:\Users\myuser\OneDrive\Desktop\ffmpeg-6.1-essentials_build\bin", source=audiosource))
 File "C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.Bunch_of_numbers\LocalCache\local-packages\Python310\site-packages\discord\player.py", line 290, in __init__
 super().__init__(source, executable=executable, args=args, **subprocess_kwargs)
 File "C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.bunch_of_numbers\LocalCache\local-packages\Python310\site-packages\discord\player.py", line 166, in __init__
 self._process = self._spawn_process(args, **kwargs)
 File "C:\Users\myuser\AppData\Local\Packages\PythonSoftwareFoundation.Python.bunch_of_numbers\LocalCache\local-packages\Python310\site-packages\discord\player.py", line 180, in _spawn_process
 process = subprocess.Popen(args, creationflags=CREATE_NO_WINDOW, **subprocess_kwargs)
 File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.bunch_of_numbers\lib\subprocess.py", line 971, in __init__
 self._execute_child(args, executable, preexec_fn, close_fds,
 File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.bunch_of_numbers\lib\subprocess.py", line 1456, in _execute_child
 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
PermissionError: [WinError 5] Access is denied



heres my code :


import interactions
import discord
from discord import FFmpegPCMAudio
import tracemalloc

ffmpegexec = r"C:\Users\myuser\OneDrive\Desktop\ffmpeg-6.1-essentials_build\bin\ffmpeg.exe"

audiosource = r"C:\Users\myuser\Downloads\seatbelt-online-audio-converter.mp3"

source = discord.FFmpegPCMAudio(audiosource)

token = "my_token"

bot = interactions.Client(token=token)

tracemalloc.start()

@interactions.slash_command(
 name="joinvc",
 description="starts the game"
)

async def joinvc(ctx: interactions.ComponentContext):
 await ctx.send("Joining vc. Please make sure you are currently in a vc!")
 vc = ctx.author.voice.channel
 await vc.connect()

@interactions.slash_command(
 name="press",
 description="Press the button"
)

async def press(ctx: interactions.ComponentContext):
 await ctx.send(f"{ctx.author.mention} has pressed the button")
 vc = ctx.author.voice.channel
 voice_client = await vc.connect() # Connect to the voice channel

voice_client.play(discord.FFmpegPCMAudio(executable=r"C:\Users\myuser\OneDrive\Desktop\ffmpeg-6.1-essentials_build\bin", source=audiosource))


bot.start(token)



All of my code is above. I'm not exactly good at writing python, might just be something I'm misunderstanding. I just want it to play a noise in a discord voice chat when the /press command is used.


-
Segmentation fault caused by FFMPEG / SFML on Macos
12 avril 2024, par Med ali Damergi ReTr0I'm trying to code a basic video player function to use it in a game it's supposed to get a sfml window and a video link as inputs and run the video :


extern "C" {
#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libswscale></libswscale>swscale.h>
#include <libavutil></libavutil>imgutils.h>
}

#include <sfml></sfml>Graphics.hpp>
#include <iostream>

const AVCodec* pCodec = nullptr;


void lecteurVideo(const std::string& videoPath, sf::RenderWindow& window) {
 // Open the video file
 AVFormatContext* pFormatCtx = avformat_alloc_context();
 if (avformat_open_input(&pFormatCtx, videoPath.c_str(), nullptr, nullptr) != 0) {
 std::cerr << "Failed to open video file" << std::endl;
 return;
 }

 // Retrieve stream information
 if (avformat_find_stream_info(pFormatCtx, nullptr) < 0) {
 std::cerr << "Failed to retrieve stream information" << std::endl;
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Find the first video stream
 int videoStreamIndex = -1;
 for (unsigned int i = 0; i < pFormatCtx->nb_streams; i++) {
 if (pFormatCtx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
 videoStreamIndex = i;
 break;
 }
 }
 if (videoStreamIndex == -1) {
 std::cerr << "Failed to find video stream" << std::endl;
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Get the codec parameters for the video stream
 AVCodecParameters* pCodecParams = pFormatCtx->streams[videoStreamIndex]->codecpar;

 // Find the decoder for the video stream
 const AVCodec* pCodec = avcodec_find_decoder(pCodecParams->codec_id);
 if (pCodec == nullptr) {
 std::cerr << "Failed to find video decoder" << std::endl;
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Allocate a codec context for the decoder
 AVCodecContext* pCodecCtx = avcodec_alloc_context3(pCodec);
 if (pCodecCtx == nullptr) {
 std::cerr << "Failed to allocate codec context" << std::endl;
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Initialize the codec context with the codec parameters
 if (avcodec_parameters_to_context(pCodecCtx, pCodecParams) < 0) {
 std::cerr << "Failed to initialize codec context" << std::endl;
 avcodec_free_context(&pCodecCtx);
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Open the codec
 if (avcodec_open2(pCodecCtx, pCodec, nullptr) < 0) {
 std::cerr << "Failed to open codec" << std::endl;
 avcodec_free_context(&pCodecCtx);
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Create a frame to hold the decoded video data
 AVFrame* pFrame = av_frame_alloc();
 if (pFrame == nullptr) {
 std::cerr << "Failed to allocate frame" << std::endl;
 avcodec_close(pCodecCtx);
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Create a packet for reading compressed video data
 AVPacket* pPacket = av_packet_alloc();
 if (pPacket == nullptr) {
 std::cerr << "Failed to allocate packet" << std::endl;
 av_frame_free(&pFrame);
 avcodec_close(pCodecCtx);
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Create a software scaler context for converting the video frame format
 SwsContext* pSwsCtx = sws_getContext(pCodecCtx->width, pCodecCtx->height, pCodecCtx->pix_fmt,
 pCodecCtx->width, pCodecCtx->height, AV_PIX_FMT_RGB24,
 SWS_BILINEAR, nullptr, nullptr, nullptr);
 if (pSwsCtx == nullptr) {
 std::cerr << "Failed to create software scaler context" << std::endl;
 av_packet_free(&pPacket);
 av_frame_free(&pFrame);
 avcodec_close(pCodecCtx);
 avformat_close_input(&pFormatCtx);
 return;
 }

 // Create an SFML texture and sprite for displaying the video frames
 sf::Texture texture;
 sf::Sprite sprite;

 // Read frames from the video file and display them in the SFML window
 while (av_read_frame(pFormatCtx, pPacket) >= 0) {
 if (pPacket->stream_index == videoStreamIndex) {
 // Decode the video packet into a frame
 if (avcodec_send_packet(pCodecCtx, pPacket) < 0) {
 std::cerr << "Failed to send packet to decoder" << std::endl;
 break;
 }
 if (avcodec_receive_frame(pCodecCtx, pFrame) < 0) {
 std::cerr << "Failed to receive frame from decoder" << std::endl;
 break;
 }

 // Convert the frame format to RGB24
 uint8_t* rgbBuffer = new uint8_t[pCodecCtx->width * pCodecCtx->height * 3];
 uint8_t* rgbPlanes[1] = { rgbBuffer };
 int rgbStrides[1] = { pCodecCtx->width * 3 };
 sws_scale(pSwsCtx, pFrame->data, pFrame->linesize, 0, pCodecCtx->height,
 rgbPlanes, rgbStrides);

 // Update the SFML texture with the RGB24 data
 texture.create(pCodecCtx->width, pCodecCtx->height);
 texture.update(rgbBuffer);

 // Display the texture in the SFML window
 sprite.setTexture(texture);
 window.clear();
 window.draw(sprite);
 window.display();

 delete[] rgbBuffer;
 }

 av_packet_unref(pPacket);
 }

 // Clean up resources
 av_packet_free(&pPacket);
 av_frame_free(&pFrame);
 avcodec_close(pCodecCtx);
 avformat_close_input(&pFormatCtx);
 sws_freeContext(pSwsCtx);
}

int main() {
 sf::RenderWindow window(sf::VideoMode(800, 600), "Lecteur Video SFML");
 lecteurVideo("/Users/mac/cours/spaceRevolution/Videos/58e62585-c143-483a-9149-b401ebc01d02.mp4", window);
 return 0;
}
</iostream>


It works on my other computer running on ubuntu but not on my main laptop on macOS : It dosent open any window and instantly cause a segmentation fault.


I've tried tu run valgrind on it but valgrind dosent run well on macOS.


Could anybody help me with this ?