Recherche avancée

Médias (0)

Mot : - Tags -/navigation

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

Autres articles (74)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Gestion des droits de création et d’édition des objets

    8 février 2011, par

    Par défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (10557)

  • offloading to ffmpeg via named pipes in c#/dotnet core

    1er avril 2022, par bep

    I tried to break this down to the base elements so I hope this is clear. I want to take in a network stream, it may be a 1 way, it may be a protocol that requires 2 way communication, such as RTMP during handshake.

    


    I want to pass that stream straight through to a spawned FFMPEG process. I then want to capture the output of FFMPEG, in this example I just want to pipe it out to a file. The file is not my end goal, but for simplicity if I can get that far I think I'll be ok.

    


    enter image description here

    


    I want the code to be as plain as possible and offload the core processing to FFMPEG. If I ask FFMPEG to output webrtc stream, a file, whatever, I just want to capture that. FFMPEG shouldn't be used directly, just indirectly via IncomingConnectionHandler.

    


    Only other component is OBS, which I am using to create the RTMP stream coming in.

    


    As things stand now, running this results in the following error, which I'm a little unclear on. I don't feel like I'm causing concurrent reads at any point.

    


    System.InvalidOperationException: Concurrent reads are not allowed
         at Medallion.Shell.Throw`1.If(Boolean condition, String message)
         at Medallion.Shell.Streams.Pipe.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, TimeSpan timeout, CancellationToken cancellationToken)
         at Medallion.Shell.Streams.Pipe.PipeOutputStream.ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken)
         at System.IO.Stream.ReadAsync(Memory`1 buffer, CancellationToken cancellationToken)
         at System.IO.StreamReader.ReadBufferAsync(CancellationToken cancellationToken)
         at System.IO.StreamReader.ReadLineAsyncInternal()
         at Medallion.Shell.Streams.MergedLinesEnumerable.GetEnumeratorInternal()+MoveNext()
         at System.String.Join(String separator, IEnumerable`1 values)
         at VideoIngest.IncomingRtmpConnectionHandler.OnConnectedAsync(ConnectionContext connection) in Program.cs:line 55
         at Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure.KestrelConnection`1.ExecuteAsync()


    


    Code :

    


    namespace VideoIngest&#xA;{&#xA;    public class IncomingRtmpConnectionHandler : ConnectionHandler&#xA;    {&#xA;        private readonly ILogger<incomingrtmpconnectionhandler> logger;&#xA;&#xA;        public IncomingRtmpConnectionHandler(ILogger<incomingrtmpconnectionhandler> logger)&#xA;        {&#xA;            this.logger = logger;&#xA;        }&#xA;&#xA;        public override async Task OnConnectedAsync(ConnectionContext connection)&#xA;        {&#xA;            logger?.LogInformation("connection started");&#xA;&#xA;            var outputFileName = @"C:\Temp\bunny.mp4";&#xA;&#xA;            var rtmpPassthroughPipeName = Guid.NewGuid().ToString();&#xA;            var cmdPath = @"C:\Opt\ffmpeg\bin\ffmpeg.exe";&#xA;            var cmdArgs = $"-i pipe:{rtmpPassthroughPipeName} -preset slow -c copy -f mp4 -y pipe:1";&#xA;&#xA;            var cancellationToken = connection.ConnectionClosed;&#xA;            var rtmpStream = connection.Transport;&#xA;&#xA;            using (var outputStream = new FileStream(outputFileName, FileMode.Create))&#xA;            using (var cmd = Command.Run(cmdPath, options: o => { o.StartInfo(i => i.Arguments = cmdArgs); o.CancellationToken(cancellationToken); }))&#xA;            {&#xA;                // create a pipe to pass the RTMP data straight to FFMPEG. This code should be dumb to proto etc being used&#xA;                var ffmpegPassthroughStream = new NamedPipeServerStream(rtmpPassthroughPipeName, PipeDirection.InOut, 10, PipeTransmissionMode.Byte, System.IO.Pipes.PipeOptions.Asynchronous);&#xA;&#xA;                // take the network stream and pass data to/from ffmpeg process&#xA;                var fromFfmpegTask = ffmpegPassthroughStream.CopyToAsync(rtmpStream.Output.AsStream(), cancellationToken);&#xA;                var toFfmpegTask = rtmpStream.Input.AsStream().CopyToAsync(ffmpegPassthroughStream, cancellationToken);&#xA;&#xA;                // take the ffmpeg process output (not stdout) into target file&#xA;                var outputTask = cmd.StandardOutput.PipeToAsync(outputStream);&#xA;&#xA;                while (!outputTask.IsCompleted &amp;&amp; !outputTask.IsCanceled)&#xA;                {&#xA;                    var errs = cmd.GetOutputAndErrorLines();&#xA;                    logger.LogInformation(string.Join(Environment.NewLine, errs));&#xA;&#xA;                    await Task.Delay(1000);&#xA;                }&#xA;&#xA;                CommandResult result = result = cmd.Result;&#xA;&#xA;                if (result != null &amp;&amp; result.Success)&#xA;                {&#xA;                    logger.LogInformation("Created file");&#xA;                }&#xA;                else&#xA;                {&#xA;                    logger.LogError(result.StandardError);&#xA;                }&#xA;            }&#xA;&#xA;            logger?.LogInformation("connection closed");&#xA;        }&#xA;    }&#xA;&#xA;    public class Startup&#xA;    {&#xA;        public void ConfigureServices(IServiceCollection services) { }&#xA;&#xA;        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)&#xA;        {&#xA;            app.Run(async (context) =>&#xA;            {&#xA;                var log = context.RequestServices.GetRequiredService>();&#xA;                await context.Response.WriteAsync("Hello World!");&#xA;            });&#xA;        }&#xA;    }&#xA;&#xA;    public class Program&#xA;    {&#xA;        public static void Main(string[] args)&#xA;        {&#xA;            CreateHostBuilder(args).Build().Run();&#xA;        }&#xA;&#xA;        public static IWebHostBuilder CreateHostBuilder(string[] args) =>&#xA;            WebHost&#xA;                .CreateDefaultBuilder(args)&#xA;                .ConfigureServices(services =>&#xA;                {&#xA;                    services.AddLogging(options =>&#xA;                    {&#xA;                        options.AddDebug().AddConsole().SetMinimumLevel(LogLevel.Information);&#xA;                    });&#xA;                })&#xA;                .UseKestrel(options =>&#xA;                {&#xA;                    options.ListenAnyIP(15666, builder =>&#xA;                    {&#xA;                        builder.UseConnectionHandler<incomingrtmpconnectionhandler>();&#xA;                    });&#xA;&#xA;                    options.ListenLocalhost(5000);&#xA;&#xA;                    // HTTPS 5001&#xA;                    options.ListenLocalhost(5001, builder =>&#xA;                    {&#xA;                        builder.UseHttps();&#xA;                    });&#xA;                })&#xA;                .UseStartup<startup>();&#xA;    }&#xA;    &#xA;&#xA;}&#xA;</startup></incomingrtmpconnectionhandler></incomingrtmpconnectionhandler></incomingrtmpconnectionhandler>

    &#xA;

    Questions :

    &#xA;

      &#xA;
    1. Is this a valid approach, do you see any fundamental issues ?
    2. &#xA;

    3. Is the pipe naming correct, is the convention just pipe:someName ?
    4. &#xA;

    5. Any ideas on what specifically may be causing the Concurrent reads are not allowed ?
    6. &#xA;

    7. If #3 is solved, does the rest of this seem valid ?
    8. &#xA;

    &#xA;

  • FFMPEG loudnorm filter does not work in combination with silenceremove filter

    12 mai 2021, par MareikeP

    I want to consistently normalize audio files for TTS model training. The output audio files should meet the following criteria :

    &#xA;

      &#xA;
    1. mono channel
    2. &#xA;

    3. sample rate of 22050 Hz
    4. &#xA;

    5. wav format
    6. &#xA;

    7. no silence at beginning and end of audio clip
    8. &#xA;

    9. volume of -24 dB
    10. &#xA;

    &#xA;

    I have already fulfilled the first 4 criteria. So far, it works properly.

    &#xA;

    Normalizing the volume basically works as well with this ffmpeg command -af loudnorm=I=-24:LRA=11:TP=-1.5 , but not in combination with the silence removal : As soon as I remove silence with this ffmpeg command agate=threshold=0.045:attack=0.5:release=500:ratio=5000,silenceremove=start_periods=1:start_threshold=0.0075,areverse,silenceremove=start_periods=1:start_threshold=0.0075,areverse, the loudness normalization does not work any longer : the output volume now varies between -25dB and -32dB instead of the desired -24 dB.

    &#xA;

    This is the complete ffmpeg command I used :

    &#xA;

    ffmpeg -i filename.flac -ac 1 -af agate=threshold=0.045:attack=0.5:release=500:ratio=5000,silenceremove=start_periods=1:start_threshold=0.0075,areverse,silenceremove=start_periods=1:start_threshold=0.0075,areverse,loudnorm=I=-24:LRA=11:TP=-1.5,aresample=22050 -y -hide_banner filename.wav&#xA;

    &#xA;

    And this is the piece of code that I'm using to run it :

    &#xA;

    import os&#xA;&#xA;INPUT_DIR = &#x27;/home/username/all_data&#x27;&#xA;OUTPUT_DIR = &#x27;/home/username/normalized_data&#x27;&#xA;for filename in os.listdir(INPUT_DIR):&#xA;    wav_filename = filename[:-5] &#x2B; &#x27;.wav&#x27;&#xA;    command = (f&#x27;ffmpeg -i {INPUT_DIR}/{filename} -ac 1 -af agate=&#x27;&#xA;               f&#x27;threshold=0.045:attack=0.5:release=500:ratio=5000,&#x27;&#xA;               f&#x27;silenceremove=start_periods=1:start_threshold=0.0075,&#x27;&#xA;               f&#x27;areverse,silenceremove=start_periods=1:start_threshold=&#x27;&#xA;               f&#x27;0.0075,areverse,loudnorm=I=-24:LRA=11:TP=-1.5,aresample&#x27;&#xA;               f&#x27;=22050 -y -hide_banner {OUTPUT_DIR}/{wav_filename}&#x27;)&#xA;    os.system(command)&#xA;

    &#xA;

    EDIT :

    &#xA;

    A complete log from the ffmpeg command can be seen here :

    &#xA;

    username@pop-os:~$ ffmpeg -i /home/username/audios/filename.flac -ac 1 -af agate=threshold=0.045:attack=0.5:release=500:ratio=5000,silenceremove=start_periods=1:start_threshold=0.0075,areverse,silenceremove=start_periods=1:start_threshold=0.0075,areverse,loudnorm=I=-24:LRA=11:TP=-1.5,aresample=22050 /home/username/result.wav&#xA;ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)&#xA;  configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared&#xA;  libavutil      56. 31.100 / 56. 31.100&#xA;  libavcodec     58. 54.100 / 58. 54.100&#xA;  libavformat    58. 29.100 / 58. 29.100&#xA;  libavdevice    58.  8.100 / 58.  8.100&#xA;  libavfilter     7. 57.100 /  7. 57.100&#xA;  libavresample   4.  0.  0 /  4.  0.  0&#xA;  libswscale      5.  5.100 /  5.  5.100&#xA;  libswresample   3.  5.100 /  3.  5.100&#xA;  libpostproc    55.  5.100 / 55.  5.100&#xA;Input #0, flac, from &#x27;/home/mareike/tts_data/save/audios_flac/0a6c8520-7536-11eb-8338-b7015f354987.flac&#x27;:&#xA;  Duration: 00:00:04.64, start: 0.000000, bitrate: 1090 kb/s&#xA;    Stream #0:0: Audio: flac, 44100 Hz, stereo, s32 (24 bit)&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))&#xA;Press [q] to stop, [?] for help&#xA;Output #0, wav, to &#x27;/home/mareike/result_0a6c8520-7536-11eb-8338-b7015f354987.wav&#x27;:&#xA;  Metadata:&#xA;    ISFT            : Lavf58.29.100&#xA;    Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, mono, s16, 352 kb/s&#xA;    Metadata:&#xA;      encoder         : Lavc58.54.100 pcm_s16le&#xA;size=     138kB time=00:00:03.19 bitrate= 353.0kbits/s speed=14.3x    &#xA;video:0kB audio:138kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.055375%&#xA;

    &#xA;

    Can anyone tell me what I'm doing wrong and how I can finally get the volume normalized to -24 dB (in combination with silence removal) ? Any help is appreciated, thank you very much !

    &#xA;

  • Anomalie #4776 (Fermé) : Plug invisible depuis svp

    7 mai 2021, par Franck D

    Hello :)

    Firefox 88.0.1
    SPIP 4.0.0-alpha GIT [master : 42d36eda]

    Laragon avec :
    php 8.0.3
    Apache 2.4.46
    MySQL 8.0.23
    phpMyAdmin 5.1.0

    Juste pour dire qu’il y a pleins de warning au moment de l’installation et que le plug n’ai pas visible dans "svp" une fois l’installation fini (voir copie d’écran) alors qu’il est bien présent dans le dossier plugins-dist

    A savoir que j’ai un fichier mes_options avec dedans :

    1. <span class="CodeRay"><span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_NO_CACHE</span><span class="delimiter">'</span></span>, -<span class="integer">1</span>);
    2. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_INTERDIRE_COMPACTE_HEAD_ECRIRE</span><span class="delimiter">'</span></span>, <span class="predefined-constant">true</span>);
    3. <span class="predefined">error_reporting</span>(<span class="exception">E_ALL</span>^<span class="exception">E_NOTICE</span>);
    4. ini_set (<span class="string"><span class="delimiter">"</span><span class="content">display_errors</span><span class="delimiter">"</span></span>, <span class="string"><span class="delimiter">"</span><span class="content">On</span><span class="delimiter">"</span></span>);
    5. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">SPIP_ERREUR_REPORT</span><span class="delimiter">'</span></span>,<span class="exception">E_ALL</span>);
    6. <span class="predefined">$GLOBALS</span>[<span class="string"><span class="delimiter">'</span><span class="content">taille_des_logs</span><span class="delimiter">'</span></span>] = <span class="integer">500</span>;
    7. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_MAX_LOG</span><span class="delimiter">'</span></span>, <span class="integer">500000</span>);
    8. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_LOG_FILELINE</span><span class="delimiter">'</span></span>,<span class="predefined-constant">true</span>);
    9. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_LOG_FILTRE_GRAVITE</span><span class="delimiter">'</span></span>,<span class="integer">8</span>);
    10. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_DEBUG_SLOW_QUERIES</span><span class="delimiter">'</span></span>, <span class="predefined-constant">true</span>);
    11. <span class="predefined">define</span>(<span class="string"><span class="delimiter">'</span><span class="content">_BOUCLE_PROFILER</span><span class="delimiter">'</span></span>, <span class="integer">5000</span>);
    12. </span>

    Télécharger

    A voir s’il y a un lien avec : https://core.spip.net/issues/4775