
Recherche avancée
Autres articles (70)
-
Configurer la prise en compte des langues
15 novembre 2010, parAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Support de tous types de médias
10 avril 2011Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)
Sur d’autres sites (7036)
-
Révision 24109 : Fix #3564 : en statut propose c’est la date de publi de l’article qu’on regle
29 septembre 2018, par cedric@yterium.com -
Cropping video stream in android-studio
9 mai 2021, par Benjamin BasmaciI want stream a very large video (lets say 5000x5000) and I want to crop it to show 1000x1000 chunks. Currently I do so by streaming the video via TextureView.SurfaceTextureListener. Scaling the video up to the point where one chunk fits my view and can be played. Here is a little snippit :



Matrix matrix = new Matrix();
matrix.setScale(scaleX, scaleY, 0, 0);
matrix.postTranslate(positionX, positionY);

textureView.setTransform(matrix);




However, since its such a big video, some devices cant play it. Smaller videos work fine, even with the same codec. It seems like decoding it takes too long for it to be able to play. This even occured when I stored the video in resources. (maybe has something to do with the second answer in this question)



I tried using ffmpeg, but when I did, according to this question, i got the error Message in
ExecuteBinaryResponseHandler.onFailure(): "CANNOT LINK EXECUTABLE "/data/user/0/packageName/files/ffmpeg": /data/data/packageName/files/ffmpeg: has text relocations"
. So it seems thatffmpeg
is not an option anymore, and wont ever be, according to these issues :


- 

- https://issuetracker.google.com/issues/37067983
- https://trac.ffmpeg.org/ticket/4928







So, a few questions about this.



- 

- Is there an alternative to ffmpeg that lets me crop videos programmatically and with high performance, before they are decoded by the player ?
- Is there a way to restrict android to only load the parts 'visible' of a video after it has been scaled ? Boosting the performance of my first attempt, scaling the video up to a point where I only see a particular area ?
- Is there a way, other than lowering the quality of my video source, to ensure that a device can play the video or at least to detect programmatically that a video can not be played ?
- Is there another technique or a workaround that I can use to show a cropped part of a vide ?











UPDATE



As suggested in the comments, to boil it down to one question :
Is there a way for me to crop a video programmatically from url so that it plays on all modern devices ?


-
C# server problem with FFmpeg Visual Studio 2022
16 mai 2024, par 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.