
Advanced search
Other articles (17)
-
Publier sur MédiaSpip
13 June 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 -
Configuration spécifique pour PHP5
4 February 2011, byPHP5 est obligatoire, vous pouvez l’installer en suivant ce tutoriel spécifique.
Il est recommandé dans un premier temps de désactiver le safe_mode, cependant, s’il est correctement configuré et que les binaires nécessaires sont accessibles, MediaSPIP devrait fonctionner correctement avec le safe_mode activé.
Modules spécifiques
Il est nécessaire d’installer certains modules PHP spécifiques, via le gestionnaire de paquet de votre distribution ou manuellement : php5-mysql pour la connectivité avec la (...) -
La sauvegarde automatique de canaux SPIP
1 April 2010, byDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)
On other websites (6130)
-
zmbvdec: check decompression buffer size.
11 November 2012, by Michael Niedermayerzmbvdec: check decompression buffer size.
-
C# server problem with FFmpeg Visual Studio 2022
16 May 2024, by seanofdeadHello everyone I've spent countless hours on my server I'm trying to create that will share video from one stream to another client computer. That is the goal anyway. I'm using Visual Studio 2022 most recent update. Currently this is my code


using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Threading.Tasks;
using FFmpeg.AutoGen;
using NLog;

public class VideoStreamServer
{
 private const int Port = 5000;
 private TcpListener server;
 private FFmpegVideoEncoder encoder;
 private static readonly Logger logger = LogManager.GetCurrentClassLogger();

 public VideoStreamServer()
 {
 // Initialize FFmpeg network components
 Console.WriteLine("Initializing FFmpeg network components...");
 int result = ffmpeg.avformat_network_init();
 if (result != 0)
 {
 throw new ApplicationException($"Failed to initialize FFmpeg network components: {result}");
 }

 // Initialize encoder
 encoder = new FFmpegVideoEncoder(1920, 1080, AVCodecID.AV_CODEC_ID_H264); // Screen size & codec
 }

 public static void Main()
 {
 // Initialize NLog
 var logger = LogManager.GetCurrentClassLogger();
 logger.Info("Application started");

 var server = new VideoStreamServer();
 server.Start().Wait();
 }

 public async Task Start()
 {
 server = new TcpListener(IPAddress.Any, Port);
 server.Start();
 logger.Info($"Server started on port {Port}...");

 try
 {
 while (true)
 {
 TcpClient client = await server.AcceptTcpClientAsync();
 logger.Info("Client connected...");
 _ = HandleClientAsync(client);
 }
 }
 catch (Exception ex)
 {
 logger.Error(ex, "An error occurred");
 }
 }

 private async Task HandleClientAsync(TcpClient client)
 {
 using (client)
 using (NetworkStream netStream = client.GetStream())
 {
 try
 {
 await encoder.StreamEncodedVideoAsync(netStream);
 }
 catch (IOException ex)
 {
 logger.Error(ex, $"Network error: {ex.Message}");
 // Additional logging and recovery actions
 }
 catch (Exception ex)
 {
 logger.Error(ex, $"Unexpected error: {ex.Message}");
 // Log and handle other exceptions
 }
 finally
 {
 // Ensure all resources are cleaned up properly
 client.Close();
 logger.Info("Client connection closed properly.");
 }
 }
 }
}

public class FFmpegVideoEncoder
{
 private readonly int width;
 private readonly int height;
 private readonly AVCodecID codecId;
 private static readonly Logger logger = LogManager.GetCurrentClassLogger();

 public FFmpegVideoEncoder(int width, int height, AVCodecID codecId)
 {
 this.width = width;
 this.height = height;
 this.codecId = codecId;
 InitializeEncoder();
 }

 private void InitializeEncoder()
 {
 // Initialize FFmpeg encoder here
 logger.Debug("FFmpeg encoder initialized");
 }

 public async Task StreamEncodedVideoAsync(NetworkStream netStream)
 {
 // Initialize reusable buffers for efficiency
 byte[] buffer = new byte[4096];

 // Capture and encode video frames
 while (true)
 {
 try
 {
 // Simulate capture and encoding
 byte[] videoData = new byte[1024]; // This would come from the encoder

 // Simulate streaming
 for (int i = 0; i < videoData.Length; i += buffer.Length)
 {
 int chunkSize = Math.Min(buffer.Length, videoData.Length - i);
 Buffer.BlockCopy(videoData, i, buffer, 0, chunkSize);
 await netStream.WriteAsync(buffer, 0, chunkSize);
 }
 }
 catch (Exception ex)
 {
 logger.Error(ex, "Error streaming video data");
 throw; // Rethrow to handle in the calling function
 }

 await Task.Delay(1000 / 30); // For 30 FPS
 }
 }
}



When I build no issues but when i run it in debug mode I get this error


System.DllNotFoundException
 HResult=0x80131524
 Message=Unable to load DLL 'avformat.59 under C:\Users\phlfo\Downloads\cfolder\server\ConsoleApp\bin\Debug\': The specified module could not be found.
 Source=FFmpeg.AutoGen
 StackTrace:
 at FFmpeg.AutoGen.ffmpeg.LoadLibrary(String libraryName, Boolean throwException)
 at FFmpeg.AutoGen.ffmpeg.<>c.<.cctor>b__7_0(String libraryName)
 at FFmpeg.AutoGen.ffmpeg.<>c.<.cctor>b__7_242()
 at FFmpeg.AutoGen.ffmpeg.avformat_network_init()
 at VideoStreamServer..ctor() in C:\Users\phlfo\Downloads\cfolder\server\ConsoleApp\Program.cs:line 20
 at VideoStreamServer.Main() in C:\Users\phlfo\Downloads\cfolder\server\ConsoleApp\Program.cs:line 36



I have FFmpeg.AutoGen package installed through VS i originally started with 7.0 but then switched to 5.0 to see if an older version might work (it did not). I also have the files in the same directory as the .exe for testing purposes as seen in the screenshot. Can someone please help me figure out this error.



-
aarch64: vvc: Fix compilation of alf.S with MSVC 2022 17.7 and older
23 July 2024, by Martin Storsjöaarch64: vvc: Fix compilation of alf.S with MSVC 2022 17.7 and older
Use the "ldur" instruction explicitly, instead of having the
assembler implicitly convert "ldr" instructions to "ldur".This fixes build errors like these:
libavcodec\aarch64\vvc\alf.o.asm(1023) : error A2518: operand 2: Memory offset must be aligned
ldr q22, [x3, #24]
libavcodec\aarch64\vvc\alf.o.asm(1024) : error A2518: operand 2: Memory offset must be aligned
ldr q24, [x2, #24]
libavcodec\aarch64\vvc\alf.o.asm(1393) : error A2518: operand 2: Memory offset must be aligned
ldr q22, [x3, #24]
libavcodec\aarch64\vvc\alf.o.asm(1394) : error A2518: operand 2: Memory offset must be aligned
ldr q24, [x2, #24]Signed-off-by: Martin Storsjö <martin@martin.st>