
Recherche avancée
Médias (2)
-
Exemple de boutons d’action pour une collection collaborative
27 février 2013, par
Mis à jour : Mars 2013
Langue : français
Type : Image
-
Exemple de boutons d’action pour une collection personnelle
27 février 2013, par
Mis à jour : Février 2013
Langue : English
Type : Image
Autres articles (25)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
Ecrire une actualité
21 juin 2013, parPrésentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
Vous pouvez personnaliser le formulaire de création d’une actualité.
Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...) -
Publier sur MédiaSpip
13 juin 2013Puis-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
Sur d’autres sites (5928)
-
Duration of short ogg files (Telegram Voice messages) not correct when loaded into Python
4 août 2018, par KrommeI’m trying to read voice messages, sent by Telegram, using Python but for short voice clips (< 10 seconds), it doesn’t work. It shortens the duration for some reason. It looks like it has something to do with
OGG codec
, but I’m not really sure.See here’s my code, the voice clip is about six seconds, however
pydub
reads my 6 second voiceclip as 0.06 seconds.import telegram
from pydub import AudioSegment
AudioSegment.ffmpeg = "./dependencies/ffmpeg-20180802-c9118d4-win64-static/bin/ffmpeg"
AudioSegment.converter = "./dependencies/ffmpeg-20180802-c9118d4-win64-static/bin/ffmpeg"
bot = telegram.Bot(token=token)
f = bot.get_file(file_id)
f.download('output/voiceclips/{}.ogg'.format(file_id))
myaudio = AudioSegment.from_ogg("output/voiceclips/{}.ogg".format(file_id))
print('ID: {}, which is {} seconds'.format(file_id, myaudio.duration_seconds))
>>> ID: ______, which is 0.06 secondsWhen I open the file in
VLC-player
, it also states that is has 0 seconds. When I try to convert it to WAV-files using FFmpeg it reads the ogg file as 6 seconds, but writes it as 0.05-second WAV file.ffmpeg -i infile.ogg outfile.wav
ffmpeg version N-91549-gc9118d4d64 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 7.3.1 (GCC) 20180722
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
libavutil 56. 18.102 / 56. 18.102
libavcodec 58. 22.100 / 58. 22.100
libavformat 58. 17.101 / 58. 17.101
libavdevice 58. 4.101 / 58. 4.101
libavfilter 7. 26.100 / 7. 26.100
libswscale 5. 2.100 / 5. 2.100
libswresample 3. 2.100 / 3. 2.100
libpostproc 55. 2.100 / 55. 2.100
[ogg @ 0000020dd375ad40] 727 bytes of comment header remain
Input #0, ogg, from 'infile.ogg':
Duration: 00:00:06.03, start: 0.000000, bitrate: 20 kb/s
Stream #0:0: Audio: opus, 48000 Hz, mono, fltp
Stream mapping:
Stream #0:0 -> #0:0 (opus (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
Output #0, wav, to 'outfile.wav':
Metadata:
ISFT : Lavf58.17.101
Stream #0:0: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 48000 Hz, mono, s16, 768 kb/s
Metadata:
encoder : Lavc58.22.100 pcm_s16le
size= 6kB time=00:00:00.05 bitrate= 873.0kbits/s speed=4.12x
video:0kB audio:6kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.354167%For larger files it does the work !
-
Python running ffmpeg with multiprocessing
5 août 2021, par loretoparisiI'm trying to run
ffmpeg
command withmultiprocessing
in parallel tasks.
My pythonffmpeg
call to be parallelized is the following :

def load_audio(args, kwargs):
 url = args

 start = kwargs["start"]
 end = kwargs["end"]
 sr = kwargs["sr"]
 n_channels = kwargs["n_channels"]
 mono = kwargs["mono"]

 cmd = ["ffmpeg", "-i", url, "-acodec", "pcm_s16le", "-ac", str(n_channels), "-ar", str(sr), "-ss", _to_ffmpeg_time(start), "-t", _to_ffmpeg_time(end - start), "-sn", "-vn", "-y", "-f", "wav", "pipe:1"]

 process = subprocess.run(
 cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=10 ** 8
 )
 buffer = process.stdout
 waveform = np.frombuffer(buffer=process.stdout, dtype=np.uint16, offset=8 * 44)
 waveform = waveform.astype(dtype)
 return waveform



