Recherche avancée

Médias (91)

Autres articles (77)

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • 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

  • List of compatible distributions

    26 avril 2011, par

    The table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
    If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)

Sur d’autres sites (5968)

  • Batch generating spectrograms with ffmpeg or SoX : how to customize their appearance, and is my code so far correct ?

    4 mai 2024, par Mark I

    I have a .flac music library, and for organizational and quality assessment reasons I want to have spectrograms of every song in it. After finding out that the program I usually use to view them, Spek, doesn't offer a batch export option, I have found ways to batch generate spectrograms with both SoX and fmpeg. Below you can find the two scripts I've got, which take as an input a folder which contains flac files or subfolders containing flac files, and output their spectrograms (with the same names as their corresponding flacs) to an output folder with the same structure as the input folder :

    


    SoX :

    


    @echo off
setlocal enabledelayedexpansion

REM Root folder containing flac files
set "root_folder=%~1"

REM Output folder for spectrogram images
set "output_folder=0. Spectrograms"

REM Create the output folder if it doesn't exist
mkdir "%output_folder%" 2>nul

REM Loop through all flac files recursively
for /r "%root_folder%" %%F in (*.flac) do (
    REM Get the directory of the flac file
    set "directory=%%~dpF"

    REM Get the relative path of the directory from the root folder
    set "relative_path=!directory:%root_folder%\=!"

    REM Create the corresponding subfolder in the output folder
    mkdir "%output_folder%\!relative_path!" 2>nul

    REM Get the filename without extension
    set "filename=%%~nF"

    REM Get the filename with full path
    set "filename_with_path=%%F"

    REM Generate spectrogram image using sox
    sox "%%F" -n spectrogram -x 640 -y 360 -t "!filename_with_path!" -o "%output_folder%\!relative_path!\!filename!.png"
)



    


    It's slow but it works as intended, this is what the output looks like :

    


    ffmpeg :

    


    @echo off
SETLOCAL ENABLEDELAYEDEXPANSION

:: The root directory of the input files
SET "rootdir=%~1"

:: The output directory where the spectrograms will be saved
SET "outputdir=%rootdir%\0. Spectrograms"

:: Function to create spectrograms recursively
CALL :processFolder "%rootdir%"

GOTO :EOF

:processFolder
FOR /D %%D IN ("%~1\*") DO (
    SET "subdir=%%D"
    SET "spectrodir=!subdir:%rootdir%=%outputdir%!"
    IF NOT EXIST "!spectrodir!" MKDIR "!spectrodir!"
    CALL :processFolder "%%D"
)

FOR %%F IN ("%~1\*.flac") DO (
    SET "filename=%%~nxF"
    SET "spectroname=!filename:.flac=.png!"
    SET "spectropath=!spectrodir!\!spectroname!"
    ffmpeg -i "%%F" -lavfi showspectrumpic=s=1280x720 "!spectropath!"
)
GOTO :EOF


    


    It's much faster, and this is what it outputs :

    


    I added them to the Windows Send To folder, and use both by right clicking the folder containing the subfolders with the flacs, then Send To and then the script I want to use.

    


    I have 3 questions :

    


      

    1. Is my code as optimized as it could be ? Is everything correct ? And is it "folder structure agnostic" ? When outputting the spectrograms will the scripts mimic the structure of the input folder in all cases, or are there flaws in the code that would prevent them from being able to do it in some cases (i.e. if the .flac files are 3 layers under the input folder or something like that) ?
    2. 


    3. How do I modify the function calls at each of these scripts (whichever approach I stick with, I'm leaning towards ffmpeg cause it's much faster and appears to be better supported) to have the spectrogram image include some info about the file, customize its font, x axis time format, and other things ? I want it look like what Spek outputs as much as possible. Can't find much in the documentation of SoX and ffmpeg, but Spek uses ffmpeg as its backend right ?
    4. 


    5. Is it recommended to show both channels on the spectrograms, like the SoX script does, or is one sufficient for my purposes ?
    6. 


    


  • Why process output reader returns null data ? When same code in other process works correct

    26 août 2019, par Владимир Водов

    I try to get output from ffmpeg process but cant get output.
    In another processes and commands it works correctly but output returns immideately when start !

           using (var process = new Process())
           {
               process.StartInfo = new ProcessStartInfo()
               {
                   FileName = LinkHelper.IPFS_PATH,
                   Arguments = cmd,
                   UseShellExecute = false,
                   CreateNoWindow = true,
                   RedirectStandardOutput = true
               };

               process.ErrorDataReceived += FfmpegErrorRecieved;
               process.Start();

               using (StreamReader reader = process.StandardOutput)
               {
                   string output = await reader.ReadToEndAsync();
                   Console.WriteLine(output);
               }              
               process.WaitForExit();
           }

    Before output handle !

    Update :
    As szatmary said ffmpeg use output error instead standard output, so when you initialize process.StandartInfo don’t forget initialize property "RedirectStandardError" to TRUE !

    Here is correct code :

    private async Task DetectFFmpegCamerasAsync()
       {
           var cmd = "-list_devices true -f dshow -i dummy";
           using (var process = new Process())
           {
               process.StartInfo = new ProcessStartInfo()
               {
                   FileName = LinkHelper.FFMPEG_PATH,
                   Arguments = cmd,
                   UseShellExecute = false,
                   CreateNoWindow = true,
                   RedirectStandardError = true
               };

               process.Start();

               using (StreamReader reader = process.StandardError)
               {
                   string output = await reader.ReadToEndAsync();
                   Console.WriteLine($"Camera detection output: \n {output}");
               }              
               process.WaitForExit();
           }
       }
  • avcodec/nvenc : set correct error code

    27 novembre 2017, par Pan Bian
    avcodec/nvenc : set correct error code
    

    In function process_output_surface(), the return value is 0 on the path
    that av_mallocz() returns a NULL pointer. 0 indicates success, which
    deviates from the fact. Return "AVERROR(ENOMEM)" instead of "0".

    Signed-off-by : Pan Bian <bianpan2016@163.com>
    Signed-off-by : Timo Rothenpieler <timo@rothenpieler.org>

    • [DH] libavcodec/nvenc.c