Recherche avancée

Médias (91)

Autres articles (112)

  • Script d’installation automatique de MediaSPIP

    25 avril 2011, par

    Afin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
    Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
    La documentation de l’utilisation du script d’installation (...)

  • Demande de création d’un canal

    12 mars 2010, par

    En fonction de la configuration de la plateforme, l’utilisateur peu avoir à sa disposition deux méthodes différentes de demande de création de canal. La première est au moment de son inscription, la seconde, après son inscription en remplissant un formulaire de demande.
    Les deux manières demandent les mêmes choses fonctionnent à peu près de la même manière, le futur utilisateur doit remplir une série de champ de formulaire permettant tout d’abord aux administrateurs d’avoir des informations quant à (...)

  • La sauvegarde automatique de canaux SPIP

    1er avril 2010, par

    Dans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
    Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...)

Sur d’autres sites (12122)

  • Optimize script commands FFMPEG with Limit CPU usage

    30 novembre 2019, par Arsal Imam

    I am working on a audio/video uploading and streaming project.

    Process :

    I have 2 audio files and a video file which I am processing with FFMPEG. I need to process these audio and video files in the below mentioned way :

    1. Generating thumbnail from the video file.

    2. Merging audio files with each other.

    3. then, merging the mixed audio file with the video file.

    4. after that, adding watermark over the video file.

    5. at last, splits video file into small chunks for streaming

    ISSUE :

    Everything is working fine but the issue is that all this process consuming very high CPU and TIME to complete. Is there anyway to optimize the FFMPEG commands to run in fastly. Right now, it is very slow !!

    CODE :

    I have created a bat file to complete the above mentioned process. Below is the source of the batch file which is executing over nodejs server.

    @echo off

    echo "########################################### Uploading Video #############################################"

    :GETOPTS
    if /I %~1 == --app-path set APP_PATH=%2& shift
    if /I %~1 == --video-name set VIDEO_NAME=%2& shift
    if /I %~1 == --do-merge set IS_DO_MERGE=%2& shift
    if /I %~1 == --audio-name set AUDIO_NAME=%2& shift
    if /I %~1 == --bg-beat-name set BEAT_NAME=%2& shift
    shift
    if not (%1)==() goto GETOPTS

    set USER_DIR=%APP_PATH%data\content\userContent\
    set BEAT_FILE_URI=%APP_PATH%data\content\beats\%BEAT_NAME%
    set FFMPEG=%APP_PATH%data\cmd\ffmpeg\bin\ffmpeg.exe
    set VIDEO_PATH=%USER_DIR%%VIDEO_NAME%
    set MERGED_AUDIO_PATH=%VIDEO_PATH%_mix_audio.aac
    set RESULTANT_PATH=%VIDEO_PATH%_finalized.mp4
    set WATER_MARKED_PATH=%VIDEO_PATH%_finalized_watermark.mp4

    echo "Taking screenshot - %VIDEO_PATH%"
    %FFMPEG% -threads 3 -loglevel panic -y -ss 00:00:01 -i %VIDEO_PATH% -vframes 1 -filter:v scale="500:-1" %VIDEO_PATH%_screenshot.jpg
    if "%IS_DO_MERGE%" == "true" (

     echo "Combining audio with music file"
     echo "OUTPUT: %MERGED_AUDIO_PATH%"
     %FFMPEG% -threads 3 -loglevel panic -y -i %USER_DIR%%AUDIO_NAME% -i %BEAT_FILE_URI% -filter_complex amix=inputs=2:duration=shortest:dropout_transition=3 -shortest %MERGED_AUDIO_PATH%

     echo "Merging Audio & video"
     %FFMPEG% -threads 3 -loglevel panic -y -i %VIDEO_PATH% -i %MERGED_AUDIO_PATH% -c:v libx264 -preset ultrafast -crf 22 -tune zerolatency -c:a aac -strict experimental -map 0:v:0 -map 1:a:0 -shortest %RESULTANT_PATH%

     echo "Adding watermark"
     %FFMPEG% -threads 3 -loglevel panic -y -i %RESULTANT_PATH% -i %APP_PATH%data\assets\watermark.png -filter_complex "overlay=x=(main_w-overlay_w)/2:y=30" -movflags +faststart %WATER_MARKED_PATH%

     #ffmpeg -i input.mp4 -profile:v baseline -level 3.0 -s 640x360 -start_number 0 -hls_time 10 -hls_list_size 0 -f hls index.m3u8

     #%FFMPEG% -threads 3 -loglevel panic -y -i %WATER_MARKED_PATH% -i %APP_PATH%data\assets\watermark.png -filter_complex "overlay=x=(main_w-overlay_w)/2:y=30" %WATER_MARKED_PATH%

     echo "--------------------------------- process completed with no errors ----------------------------------"

    ) else (
     echo "No need to merge as --do-merge is false"

     echo "Adding watermark"
     %FFMPEG% -threads 3 -loglevel panic -y -i %VIDEO_PATH% -i %APP_PATH%data\assets\watermark.png -filter_complex "overlay=x=(main_w-overlay_w)/2:y=30" %WATER_MARKED_PATH%
    )
    echo "######################################  Uploading Video Ended  ##########################################"
  • avcodec/put_bits : Make skip_put_bits() less dangerous

    31 juillet 2020, par Andreas Rheinhardt
    avcodec/put_bits : Make skip_put_bits() less dangerous
    

    Before c63c303a1f2b58677d480505ec93a90f77dd25b5 (the commit which
    introduced a typedef for the type of the buffer of a PutBitContext)
    skip_put_bits() was as follows :

    static inline void skip_put_bits(PutBitContext *s, int n)

    s->bit_left -= n ;
    s->buf_ptr -= 4 * (s->bit_left >> 5) ;
    s->bit_left &= 31 ;

    If s->bit_left was negative after the first subtraction, then the next
    line will divide this by 32 with rounding towards -inf and multiply by
    four ; the result will be negative, of course.

    The aforementioned commit changed this to :

    static inline void skip_put_bits(PutBitContext *s, int n)

    s->bit_left -= n ;
    s->buf_ptr -= sizeof(BitBuf) * ((unsigned)s->bit_left / BUF_BITS) ;
    s->bit_left &= (BUF_BITS - 1) ;

    Casting s->bit_left to unsigned meant that the rounding is still towards
    - inf ; yet the right side is now always positive (it transformed the
    arithmetic shift into a logical shift), so that s->buf_ptr will always
    be decremented (by about UINT_MAX / 8 unless n is huge) which leads to
    segfaults on further usage and is already undefined pointer arithmetic
    before that. This can be reproduced with the mpeg4 encoder with the
    AV_CODEC_FLAG2_NO_OUTPUT flag set.

    Furthermore, the earlier version as well as the new version share
    another bug : s->bit_left will be in the range of 0..(BUF_BITS - 1)
    afterwards, although the assumption throughout the other PutBitContext
    functions is that it is in the range of 1..BUF_BITS. This might lead to
    a shift by BUF_BITS in little-endian mode. This has been fixed, too.
    The new version is furthermore able to skip zero bits, too.

    Signed-off-by : Andreas Rheinhardt <andreas.rheinhardt@gmail.com>

    • [DH] libavcodec/put_bits.h
  • Audio equalizer using FFmpeg

    28 septembre 2015, par Evgeniy Kharchenko

    I’m developing audio player using FFmpeg. I want to add audio equaliqer to my app, but I don’t know how to do it. I know that FFmpeg has a FFT functions, but I have count of samples that not mutch with any power of 2. I also tried to use other FFT libraries, but I have some noise on my audio after equalization.
    Can anybody help me to understand how to use FFmpeg’s FFT functions or any oter ways to implement audio-eq using FFmpeg ?