Recherche avancée

Médias (1)

Mot : - Tags -/3GS

Autres articles (50)

  • Publier sur MédiaSpip

    13 juin 2013

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

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (7513)

  • C# Streaming video files using EmbedIO for the server and with live transcoding

    30 août 2021, par Patrik

    I need advice. I'm trying to create a simple web server via EmbedIO for streaming local video files over the network by simply entering the URL : http://192.168.0.165:9696/videos?seconds=0&file=D :\videos\video.mp4

    


    The code for the server is the following :

    


       static void StartServer(string[] args)
    {
        var url = "http://192.168.0.165:9696";

        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" });
            }));

        // Listen for state changes.
        server.StateChanged += (s, e) => $"WebServer New State - {e.NewState}".Info();
        
        server.Start();

        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;
    private int _seconds;

    public VideoModule(string baseRoute) : base(baseRoute)
    {
        _transcodeProcess = new Process
        {
            StartInfo = new ProcessStartInfo
            {
                FileName = @"D:\ffmpeg\x64\ffmpeg.exe",
                WindowStyle = ProcessWindowStyle.Hidden,
                UseShellExecute = false,
                RedirectStandardInput = true,
                RedirectStandardOutput = true,
                RedirectStandardError = true,
                CreateNoWindow = true
            }
        };
    }

    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;
            }

            var 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();
                _transcodeProcess.PriorityClass = ProcessPriorityClass.High;

                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;
    }

    private static double GetFileDuration(string filepath)
    {
        var p = new Process
        {
            EnableRaisingEvents = true,
            StartInfo = new ProcessStartInfo
            {
                FileName = @"D:\ffmpeg\x64\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(ReplaceNewlines(stringDuration, ""), System.Globalization.CultureInfo.InvariantCulture);
    }

    static string ReplaceNewlines(string blockOfText, string replaceWith)
    {
        return blockOfText.Replace("\r\n", replaceWith).Replace("\n", replaceWith).Replace("\r", replaceWith);
    }

}


    


    I use ffmpeg to transcode video files. This is currently working (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

    


    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

    


  • RTSP Streaming on HTML page [on hold]

    20 décembre 2018, par Sajal Gupta

    I’m streaming from my IP Camera via RTSP protocol and able to watch live stream on VLC Player but I want to receive this stream in Java Code and save it into a file and also stream it on HTML page simultaneously. I tried using multiple plugins which are either unable to transcode or read RTSP URL. I also tried to read this stream via inputStream but getting null from it. I also tried websocket to listen to this stream but websocket is also returning null. I’m able to create file using ffmpeg from terminal but I want to do this through Java Code. I used vlcj library in java but it is also returning a deadlock error. Streamedian is paid and VXG Media Player is stuck on loader forever.
    Is there a way to stream and save RSTP stream simultaneously via Java/Grails code ?

  • How can I create a stream of my screen on a Windows computer for another device on my network ? [on hold]

    30 novembre 2018, par user279040

    I want to view what is seen on my Windows laptop screen on my tv, which is connected to a device running enigma 2, "screen mirroring". There are no software or plugins that will work on the device for this.

    However the device can play live stream urls of the form :

    http://portal.geniptv.com:8080/live#/abc1/abc2/19517.ts

    I am thinking maybe I could get something to create an expanding .ts file that’s capturing the screen, and then serve this up through http?

    It may also be able to use other protocols like udp :// or other file extensions, I would certainly give them a shot if they reduced lag.

    I spent hours installing different streaming software, none of which worked. I am just looking for a simple solution where I might give ffmpeg a command and it would do all I require. I have python installed as well if I need that to for example set up a http server.