
Recherche avancée
Autres articles (72)
-
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
MediaSPIP 0.1 Beta version
25 avril 2011, parMediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
The zip file provided here only contains the sources of MediaSPIP in its standalone version.
To get a working installation, you must manually install all-software dependencies on the server.
If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...) -
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 ;
Sur d’autres sites (11357)
-
ffmpeg in C/C++ with Multhreading RSTP from 4 camera [on hold]
28 janvier 2018, par ManuelI hope you can help me solve a problem :
My C program with multhreading, getting video from 4 IP CAM, using the RSTP protocol and save the output video in file.
Each IP CAM represent a Thread and below is the code that a run to record videos :
system("sudo nohup ffmpeg -rtsp_transport tcp -i rtsp ://admin:admin@173.26.0.105:554/live/main -vcodec copy -an -t 120 -max_alloc 1000000 -vsync 2 /media/video/videos/180118/Cam5_pruebas_10_NQ.mp4 &") ;
I select the recording time 2 minutes, but the problem is that the each video output has a different time :
For example :
CAM 01- output file 2 minutes
CAM 01- output file 1:59:97 minutes
CAM 01- output file 1:59:96 minutes
CAM 01- output file 1:34:90 minutesPlease help...
-
FFMPEG to fluent ffmpeg [on hold]
16 janvier 2018, par MinhI use
ffmpeg
command on VPS but I want cover to github . Help me
This is codeffmpeg - re - i http: //storage.livefb.com.vn/assets/video/video_307_1516075122469280.mp4 -i assets/bg/13.png -i assets/logo.png -filter_complex "[0:v][1:v] overlay=x=4:y=H-h:enable='between(t,0,t)' [tmp]; [tmp][2:v] overlay=x=14:y=H-h-10:enable='between(t,0,t)',drawtext=fontfile=assets/thanh.ttf:y=h-60:x=158:text='TDL AUTOFB INBOXFB LIVEFB
0965367062 MINH THU ':fontcolor=white:fontsize=36,drawbox=enable='
between(t, 2, 10)
':y=ih-ih/2:color=black@0.8:width=iw:height=50:t=max,drawtext=enable='
between(t, 2, 10)
':fontfile=assets/thanh.ttf:y=h-h/2+10:x=(w-text_w)/2:text='
được phát bởi livefb liên hệ minh thư để được hỗ trợ ':fontcolor=white:fontsize=30" -vcodec libx264 -pix_fmt yuv420p -r 30 -g 60 -b:v 1400k -profile:v main -level 3.1 -acodec libmp3lame -b:a 128k -ar 44100 -metadata title="" -metadata artist="" -metadata album_artist="" -metadata album="" -metadata date="" -metadata track="" -metadata genre="" -metadata publisher="" -metadata encoded_by="" -metadata copyright="" -metadata composer="" -metadata performer="" -metadata TIT1="" -metadata TIT3="" -metadata disc="" -metadata TKEY="" -metadata TBPM="" -metadata language="eng" -metadata encoder="" -threads 0 -preset superfast -f flv "rtmp://live-api.facebook.com:80/rtmp/187884241800146?ds=1&a=ATgAYCPa1TJeWa2t" -
Streamimg video files using EmbedIO for the server and with live transcoding C#
24 mai 2020, par Efrain Bastidas BerriosI'm using EmbedIO to create a simple web server to stream some local video files over the network
by simply typing an url like this one :
http://192.168.1.101:9696/videos?seconds=0&file=F:\Videos\MyVideo.mp4



The code for the server is the following :



static void StartServer(params string[] args)
{
 var url = GetIpAddress();
 if (args.Length > 0)
 url = args[0];
 var server = new WebServer(o => o
 .WithUrlPrefix(url)
 .WithMode(HttpListenerMode.EmbedIO))
 .WithLocalSessionManager()
 .WithModule(new VideoModule("/videos"))
 .WithModule(new ActionModule("/", HttpVerbs.Any, ctx =>
 {
 return ctx.SendDataAsync(new { Message = "Server initialized" });
 }));
 server.RunAsync();

 var browser = new Process()
 {
 StartInfo = new ProcessStartInfo(url) { UseShellExecute = true }
 };
 browser.Start();
 Console.ReadKey(true);
} 




And the code for the VideoModule is the following :



