
Recherche avancée
Médias (91)
-
Corona Radiata
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Lights in the Sky
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Head Down
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Echoplex
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Discipline
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Letting You
26 septembre 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
Autres articles (39)
-
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Contribute to translation
13 avril 2011You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
MediaSPIP is currently available in French and English (...)
Sur d’autres sites (7562)
-
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 !


-
Is there a way to force FFMPEG to decode a video stream with alpha from a WebM video encoded with libvpx-vp9 ?
6 juillet, par DavidI have a WebM file with one video stream that was encoded with VP9 (libvpx-vp9).


I wrote a C++ program to extract the frames from the video stream and save them out as PNG's. This works fine except that the resulting PNG's are missing alpha.


If I extract the frames from the same WebM file using FFMPEG the resulting PNG's do contain alpha. Here is the output from FFMPEG :


$ ffmpeg -c:v libvpx-vp9 -i temp/anim.webm temp/output-%3d.png

[libvpx-vp9 @ 0000024732b106c0] v1.10.0-rc1-11-gcb0d8ce31
 Last message repeated 1 times
Input #0, matroska,webm, from 'temp/anim.webm':
 Metadata:
 ENCODER : Lavf58.45.100
 Duration: 00:00:04.04, start: 0.000000, bitrate: 112 kb/s
 Stream #0:0: Video: vp9 (Profile 0), yuva420p(tv), 640x480, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
 Metadata:
 alpha_mode : 1
 ENCODER : Lavc58.91.100 libvpx-vp9
 DURATION : 00:00:04.040000000



FFMPEG identifies the stream format as yuva420p.


Here is the output from my program when av_dump_format is called :


Input #0, matroska,webm, from 'temp/anim.webm':
 Metadata:
 ENCODER : Lavf58.45.100
 Duration: 00:00:04.04, start: 0.000000, bitrate: 112 kb/s
 Stream #0:0: Video: vp9 (Profile 0), yuv420p(tv), 640x480, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 1k tbn, 1k tbc (default)
 Metadata:
 alpha_mode : 1
 ENCODER : Lavc58.91.100 libvpx-vp9
 DURATION : 00:00:04.040000000



Notice that the detected stream format is yuv420p (the alpha is missing).


Does anybody know how to force the stream format to use alpha ?


My setup code resembles the following (error handling is omitted)


auto result = avformat_open_input(&formatContext, fileName.c_str(), nullptr, nullptr);
auto result = avformat_find_stream_info(formatContext, nullptr);
streamIndex = av_find_best_stream(formatContext, mediaType, -1, -1, nullptr, 0);
auto stream = formatContext->streams[streamIndex];
const auto codecIdentifier{ AV_CODEC_ID_VP9 };
auto decoder = avcodec_find_decoder(codecIdentifier);
pCodecContext = avcodec_alloc_context3(decoder);
auto result = avcodec_open2(pCodecContext, decoder, &options);
// AV_PIX_FMT_YUV420P - missing alpha
auto pixelFormat = pCodecContext->pix_fmt;



Gyan pointed out what the problem was. Here is the corrected code :


In case anybody else runs into this issue in the future here is the code (error handling omitted) :


auto formatContext = avformat_alloc_context();
formatContext->video_codec_id = AV_CODEC_ID_VP9;
const auto decoder = avcodec_find_decoder_by_name("libvpx-vp9");
formatContext->video_codec = decoder;
avformat_open_input(&formatContext, fileName.c_str(), nullptr, nullptr);
avformat_find_stream_info(formatContext.get(), nullptr);
for (unsigned int streamIndex = 0; streamIndex < formatContext->nb_streams; ++streamIndex) {
 // Displayed the stream format as yuva420p (contains alpha)
 av_dump_format(formatContext, static_cast<int>(streamIndex), fileName.toStdString().c_str(), 0);
}
</int>


Thanks,


-
Feeding raw image bytes into ffmpeg rawvideo fails with Invalid buffer size on linux only
13 février 2021, par cherouvimI have a nodejs program which generates raw (rgb24) image(s), which I then pipe into ffmpeg so it saves as png or mp4. My code looks like this :


const fs = require("fs");
// ...
const outputBuffer = Buffer.alloc(outputPngWidth * 3 * outputPngHeight);
// ... write data into outputBuffer
fs.writeSync(process.stdout.fd, outputBuffer);



I then do the following in CLI :


node generate | ffmpeg -f rawvideo -pixel_format rgb24 -video_size 1000x1000 -i - test.png



Alternatively, if I generate lots of images from my program, I do this to generate the video file :


node generate | ffmpeg -f rawvideo -pixel_format rgb24 -video_size 1000x1000 -r 60 -i - -codec:v libx265 test.mp4



On windows this works flawlessly. On linux (either on Ubuntu 20 VM, or Ubuntu 20 installed directly on a physical machine), it consistently fails with :


pipe:: corrupt input packet in stream 0
[rawvideo @ 0x55f5256c8040] Invalid buffer size, packet size 65536 < expected frame_size 3000000
Error while decoding stream #0:0: Invalid argument



If I split this in 2 phases like so, then it works perfectly on linux as well :


node generate > test.raw
cat test.raw | ffmpeg -f rawvideo -pixel_format rgb24 -video_size 1000x1000 -i - test.png



By looking at the error "packet size 65536 < expected frame_size 3000000" it seems that node's
fs.writeSync
only sends 65536 bytes at a time, but ffmpeg expects 3000000 bytes (that is 1000 width * 1000 height * 3 channels).

If I reduce my image size to something small, e.g 50x50 or 100x100, then it works. As soon as
x * y * 3
exceeds 65536, it fails (eg. 160x160 fails with "packet size 65536 < expected frame_size 76800" because 160 * 160 * 3 = 76800).

What I've tried so far to solve the issue without luck :


- 

- Force node to spit out the whole buffer at once :




fs.writeSync(process.stdout.fd, outputBuffer, 0, outputBuffer.length);



- 

- All suggestions of Add a big buffer to a pipe between two commands with various linux commands to buffer between
node
andffmpeg
. - Use Ubuntu 18 instead of 20.
- Use node 12 instead of 15.
- Figure out a way to change the chunk size in https://nodejs.org/api/fs.html










Is there a way to overcome this ?