Recherche avancée

Médias (1)

Mot : - Tags -/Rennes

Autres articles (78)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • Gestion de la ferme

    2 mars 2010, par

    La ferme est gérée dans son ensemble par des "super admins".
    Certains réglages peuvent être fais afin de réguler les besoins des différents canaux.
    Dans un premier temps il utilise le plugin "Gestion de mutualisation"

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

Sur d’autres sites (15582)

  • FFMPEG to fluent ffmpeg [on hold]

    16 janvier 2018, par Minh

    I use ffmpeg command on VPS but I want cover to github . Help me
    This is code

    ffmpeg - 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 Berrios

    I'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 !

    


  • Automating youtube-dl to download videos from a Vlive Channel [on hold]

    17 août 2019, par yrcje

    I would like to automate youtube-dl to download any new live streams from a Vlive page, as youtube-dl supports vlive downloading, I would like to ask if it’s possible for me to use a bat to automate it ? As sometimes the replay just gets cut and I’d like to avoid that if possible. I tried looking into phyton as well but I can’t find any phyton related things that is related to vlive as most of them are just youtube.

    Would appreciate any help if possible.