
Recherche avancée
Médias (1)
-
The Slip - Artworks
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
Autres articles (85)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
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 (5798)
-
Getting error "DLL load failed while importing rect : %1 is not a valid Win32 application" while importing package
17 août 2020, par Sagar DonadkarI am using cython package to call Cpp API and in my cpp code i am using ffmpeg library and able to build my code successfully using bellow command


python setup.py build_ext --inplace --compiler=msvc



but when i try to import generated pyd file then i get error


PS D:\SiVUE\Backend\Cython\demo> python
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import rect
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
ImportError: DLL load failed while importing rect: %1 is not a valid Win32 application.
>>> 
</module></stdin>


My entire code is provided bellow


header file
#ifndef RECTANGLE_H
#define RECTANGLE_H
#include <iostream>

extern "C"
{
 #include "libavformat/avformat.h"
 #include "libavutil/dict.h"
}

using namespace std;

namespace shapes 
{
 class Rectangle {
 public:
 int x0, y0, x1, y1;
 Rectangle();
 Rectangle(int x0, int y0, int x1, int y1);
 ~Rectangle();
 int getArea();
 int ffmpegFile();
 void getSize(int* width, int* height);
 void move(int dx, int dy);
 };
}

#endif
</iostream>


Rectangle.Cpp file in ffmpegFile() i am calling mostly ffmpeg API



#include <iostream>
#include "Rectangle.hpp"

namespace shapes {
 

 // Default constructor
 Rectangle::Rectangle () {}

 // Overloaded constructor
 Rectangle::Rectangle (int x0, int y0, int x1, int y1) {
 this->x0 = x0;
 this->y0 = y0;
 this->x1 = x1;
 this->y1 = y1;
 }

 // Destructor
 Rectangle::~Rectangle () {}

 // Return the area of the rectangle
 int Rectangle::getArea () {
 return 10;
 }

 // Get the size of the rectangle.
 // Put the size in the pointer args
 void Rectangle::getSize (int *width, int *height) {
 (*width) = x1 - x0;
 (*height) = y1 - y0;
 }

 // Move the rectangle by dx dy
 void Rectangle::move (int dx, int dy) {
 this->x0 += dx;
 this->y0 += dy;
 this->x1 += dx;
 this->y1 += dy;
 }
 int Rectangle::ffmpegFile()
 {
 AVFormatContext *fmt_ctx = NULL;
 AVDictionaryEntry *tag = NULL;
 int ret = 0;
 char* filename = "D:\\Discovery.mp4";

 if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)))
 return ret;

 if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) {
 av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
 return ret;
 }

 while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
 printf("%s=%s\n", tag->key, tag->value);

 avformat_close_input(&fmt_ctx);
 return ret;
 }
}
</iostream>


Rectangle.pxd file declaration for cpp file function and variable


cdef extern from "Rectangle.cpp":
 pass
cdef extern from "Rectangle.hpp" namespace "shapes":
 cdef cppclass Rectangle:
 Rectangle() except +
 Rectangle(int, int, int, int) except +
 int x0, y0, x1, y1
 int getArea()
 void getSize(int* width, int* height)
 void move(int, int)
 int ffmpegFile()



rect.pyx file i am calling cpp API


# distutils: language = c++

from Rectangle cimport Rectangle

cdef class PyRectangle:
 cdef Rectangle c_rect # Hold a C++ instance which we're wrapping

 def __cinit__(self, int x0, int y0, int x1, int y1):
 self.c_rect = Rectangle(x0, y0, x1, y1)

 def get_area(self):
 return self.c_rect.getArea()

 def get_size(self):
 cdef int width, height
 self.c_rect.getSize(&width, &height)
 return width, height

 def move(self):
 print(self.c_rect.ffmpegFile())



setup.py
I provided pyx file and ffmpeg library path as well as include path


from distutils.core import setup
from setuptools import Extension
from Cython.Build import cythonize 

sfc_module = [Extension('rect', sources = ['rect.pyx'],
 include_dirs = ['D:\\SiVUE\\Backend\\Cython\\demo\\ffmpeg\\include\\'],
 library_dirs = ['D:\\SiVUE\\Backend\\Cython\\demo\\ffmpeg\\lib\\'],
 libraries = ['avcodec','avdevice','avfilter','avformat','avutil','postproc','swresample','swscale'],
 language='c++')]

setup(name = 'superfastcode', version = '1.0',
 description = 'Python Package with superfastcode C++ extension',
 ext_modules = cythonize(sfc_module),
 include_dirs = ['D:\\SiVUE\\Backend\\Cython\\demo\\ffmpeg\\include\\']
 )



Thank You


-
I am having an issue with playing sounds in discord.js
15 septembre 2020, par Sami Ali ÖzdemirSo, I am having problems when I try to run a sound on discord.js.


Below is the code :


const Discord = require('discord.js')
const client = new Discord.Client()
const {token,prefix} = require('../../config.json')
const cmd = __filename.slice(__dirname.length + 1, -3).trim()

