
Recherche avancée
Autres articles (74)
-
Websites made with MediaSPIP
2 mai 2011, parThis page lists some websites based on MediaSPIP.
-
Gestion des droits de création et d’édition des objets
8 février 2011, parPar 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, parL’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 bepI 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.




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
{
 public class IncomingRtmpConnectionHandler : ConnectionHandler
 {
 private readonly ILogger<incomingrtmpconnectionhandler> logger;

 public IncomingRtmpConnectionHandler(ILogger<incomingrtmpconnectionhandler> logger)
 {
 this.logger = logger;
 }

 public override async Task OnConnectedAsync(ConnectionContext connection)
 {
 logger?.LogInformation("connection started");

 var outputFileName = @"C:\Temp\bunny.mp4";

 var rtmpPassthroughPipeName = Guid.NewGuid().ToString();
 var cmdPath = @"C:\Opt\ffmpeg\bin\ffmpeg.exe";
 var cmdArgs = $"-i pipe:{rtmpPassthroughPipeName} -preset slow -c copy -f mp4 -y pipe:1";

 var cancellationToken = connection.ConnectionClosed;
 var rtmpStream = connection.Transport;

 using (var outputStream = new FileStream(outputFileName, FileMode.Create))
 using (var cmd = Command.Run(cmdPath, options: o => { o.StartInfo(i => i.Arguments = cmdArgs); o.CancellationToken(cancellationToken); }))
 {
 // create a pipe to pass the RTMP data straight to FFMPEG. This code should be dumb to proto etc being used
 var ffmpegPassthroughStream = new NamedPipeServerStream(rtmpPassthroughPipeName, PipeDirection.InOut, 10, PipeTransmissionMode.Byte, System.IO.Pipes.PipeOptions.Asynchronous);

 // take the network stream and pass data to/from ffmpeg process
 var fromFfmpegTask = ffmpegPassthroughStream.CopyToAsync(rtmpStream.Output.AsStream(), cancellationToken);
 var toFfmpegTask = rtmpStream.Input.AsStream().CopyToAsync(ffmpegPassthroughStream, cancellationToken);

 // take the ffmpeg process output (not stdout) into target file
 var outputTask = cmd.StandardOutput.PipeToAsync(outputStream);

 while (!outputTask.IsCompleted && !outputTask.IsCanceled)
 {
 var errs = cmd.GetOutputAndErrorLines();
 logger.LogInformation(string.Join(Environment.NewLine, errs));

 await Task.Delay(1000);
 }

 CommandResult result = result = cmd.Result;

 if (result != null && result.Success)
 {
 logger.LogInformation("Created file");
 }
 else
 {
 logger.LogError(result.StandardError);
 }
 }

 logger?.LogInformation("connection closed");
 }
 }

 public class Startup
 {
 public void ConfigureServices(IServiceCollection services) { }

 public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
 {
 app.Run(async (context) =>
 {
 var log = context.RequestServices.GetRequiredService>();
 await context.Response.WriteAsync("Hello World!");
 });
 }
 }

 public class Program
 {
 public static void Main(string[] args)
 {
 CreateHostBuilder(args).Build().Run();
 }

 public static IWebHostBuilder CreateHostBuilder(string[] args) =>
 WebHost
 .CreateDefaultBuilder(args)
 .ConfigureServices(services =>
 {
 services.AddLogging(options =>
 {
 options.AddDebug().AddConsole().SetMinimumLevel(LogLevel.Information);
 });
 })
 .UseKestrel(options =>
 {
 options.ListenAnyIP(15666, builder =>
 {
 builder.UseConnectionHandler<incomingrtmpconnectionhandler>();
 });

 options.ListenLocalhost(5000);

 // HTTPS 5001
 options.ListenLocalhost(5001, builder =>
 {
 builder.UseHttps();
 });
 })
 .UseStartup<startup>();
 }
 

}
</startup></incomingrtmpconnectionhandler></incomingrtmpconnectionhandler></incomingrtmpconnectionhandler>


Questions :


- 

- Is this a valid approach, do you see any fundamental issues ?
- Is the pipe naming correct, is the convention just
pipe:someName
? - Any ideas on what specifically may be causing the
Concurrent reads are not allowed
? - If #3 is solved, does the rest of this seem valid ?










-
FFMPEG loudnorm filter does not work in combination with silenceremove filter
12 mai 2021, par MareikePI want to consistently normalize audio files for TTS model training. The output audio files should meet the following criteria :


- 

- mono channel
- sample rate of 22050 Hz
- wav format
- no silence at beginning and end of audio clip
- volume of -24 dB












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


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 commandagate=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.

This is the complete ffmpeg command I used :


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



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


import os

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



EDIT :


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


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
ffmpeg version 4.2.4-1ubuntu0.1 Copyright (c) 2000-2020 the FFmpeg developers
 built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
 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
 libavutil 56. 31.100 / 56. 31.100
 libavcodec 58. 54.100 / 58. 54.100
 libavformat 58. 29.100 / 58. 29.100
 libavdevice 58. 8.100 / 58. 8.100
 libavfilter 7. 57.100 / 7. 57.100
 libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 5.100 / 5. 5.100
 libswresample 3. 5.100 / 3. 5.100
 libpostproc 55. 5.100 / 55. 5.100
Input #0, flac, from '/home/mareike/tts_data/save/audios_flac/0a6c8520-7536-11eb-8338-b7015f354987.flac':
 Duration: 00:00:04.64, start: 0.000000, bitrate: 1090 kb/s
 Stream #0:0: Audio: flac, 44100 Hz, stereo, s32 (24 bit)
Stream mapping:
 Stream #0:0 -> #0:0 (flac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to '/home/mareike/result_0a6c8520-7536-11eb-8338-b7015f354987.wav':
 Metadata:
 ISFT : Lavf58.29.100
 Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 22050 Hz, mono, s16, 352 kb/s
 Metadata:
 encoder : Lavc58.54.100 pcm_s16le
size= 138kB time=00:00:03.19 bitrate= 353.0kbits/s speed=14.3x 
video:0kB audio:138kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.055375%



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 !


-
Anomalie #4776 (Fermé) : Plug invisible depuis svp
7 mai 2021, par Franck DHello :)
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.0Juste 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 :
- <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>);
- <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>);
- <span class="predefined">error_reporting</span>(<span class="exception">E_ALL</span>^<span class="exception">E_NOTICE</span>);
- 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>);
- <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>);
- <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>;
- <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>);
- <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>);
- <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>);
- <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>);
- <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>);
- </span>
A voir s’il y a un lien avec : https://core.spip.net/issues/4775