
Recherche avancée
Médias (1)
-
Bug de détection d’ogg
22 mars 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Video
Autres articles (33)
-
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 (...) -
Contribute to documentation
13 avril 2011Documentation is vital to the development of improved technical capabilities.
MediaSPIP welcomes documentation by users as well as developers - including : critique of existing features and functions articles contributed by developers, administrators, content producers and editors screenshots to illustrate the above translations of existing documentation into other languages
To contribute, register to the project users’ mailing (...) -
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 (...)
Sur d’autres sites (2546)
-
How to Synchronize Audio with Video Frames [Python]
19 septembre 2023, par РостиславI want to stream video from URL to a server via socket, which then restreams it to all clients in the room.


This code streams video frame by frame :


async def stream_video(room, url):
 cap = cv2.VideoCapture(url)
 fps = round(cap.get(cv2.CAP_PROP_FPS))

 while True:
 ret, frame = cap.read()
 if not ret: break
 _, img_bytes = cv2.imencode(".jpg", frame)
 img_base64 = base64.b64encode(img_bytes).decode('utf-8')
 img_data_url = f"data:image/jpeg;base64,{img_base64}"

 await socket.emit('segment', { 'room': room, 'type': 'video', 'stream': img_data_url})
 await asyncio.sleep(1/fps)
 
 cap.release()



And this is code for stream audio :


async def stream_audio(room, url):
 sample_size = 14000
 cmd_audio = [
 "ffmpeg",
 "-i", url,
 '-vn',
 '-f', 's16le',
 '-c:a', 'pcm_s16le',
 "-ac", "2",
 "-sample_rate","48000",
 '-ar','48000',
 "-acodec","libmp3lame",
 "pipe:1"
 ]
 proc_audio = await asyncio.create_subprocess_exec(
 *cmd_audio, stdout=subprocess.PIPE, stderr=False
 )

 while True:
 audio_data = await proc_audio.stdout.read(sample_size)
 if audio_data:
 await socket.emit('segment', { 'room': room, 'type': 'audio', 'stream': audio_data})
 await asyncio.sleep(1)




But the problem is : how to synchronize them ? How many bytes need to be read every second from ffmpeg so that the audio matches the frames.


I tried to do this, but the problem with the number of chunks still remained :


while True:
 audio_data = await proc_audio.stdout.read(sample_size)
 if audio_data:
 await socket.emit('segment', { 'room': room, 'type': 'audio', 'stream': audio_data})

 for i in range(fps):
 ret, frame = cap.read()
 if not ret: break
 _, img_bytes = cv2.imencode(".jpg", frame)
 img_base64 = base64.b64encode(img_bytes).decode('utf-8')
 img_data_url = f"data:image/jpeg;base64,{img_base64}"

 await socket.emit('segment', { 'room': room, 'type': 'video', 'stream': img_data_url})
 await asyncio.sleep(1/fps)



I also tried loading a chunk of audio into pydub, but it shows that the duration of my 14000 chunk is 0.07s, which is very small. And if you increase the number of chunks for reading to 192k (as the gpt chat says), then the audio will simply play very, very quickly.
The ideal number of chunks that I was able to achieve is approximately 14000, but the audio is still not synchronous.


-
Cannot Compile FFMPEG with libfreetype on Windows/Msys2
10 octobre 2024, par Devin DixonI am having issues compiling ffmpeg with libfreetype with this commmand on windows MSYS2 :


./configure --pkg-config-flags="--static" --enable-libvpl --enable-libopenh264 --enable-version3 --enable-libfreetype --enable-libopus --enable-libvpx --enable-libvorbis --enable-libaom --enable-libdav1d --disable-gpl --disable-w32threads --enable-pthreads --disable-shared --enable-static --extra-cflags='--static' --extra-cflags="-I/mingw64/include -static" --extra-ldflags="-L/mingw64/lib -static" --prefix="/home/compiled"



I keep getting this error :


ERROR: freetype2 not found using pkg-config

If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.libera.chat.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.



I've installed freetype with this command :


pacman -Ss mingw-w64-x86_64-freetype



I've also tried compiling freetype2 from the source :


git clone https://git.savannah.gnu.org/git/freetype/freetype2.git

cd freetype2

mkdir build && cd build

/mingw64/bin/cmake .. -G "MSYS Makefiles" -DBUILD_SHARED_LIBS=OFF -DCMAKE_INSTALL_PREFIX=/mingw64

make

make install



And pkg-config gives this :


pkg-config freetype2 --cflags --libs
-IC:/msys64/mingw64/include/freetype2 -IC:/msys64/mingw64/include/harfbuzz -IC:/msys64/mingw64/include/glib-2.0 -IC:/msys64/mingw64/lib/glib-2.0/include -IC:/msys64/mingw64/include/libpng16 -lfreetype



I can confirm the package is there :


ls /mingw64/lib/pkgconfig/freetype2.pc
/mingw64/lib/pkgconfig/freetype2.pc



Is there anything else I should be doing to compile a static version of ffmpeg with this package ?


-
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.