client.on('message', message => {
 function embed(title, content) {
 message.channel.send({'embed':{'title': title,'description': content}})
 }
 if (!message.content.startsWith(prefix)) return
 if (message.content.split(' ')[0].slice(prefix.length).trim() != cmd) return
 const args = message.content.split(' ').shift()
 const voiceChannel = message.member.voice.channel
 if (typeof voiceChannel === 'undefined') return embed('Error','You are not in a voice channel.')
 voiceChannel.join()
 .then(connection => {
 console.log(connection)
 connection.play('../sfx/sfx_mute.mp3')
 });
});
client.login(token)



The error I get is :


(node:27912) UnhandledPromiseRejectionWarning: Error: FFmpeg/avconv not found!
 at Function.getInfo (C:\Users\-\OneDrive\Desktop\AmongBot\node_modules\prism-media\src\core\FFmpeg.js:130:11)
 at Function.create (C:\Users\-\OneDrive\Desktop\AmongBot\node_modules\prism-media\src\core\FFmpeg.js:143:38)
 at new FFmpeg (C:\Users\-\OneDrive\Desktop\AmongBot\node_modules\prism-media\src\core\FFmpeg.js:44:27)
 at AudioPlayer.playUnknown (C:\Users\-\OneDrive\Desktop\AmongBot\node_modules\discord.js\src\client\voice\player\BasePlayer.js:47:20)
 at VoiceConnection.play (C:\Users\-\OneDrive\Desktop\AmongBot\node_modules\discord.js\src\client\voice\util\PlayInterface.js:71:28)
 at C:\Users\-\OneDrive\Desktop\AmongBot\src\Commands\init.js:18:16
 at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:27912) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:27912) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.



I've seen previous questions asked here before. None of the answers were concise, or they included words that suggested uncertainty, and most of them didn't work.


-
Im failing to build .so file for android from FFMPEG
15 juillet 2020, par yejafotI tried many times with different versions of ffmpeg but failed eventually. I dont know how they wrote .sh file to configure different tools. Here are some .sh files i tried and it all failed. Either it shows only
android/share
folder instead of

- 

-
android/include


-
android/lib


-
android/share










OR


i end up in error like
no file or folder exist
,etc

I will share
build_arm64-v8a
different version of files below

VERSION 1


#!/bin/bash
export NDK=/media/sf_sharing/android-ndk
export HOST_TAG=linux-x86_64 # adjust to your building host
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG

export CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
export CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++

function build_arm64-v8a
{
 ./configure \
 --prefix=./android/arm64-v8a \
 --enable-static \
 --enable-pic \
 --disable-asm \
 --disable-opencl \
 --disable-cli \
 --host=aarch64-linux \
 --cross-prefix=$TOOLCHAIN/bin/aarch64-linux-android- \
 --sysroot=$TOOLCHAIN/sysroot \

 make clean
 make
 make install
}

build_arm64-v8a
echo build_arm64-v8a finished



VERSION 2


#!/bin/bash

TOOLCHAIN=/media/sf_sharing/my-android-toolchain64
CROSS_PREFIX=$TOOLCHAIN/bin/aarch64-linux-android-
rm -f $(pwd)/compat/strtod.o
function build_one
{
./configure --prefix=$PREFIX --enable-shared --disable-static --enable-protocol=file --enable-pic --enable-small --disable-programs --disable-doc --disable-symver --target-os=android --enable-cross-compile --cross-prefix=$CROSS_PREFIX --extra-cflags="-Os -fpic $ADDI_CFLAGS" --extra-ldflags="$ADDI_LDFLAGS" --sysroot=$TOOLCHAIN/sysroot $ADDITIONAL_CONFIG_FLAG
make clean
make -j2
make install
}

CPU=arm64-v8a
mkdir -p $(pwd)/android/$CPU
PREFIX=$(pwd)/android/$CPU
ADDI_CFLAGS="-march=armv8-a"
ADDI_LDFLAGS="-L$TOOLCHAIN/sysroot/usr/lib"
ADDITIONAL_CONFIG_FLAG="--arch=aarch64 --enable-yasm"
build_one



VERSION 3


#!/bin/bash
export NDK=/media/sf_sharing/android-ndk
export HOST_TAG=linux-x86_64 # adjust to your building host
export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/$HOST_TAG

export CC=$TOOLCHAIN/bin/aarch64-linux-android21-clang
export CXX=$TOOLCHAIN/bin/aarch64-linux-android21-clang++

function build_arm64-v8a
{
 ./configure \
 --prefix="$HOME/ffmpeg_build" \
 --pkg-config-flags="--static" \
 --extra-cflags="-I$HOME/ffmpeg_build/include" \
 --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
 --extra-libs="-lpthread -lm" \
 --bindir="$HOME/bin" \
 --enable-gpl \
 --enable-gnutls \
 --enable-libaom \
 --enable-libass \
 --enable-libfdk-aac \
 --enable-libfreetype \
 --enable-libmp3lame \
 --enable-libopus \
 --enable-libvorbis \
 --enable-libvpx \
 --enable-libx264 \
 --enable-libx265 \
 --enable-nonfree \

 make clean
 make
 make install
}

build_arm64-v8a
echo build_arm64-v8a finished



I'm using


- 

-
ffmpeg-snapshot.tar.bz2


-
android-ndk-r21d-linux-x86_64








the only thing i know in 'ndk 21` is we need to use default toolchain (android documentation says).


How to create .sh file to build .so file to use in android ?


-