public class VideoModule : WebModuleBase
 {
 private readonly Process _transcodeProcess;

 public VideoModule(string baseRoute)
 : base(baseRoute)
 {
 _transcodeProcess = new Process
 {
 StartInfo = new ProcessStartInfo
 {
 FileName = @"C:\ffmpeg\ffmpeg.exe",
 UseShellExecute = false,
 LoadUserProfile = false,
 RedirectStandardInput = true,
 RedirectStandardOutput = true,
 CreateNoWindow = false
 }
 };
 }

 public override bool IsFinalHandler => false;

 protected override Task OnRequestAsync(IHttpContext context)
 {
 var path = context.RequestedPath;
 var verb = context.Request.HttpVerb;
 var query = context.GetRequestQueryData();
 var allowedQueryParametes = new[]
 {
 "file",
 "seconds"
 };
 if (query.Count == 0 || !query.AllKeys.All(q => allowedQueryParametes.Contains(q)))
 {
 context.SetHandled();
 return Task.CompletedTask;
 }
 try
 {
 string filepath = query["file"];
 if (!File.Exists(filepath))
 {
 context.Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
 return Task.CompletedTask;
 }

 double duration = GetFileDuration(filepath);

 var file = new FileInfo(filepath);
 context.Response.Headers.Add("Content-Duration", $"{Math.Round(duration, 2)}");
 context.Response.ContentType = context.GetMimeType(file.Extension); 
 _transcodeProcess.StartInfo.Arguments = @$"-v quiet -y -i ""{filepath}"" -crf 28 -preset ultrafast -vcodec h264 -acodec aac -b:a 128k -movflags frag_keyframe+faststart -f mp4 -";
 _transcodeProcess.Start();

 var stream = _transcodeProcess.StandardOutput.BaseStream as FileStream;
 return stream.CopyToAsync(context.Response.OutputStream);
 }
 catch (Exception e)
 {
 Console.WriteLine(e);
 }
 finally
 {
 context.SetHandled();
 }
 return Task.CompletedTask;
 }

 private static double GetFileDuration(string filepath)
 {
 var p = new Process
 {
 EnableRaisingEvents = true,
 StartInfo = new ProcessStartInfo
 {
 FileName = @"C:\ffmpeg\ffprobe.exe",
 UseShellExecute = false,
 LoadUserProfile = false,
 RedirectStandardInput = true,
 RedirectStandardOutput = true,
 RedirectStandardError = true,
 CreateNoWindow = false
 }
 };
 p.StartInfo.Arguments = @$"-v quiet -i ""{filepath}"" -show_entries format=duration -of csv=p=0";
 p.Start();
 p.WaitForExit();
 string stringDuration = p.StandardOutput.ReadToEnd();
 return double.Parse(stringDuration.Replace(Environment.NewLine, string.Empty));
 }
}




As you can see, I'm using ffmpeg because i need to transcode my video files.
Currently this works (At least in Chrome) the problem is that i can't seek the video, and
I assume that's because I'm returning a 200 status code (its the default) instead of a 206 Partial Content code.



So, i thought, that if i want to return chunks of the video, i needed to pass some extra arguments to ffmpeg in order to transcode only a portion of the file, so i created a variable
_seconds
which will hold the current position and also added a -t 60 to only process 60 seconds


So, with those changes, the
OnRequestAsync
now looks like this :


protected override Task OnRequestAsync(IHttpContext context)
 {
 var path = context.RequestedPath;
 var verb = context.Request.HttpVerb;
 var query = context.GetRequestQueryData();
 var allowedQueryParametes = new[]
 {
 "file",
 "seconds"
 };
 if (query.Count == 0 || !query.AllKeys.All(q => allowedQueryParametes.Contains(q)))
 {
 context.SetHandled();
 return Task.CompletedTask;
 }

 try
 {
 string filepath = query["file"];
 if (!File.Exists(filepath))
 {
 context.Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
 return Task.CompletedTask;
 }

 double duration = GetFileDuration(filepath);

 var file = new FileInfo(filepath);
 context.Response.Headers.Add("Accept-Ranges", "bytes");
 context.Response.Headers.Add("Content-Duration", $"{Math.Round(duration, 2)}");
 context.Response.ContentType = context.GetMimeType(file.Extension);
 context.Response.DisableCaching();
 if (context.Request.Headers.ContainsKey("Range"))
 {
 string[] range = context.Request.Headers["Range"].Split(new char[] { '=', '-' });
 long start = long.Parse(range[1]);
 if (start != 0)
 {
 _seconds += 60;
 }

 _transcodeProcess.StartInfo.Arguments = @$"-v quiet -ss {_seconds} -y -i ""{filepath}"" -t 60 -crf 28 -preset ultrafast -vcodec h264 -acodec aac -b:a 128k -movflags frag_keyframe+faststart -f mp4 -";
 _transcodeProcess.Start();

 var stream = _transcodeProcess.StandardOutput.BaseStream as FileStream;
 var memStream = new MemoryStream();
 stream.CopyTo(memStream);
 _transcodeProcess.WaitForExit();
 context.Response.StatusCode = 206;
 context.Response.ContentLength64 = memStream.Length;
 var responseRange = string.Format("bytes {0}-{1}/*", start, memStream.Length - 1);

 context.Response.Headers.Add("Content-Range", responseRange);
 memStream.Position = 0;
 return memStream.CopyToAsync(context.Response.OutputStream);
 }
 }
 catch (Exception e)
 {
 Console.WriteLine(e);
 }
 finally
 {
 context.SetHandled();
 }
 return Task.CompletedTask;
 }




The problem is that it works for the first 60 seconds of the video, but then the Chrome video player stops. For some reason it's not asking for the next chunk and I don't know why (I thought that this will be automatically handled since I'm returning back a 206 code)



Any help would be appreciated, thanks !