Recherche avancée

Médias (2)

Mot : - Tags -/plugins

Autres articles (25)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains 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, par

    Pré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 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

Sur d’autres sites (5928)

  • Duration of short ogg files (Telegram Voice messages) not correct when loaded into Python

    4 août 2018, par Kromme

    I’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 seconds

    When 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 loretoparisi

    I'm trying to run ffmpeg command with multiprocessing in parallel tasks.&#xA;My python ffmpeg call to be parallelized is the following :

    &#xA;

    def load_audio(args, kwargs):&#xA;    url = args&#xA;&#xA;    start = kwargs["start"]&#xA;    end = kwargs["end"]&#xA;    sr = kwargs["sr"]&#xA;    n_channels = kwargs["n_channels"]&#xA;    mono = kwargs["mono"]&#xA;&#xA;    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"]&#xA;&#xA;    process = subprocess.run(&#xA;        cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=10 ** 8&#xA;    )&#xA;    buffer = process.stdout&#xA;    waveform = np.frombuffer(buffer=process.stdout, dtype=np.uint16, offset=8 * 44)&#xA;    waveform = waveform.astype(dtype)&#xA;    return waveform&#xA;

    &#xA;

    I then read the audio by offset 60 seconds :

    &#xA;

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

    &#xA;

    where execute_callback will submit the thread to the pool :

    &#xA;

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

    &#xA;

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

    &#xA;

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

    &#xA;

    where get_results_as_completed is

    &#xA;

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

    &#xA;

    where I'm using the bounded pool executor class here and here.&#xA;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

    &#xA;

      &#xA;
    • Are the ffmpeg futures actually executed in parallel ? In my tests downloading the whole audio like :

      &#xA;

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

      &#xA;

    • &#xA;

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

      &#xA;

    • &#xA;

    &#xA;

  • Changing Audio Volume using FFmpeg Android Error

    23 août 2018, par kataroty

    I 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 to onSuccess() or ´onFailure(), but it always printed out the onStart() 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 to onSuccess() or onFailure().

    help me to find a solution. Thanks.