I then read the audio by offset
60 seconds
:

_THREAD_POOL = BoundedThreadPoolExecutor(max_workers=NTHREADS)
tasks = []
cur_start = start
for i in range(NTHREADS):
 msg = {'start':cur_start,
 'end':min(cur_start+60,end)}
 t = execute_callback(load_audio, 
 'https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_5MG.mp3', 
 msg)
 cur_start+=60
 tasks.append(t)



where
execute_callback
will submit the thread to the pool :

def execute_callback(fn, args, kwargs):
 try:
 futures_thread = _THREAD_POOL.submit(fn, args, kwargs)
 return futures_thread
 except Exception as e:
 return None



I finally retrieve the results, and concat to a
numpy
array (that will go tosoundfile
to be read)

futures_results = get_results_as_completed(tasks, return_when=ALL_COMPLETED)
waveform = []
for i,r in enumerate(futures_results):
 if not i:
 waveform = r
 print(type(r))
 else:
 waveform = np.append(waveform,r)



where
get_results_as_completed
is

def get_results_as_completed(futures, return_when=ALL_COMPLETED):
 finished = as_completed(futures)
 for f in finished:
 try:
 yield f.result()
 except Exception as e:
 pass



where I'm using the bounded pool executor class here and here.
I'm using
as_completed
to retrieve the futures in completed states, that causes the output to not be preserved in the input order, but the "completion" order, this cause the audio output to be wrong. My questions are

- 

-
Are the
ffmpeg
futures actually executed in parallel ? In my tests downloading the whole audio like :

args = 'https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_5MG.mp3'
 kwargs = {'start':start, 
 'end':end}
 waveform = load_audio(args,kwargs)



-
Is it possibile to preserve the input order for the results without using semaphores, but only
multiprocessing
functions (map
may be ?). If so, how ?







-
-
Changing Audio Volume using FFmpeg Android Error
23 août 2018, par katarotyI am using FFmpeg and I need to change the volume of the
Audio
.This is the
command
that should change the volume of the audio :ffmpeg -i input.wav -filter:a "volume=1.5" output.wav
I read from somewhere that it had to overwrite the file if it already existed so either one had to delete the file or use
-y
. When I tried to do it without the-y
command it never got toonSuccess()
or ´onFailure(), but it always printed out theonStart()
message.String[] cmdy = { "-i -y" , pcmtowavTempFile.toString(), "-af", "volume=5", pcmtowavTempFile.toString()};
ffmpeg.execute(cmdy, new ExecuteBinaryResponseHandler() {
@Override
public void onStart() {
System.out.println("ayy: onStart");
}
@Override
public void onSuccess(String message) {
System.out.println("ayy: onSuccess");
super.onSuccess(message);
}
@Override
public void onFailure(String message) {
System.out.println("ayy: onFailure " + message);
super.onFailure(message);
}
});At the moment I get this error :
ffmpeg version n4.0-39-gda39990 Copyright (c) 2000-2018 the FFmpeg developers
built with gcc 4.9.x (GCC) 20150123 (prerelease)
configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
libavutil 56. 14.100 / 56. 14.100
libavcodec 58. 18.100 / 58. 18.100
libavformat 58. 12.100 / 58. 12.100
libavdevice 58. 3.100 / 58. 3.100
libavfilter 7. 16.100 / 7. 16.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 1.100 / 5. 1.100
libswresample 3. 1.100 / 3. 1.100
libpostproc 55. 1.100 / 55. 1.100
Unrecognized option 'i -y'.Which clearly states that it does not recognize option
i -y
, but also as I said earlier then if I remove the-y
it never gets toonSuccess()
oronFailure()
.help me to find a solution. Thanks.