Recherche avancée

Médias (0)

Mot : - Tags -/page unique

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (22)

  • 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 de tous types de médias

    10 avril 2011

    Contrairement à 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) (...)

  • 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 (6901)

  • avformat/riffenc : don't force WAVEFORMATEXTENSIBLE for flt/dbl LPCM

    21 décembre 2023, par Gyan Doshi
    avformat/riffenc : don't force WAVEFORMATEXTENSIBLE for flt/dbl LPCM
    

    2c2a167ca7 forced WAVEFORMATEXTENSIBLE for all LPCM streams with greater
    than 16 bits per sample. However, WAVEFORMATEX allows IEEE Float samples
    or any depth where raw depth == coded depth, see Remarks section at
    https://learn.microsoft.com/en-us/windows/win32/api/mmreg/ns-mmreg-waveformatex
    and samples M1F1-float32-AFsp, M1F1-float64-AFsp at
    https://www.mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/Samples.html

    There are hardware devices and likely software players requiring float samples
    that fail to qualify files with WAVEFORMATEXTENSIBLE headers.

    • [DH] libavformat/riffenc.c
    • [DH] tests/ref/acodec/pcm-f32le
    • [DH] tests/ref/acodec/pcm-f64le
    • [DH] tests/ref/seek/acodec-pcm-f32le
    • [DH] tests/ref/seek/acodec-pcm-f64le
  • Cutting a live stream into separate mp4 files

    9 juin 2017, par Fearhunter

    I am doing a research for cutting a live stream in piece and save it as mp4 files. I am using this source for the proof of concept :

    https://docs.microsoft.com/en-us/azure/media-services/media-services-dotnet-creating-live-encoder-enabled-channel#download-sample

    And this is the example code I use :

    using System;
    using System.Collections.Generic;
    using System.Configuration;
    using System.IO;
    using System.Linq;
    using System.Net;
    using System.Security.Cryptography;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.WindowsAzure.MediaServices.Client;
    using Newtonsoft.Json.Linq;

    namespace AMSLiveTest
    {
       class Program
       {
           private const string StreamingEndpointName = "streamingendpoint001";
           private const string ChannelName = "channel001";
           private const string AssetlName = "asset001";
           private const string ProgramlName = "program001";

           // Read values from the App.config file.
           private static readonly string _mediaServicesAccountName =
           ConfigurationManager.AppSettings["MediaServicesAccountName"];
           private static readonly string _mediaServicesAccountKey =
           ConfigurationManager.AppSettings["MediaServicesAccountKey"];

           // Field for service context.
           private static CloudMediaContext _context = null;
           private static MediaServicesCredentials _cachedCredentials = null;

           static void Main(string[] args)
           {
               // Create and cache the Media Services credentials in a static class variable.
               _cachedCredentials = new MediaServicesCredentials(
               _mediaServicesAccountName,
               _mediaServicesAccountKey);
               // Used the cached credentials to create CloudMediaContext.
               _context = new CloudMediaContext(_cachedCredentials);

               IChannel channel = CreateAndStartChannel();

               // Set the Live Encoder to point to the channel's input endpoint:
               string ingestUrl = channel.Input.Endpoints.FirstOrDefault().Url.ToString();

               // Use the previewEndpoint to preview and verify
               // that the input from the encoder is actually reaching the Channel.
               string previewEndpoint = channel.Preview.Endpoints.FirstOrDefault().Url.ToString();

               IProgram program = CreateAndStartProgram(channel);
               ILocator locator = CreateLocatorForAsset(program.Asset, program.ArchiveWindowLength);
               IStreamingEndpoint streamingEndpoint = CreateAndStartStreamingEndpoint();
               GetLocatorsInAllStreamingEndpoints(program.Asset);

               // Once you are done streaming, clean up your resources.
               Cleanup(streamingEndpoint, channel);
           }

           public static IChannel CreateAndStartChannel()
           {
               //If you want to change the Smooth fragments to HLS segment ratio, you would set the ChannelCreationOptions’s Output property.

               IChannel channel = _context.Channels.Create(
               new ChannelCreationOptions
               {
               Name = ChannelName,
               Input = CreateChannelInput(),
               Preview = CreateChannelPreview()
               });

               //Starting and stopping Channels can take some time to execute. To determine the state of operations after calling Start or Stop, query the IChannel.State .

               channel.Start();

               return channel;
           }

           private static ChannelInput CreateChannelInput()
           {
               return new ChannelInput
               {
                   StreamingProtocol = StreamingProtocol.RTMP,
                   AccessControl = new ChannelAccessControl
                   {
                       IPAllowList = new List<iprange>
                               {
                               new IPRange
                           {
                               Name = "TestChannelInput001",
                               // Setting 0.0.0.0 for Address and 0 for SubnetPrefixLength
                               // will allow access to IP addresses.
                               Address = IPAddress.Parse("0.0.0.0"),
                               SubnetPrefixLength = 0
                           }
                       }
                   }
               };
           }

           private static ChannelPreview CreateChannelPreview()
           {
               return new ChannelPreview
               {
                   AccessControl = new ChannelAccessControl
                   {
                       IPAllowList = new List<iprange>
                       {
                           new IPRange
                           {
                               Name = "TestChannelPreview001",
                               // Setting 0.0.0.0 for Address and 0 for SubnetPrefixLength
                               // will allow access to IP addresses.
                               Address = IPAddress.Parse("0.0.0.0"),
                               SubnetPrefixLength = 0
                           }
                       }
                   }
               };
           }

           public static void UpdateCrossSiteAccessPoliciesForChannel(IChannel channel)
           {
               var clientPolicy =
                   @"&lt;?xml version=""1.0"" encoding=""utf-8""?>
               
                   
                       <policy>
                           
                               <domain uri=""></domain>
                           
                           
                              <resource path=""></resource>"" include-subpaths=""true""/>
                           
                       </policy>
                   
               ";

               var xdomainPolicy =
                   @"&lt;?xml version=""1.0"" ?>
               
                   
               ";

               channel.CrossSiteAccessPolicies.ClientAccessPolicy = clientPolicy;
               channel.CrossSiteAccessPolicies.CrossDomainPolicy = xdomainPolicy;

               channel.Update();
           }

           public static IProgram CreateAndStartProgram(IChannel channel)
           {
               IAsset asset = _context.Assets.Create(AssetlName, AssetCreationOptions.None);

               // Create a Program on the Channel. You can have multiple Programs that overlap or are sequential;
               // however each Program must have a unique name within your Media Services account.
               IProgram program = channel.Programs.Create(ProgramlName, TimeSpan.FromHours(3), asset.Id);
               program.Start();

               return program;
           }

           public static ILocator CreateLocatorForAsset(IAsset asset, TimeSpan ArchiveWindowLength)
           {
               // You cannot create a streaming locator using an AccessPolicy that includes write or delete permissions.            

               var locator = _context.Locators.CreateLocator
                   (
                       LocatorType.OnDemandOrigin,
                       asset,
                       _context.AccessPolicies.Create
                       (
                           "Live Stream Policy",
                           ArchiveWindowLength,
                           AccessPermissions.Read
                       )
                   );

               return locator;
           }

           public static IStreamingEndpoint CreateAndStartStreamingEndpoint()
           {
               var options = new StreamingEndpointCreationOptions
               {
                   Name = StreamingEndpointName,
                   ScaleUnits = 1,
                   AccessControl = GetAccessControl(),
                   CacheControl = GetCacheControl()
               };

               IStreamingEndpoint streamingEndpoint = _context.StreamingEndpoints.Create(options);
               streamingEndpoint.Start();

               return streamingEndpoint;
           }

           private static StreamingEndpointAccessControl GetAccessControl()
           {
               return new StreamingEndpointAccessControl
               {
                   IPAllowList = new List<iprange>
                   {
                       new IPRange
                       {
                           Name = "Allow all",
                           Address = IPAddress.Parse("0.0.0.0"),
                           SubnetPrefixLength = 0
                       }
                   },

                   AkamaiSignatureHeaderAuthenticationKeyList = new List<akamaisignatureheaderauthenticationkey>
                   {
                       new AkamaiSignatureHeaderAuthenticationKey
                       {
                           Identifier = "My key",
                           Expiration = DateTime.UtcNow + TimeSpan.FromDays(365),
                           Base64Key = Convert.ToBase64String(GenerateRandomBytes(16))
                       }
                   }
               };
           }

           private static byte[] GenerateRandomBytes(int length)
           {
               var bytes = new byte[length];
               using (var rng = new RNGCryptoServiceProvider())
               {
                   rng.GetBytes(bytes);
               }

               return bytes;
           }

           private static StreamingEndpointCacheControl GetCacheControl()
           {
               return new StreamingEndpointCacheControl
               {
                   MaxAge = TimeSpan.FromSeconds(1000)
               };
           }

           public static void UpdateCrossSiteAccessPoliciesForStreamingEndpoint(IStreamingEndpoint streamingEndpoint)
           {
               var clientPolicy =
                   @"&lt;?xml version=""1.0"" encoding=""utf-8""?>
               
                   
                       <policy>
                           
                               <domain uri=""></domain>
                           
                           
                              <resource path=""></resource>"" include-subpaths=""true""/>
                           
                       </policy>
                   
               ";

               var xdomainPolicy =
                   @"&lt;?xml version=""1.0"" ?>
               
                   
               ";

               streamingEndpoint.CrossSiteAccessPolicies.ClientAccessPolicy = clientPolicy;
               streamingEndpoint.CrossSiteAccessPolicies.CrossDomainPolicy = xdomainPolicy;

               streamingEndpoint.Update();
           }

           public static void GetLocatorsInAllStreamingEndpoints(IAsset asset)
           {
               var locators = asset.Locators.Where(l => l.Type == LocatorType.OnDemandOrigin);
               var ismFile = asset.AssetFiles.AsEnumerable().FirstOrDefault(a => a.Name.EndsWith(".ism"));
               var template = new UriTemplate("{contentAccessComponent}/{ismFileName}/manifest");
               var urls = locators.SelectMany(l =>
                           _context
                               .StreamingEndpoints
                               .AsEnumerable()
                               .Where(se => se.State == StreamingEndpointState.Running)
                               .Select(
                                   se =>
                                       template.BindByPosition(new Uri("http://" + se.HostName),
                                       l.ContentAccessComponent,
                                           ismFile.Name)))
                           .ToArray();

           }

           public static void Cleanup(IStreamingEndpoint streamingEndpoint,
                                       IChannel channel)
           {
               if (streamingEndpoint != null)
               {
                   streamingEndpoint.Stop();
                   streamingEndpoint.Delete();
               }

               IAsset asset;
               if (channel != null)
               {

                   foreach (var program in channel.Programs)
                   {
                       asset = _context.Assets.Where(se => se.Id == program.AssetId)
                                               .FirstOrDefault();

                       program.Stop();
                       program.Delete();

                       if (asset != null)
                       {
                           foreach (var l in asset.Locators)
                               l.Delete();

                           asset.Delete();
                       }
                   }

                   channel.Stop();
                   channel.Delete();
               }
           }
       }
    }
    </akamaisignatureheaderauthenticationkey></iprange></iprange></iprange>

    Now I want to make a method to cut a live stream for example every 15 minutes and save it as mp4 but don’t know where to start.

    Can someone point me in the right direction ?

    Kind regards

    UPDATE :

    I want to save the mp4 files on my hard disk.

  • Receive RTMP stream with OpenCV (python)

    12 février 2024, par Overnout

    I'm trying to process an RTMP stream in Python, using OpenCV2 but I'm not able to get OpenCV to capture it.

    &#xA;

    I can run FFmpeg/FFplay from the command line and receive the stream successfully.&#xA;What could cause OpenCV to fail opening the stream in listening mode ?

    &#xA;

    Here is my code :

    &#xA;

    import cv2&#xA;&#xA;cap = cv2.VideoCapture("rtmp://0.0.0.0/live/stream", cv2.CAP_FFMPEG)&#xA;&#xA;if not cap.isOpened():&#xA;    print("Cannot open video source")&#xA;    exit()&#xA;

    &#xA;

    And the output :

    &#xA;

    [tcp @ 00000192c490d640] Connection to tcp://0.0.0.0:1935 failed: Error number -138 occurred&#xA;[rtmp @ 00000192c490d580] Cannot open connection tcp://0.0.0.0:1935 Cannot open video source&#xA;

    &#xA;

    Here is the output of cv2.getBuildInformation()

    &#xA;

    General configuration for OpenCV 4.9.0 =====================================&#xA;  Version control:               4.9.0&#xA;&#xA;  Platform:&#xA;    Timestamp:                   2023-12-31T11:21:12Z&#xA;    Host:                        Windows 10.0.17763 AMD64&#xA;    CMake:                       3.24.2&#xA;    CMake generator:             Visual Studio 14 2015&#xA;    CMake build tool:            MSBuild.exe&#xA;    MSVC:                        1900&#xA;    Configuration:               Debug Release&#xA;&#xA;  CPU/HW features:&#xA;    Baseline:                    SSE SSE2 SSE3&#xA;      requested:                 SSE3&#xA;    Dispatched code generation:  SSE4_1 SSE4_2 FP16 AVX AVX2&#xA;      requested:                 SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX&#xA;      SSE4_1 (16 files):         &#x2B; SSSE3 SSE4_1&#xA;      SSE4_2 (1 files):          &#x2B; SSSE3 SSE4_1 POPCNT SSE4_2&#xA;      FP16 (0 files):            &#x2B; SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX&#xA;      AVX (8 files):             &#x2B; SSSE3 SSE4_1 POPCNT SSE4_2 AVX&#xA;      AVX2 (36 files):           &#x2B; SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2&#xA;&#xA;  C/C&#x2B;&#x2B;:&#xA;    Built as dynamic libs?:      NO&#xA;    C&#x2B;&#x2B; standard:                11&#xA;    C&#x2B;&#x2B; Compiler:                C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe  (ver 19.0.24247.2)&#xA;    C&#x2B;&#x2B; flags (Release):         /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP  /O2 /Ob2 /DNDEBUG &#xA;    C&#x2B;&#x2B; flags (Debug):           /DWIN32 /D_WINDOWS /W4 /GR  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP  /Zi /Ob0 /Od /RTC1 &#xA;    C Compiler:                  C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe&#xA;    C flags (Release):           /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /MP   /O2 /Ob2 /DNDEBUG &#xA;    C flags (Debug):             /DWIN32 /D_WINDOWS /W3  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /MP /Zi /Ob0 /Od /RTC1 &#xA;    Linker flags (Release):      /machine:x64  /NODEFAULTLIB:atlthunk.lib /INCREMENTAL:NO  /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:libcpmtd.lib /NODEFAULTLIB:msvcrtd.lib&#xA;    Linker flags (Debug):        /machine:x64  /NODEFAULTLIB:atlthunk.lib /debug /INCREMENTAL  /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcpmt.lib /NODEFAULTLIB:msvcrt.lib&#xA;    ccache:                      NO&#xA;    Precompiled headers:         YES&#xA;    Extra dependencies:          wsock32 comctl32 gdi32 ole32 setupapi ws2_32&#xA;    3rdparty dependencies:       libprotobuf ade ittnotify libjpeg-turbo libwebp libpng libtiff libopenjp2 IlmImf zlib ippiw ippicv&#xA;&#xA;  OpenCV modules:&#xA;    To be built:                 calib3d core dnn features2d flann gapi highgui imgcodecs imgproc ml objdetect photo python3 stitching video videoio&#xA;    Disabled:                    java world&#xA;    Disabled by dependency:      -&#xA;    Unavailable:                 python2 ts&#xA;    Applications:                -&#xA;    Documentation:               NO&#xA;    Non-free algorithms:         NO&#xA;&#xA;  Windows RT support:            NO&#xA;&#xA;  GUI:                           WIN32UI&#xA;    Win32 UI:                    YES&#xA;    VTK support:                 NO&#xA;&#xA;  Media I/O: &#xA;    ZLib:                        build (ver 1.3)&#xA;    JPEG:                        build-libjpeg-turbo (ver 2.1.3-62)&#xA;      SIMD Support Request:      YES&#xA;      SIMD Support:              NO&#xA;    WEBP:                        build (ver encoder: 0x020f)&#xA;    PNG:                         build (ver 1.6.37)&#xA;    TIFF:                        build (ver 42 - 4.2.0)&#xA;    JPEG 2000:                   build (ver 2.5.0)&#xA;    OpenEXR:                     build (ver 2.3.0)&#xA;    HDR:                         YES&#xA;    SUNRASTER:                   YES&#xA;    PXM:                         YES&#xA;    PFM:                         YES&#xA;&#xA;  Video I/O:&#xA;    DC1394:                      NO&#xA;    FFMPEG:                      YES (prebuilt binaries)&#xA;      avcodec:                   YES (58.134.100)&#xA;      avformat:                  YES (58.76.100)&#xA;      avutil:                    YES (56.70.100)&#xA;      swscale:                   YES (5.9.100)&#xA;      avresample:                YES (4.0.0)&#xA;    GStreamer:                   NO&#xA;    DirectShow:                  YES&#xA;    Media Foundation:            YES&#xA;      DXVA:                      YES&#xA;&#xA;  Parallel framework:            Concurrency&#xA;&#xA;  Trace:                         YES (with Intel ITT)&#xA;&#xA;  Other third-party libraries:&#xA;    Intel IPP:                   2021.11.0 [2021.11.0]&#xA;           at:                   D:/a/opencv-python/opencv-python/_skbuild/win-amd64-3.7/cmake-build/3rdparty/ippicv/ippicv_win/icv&#xA;    Intel IPP IW:                sources (2021.11.0)&#xA;              at:                D:/a/opencv-python/opencv-python/_skbuild/win-amd64-3.7/cmake-build/3rdparty/ippicv/ippicv_win/iw&#xA;    Lapack:                      NO&#xA;    Eigen:                       NO&#xA;    Custom HAL:                  NO&#xA;    Protobuf:                    build (3.19.1)&#xA;    Flatbuffers:                 builtin/3rdparty (23.5.9)&#xA;&#xA;  OpenCL:                        YES (NVD3D11)&#xA;    Include path:                D:/a/opencv-python/opencv-python/opencv/3rdparty/include/opencl/1.2&#xA;    Link libraries:              Dynamic load&#xA;&#xA;  Python 3:&#xA;    Interpreter:                 C:/hostedtoolcache/windows/Python/3.7.9/x64/python.exe (ver 3.7.9)&#xA;    Libraries:                   C:/hostedtoolcache/windows/Python/3.7.9/x64/libs/python37.lib (ver 3.7.9)&#xA;    numpy:                       C:/hostedtoolcache/windows/Python/3.7.9/x64/lib/site-packages/numpy/core/include (ver 1.17.0)&#xA;    install path:                python/cv2/python-3&#xA;&#xA;  Python (for build):            C:\hostedtoolcache\windows\Python\3.7.9\x64\python.exe&#xA;&#xA;  Java:                          &#xA;    ant:                         NO&#xA;    Java:                        YES (ver 1.8.0.392)&#xA;    JNI:                         C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk/8.0.392-8/x64/include C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk/8.0.392-8/x64/include/win32 C:/hostedtoolcache/windows/Java_Temurin-Hotspot_jdk/8.0.392-8/x64/include&#xA;    Java wrappers:               NO&#xA;    Java tests:                  NO&#xA;&#xA;  Install to:                    D:/a/opencv-python/opencv-python/_skbuild/win-amd64-3.7/cmake-install&#xA;-----------------------------------------------------------------&#xA;

    &#xA;