Recherche avancée

Médias (1)

Mot : - Tags -/artwork

Autres articles (52)

  • Récupération d’informations sur le site maître à l’installation d’une instance

    26 novembre 2010, par

    Utilité
    Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
    Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

Sur d’autres sites (4345)

  • Have an error running one PowerShell script to concatenate avi files, when a very similar script works fine

    1er juillet 2023, par hw22s

    When I run the following PowerShell script, to concatenate the .avi files in a folder, I get an error.

    


    Script :

    


    # Set the folder path where the AVI files are located
$folderPath = "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam"

# Get all AVI files in the folder
$aviFiles = Get-ChildItem -Path $folderPath -Filter "*.avi" | Sort-Object Name

# Check if there are at least 2 AVI files for concatenation
if ($aviFiles.Count -ge 2) {
    $videoFiles = $aviFiles.FullName

    Write-Host "Input Files for Concatenation:"
    foreach ($file in $aviFiles) {
        Write-Host $file.Name
    }

    $outputFile = Join-Path -Path $folderPath -ChildPath "concatenated.avi"

    # Create the FFmpeg command for concatenation
    $concatArguments = "-f", "concat", "-i", "`"concat:$videoFiles`"", "-c", "copy", "`"$outputFile`""

    $command = "ffmpeg $concatArguments"
    Write-Host "FFmpeg Command: $command"

    try {
        $process = Start-Process -FilePath "ffmpeg" -ArgumentList $concatArguments -NoNewWindow -PassThru -Wait -ErrorAction Stop
        Write-Host "Concatenation complete. Output file: $outputFile"
    } catch {
        Write-Host "Error occurred while executing FFmpeg command:"
        Write-Host "Error message: $($_.Exception.Message)"
    }
} else {
    Write-Host "Not enough AVI files found in the folder for concatenation."
}


    


    Output with error, (and no concatenated file is actually produced, needless to say) :

    


    Input Files for Concatenation:
webcam0.avi
webcam1.avi
FFmpeg Command: ffmpeg -f concat -i "concat:C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\webcam0.avi C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\webcam1.avi" -c copy "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\concatenated.avi"
ffmpeg version 2023-06-27-git-9b6d191a66-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58. 13.101 / 58. 13.101
  libavcodec     60. 21.100 / 60. 21.100
  libavformat    60.  9.100 / 60.  9.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  8.102 /  9.  8.102
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[in#0 @ 000001d2f05f1b00] Error opening input: Invalid argument
Concatenation complete. Output file: C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\concatenated.avi


    


    But this script, which ostensibly does the same thing to the same files, works fine :

    


    $file1 = "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\webcam0.avi"       # Path to the first video file
$file2 = "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\webcam1.avi"       # Path to the second video file
$outputFile = "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\concat.avi"  # Path to the output concatenated video file

# Create a temporary batch script
$batchScriptPath = [System.IO.Path]::GetTempFileName() + ".bat"
@'
@echo off
ffmpeg -i "%~1" -i "%~2" -filter_complex "[0:v][1:v]concat=n=2:v=1[outv]" -map "[outv]" "%~3"
'@ | Set-Content -Path $batchScriptPath

# Execute the temporary batch script
try {
    & $batchScriptPath $file1 $file2 $outputFile
    Write-Host "Concatenation complete. Output file: $outputFile"
} catch {
    Write-Host "Error occurred while executing FFmpeg command:"
    Write-Host $_.Exception.Message
}

# Remove the temporary batch script
Remove-Item -Path $batchScriptPath -Force


    


    I can't figure out what is wrong with the first script. I tried many variations of the first script but cannot get it to work.

    


    Any help ?

    


  • Have an error running one batch script to concatenate avi files, when a very similar script works fine

    1er juillet 2023, par hw22s

    When I run the following bath script to concatenate the .avi files in a folder, I get an error. I am using powershell on a windows computer
Script :

    


    # Set the folder path where the AVI files are located
$folderPath = "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam"

# Get all AVI files in the folder
$aviFiles = Get-ChildItem -Path $folderPath -Filter "*.avi" | Sort-Object Name

# Check if there are at least 2 AVI files for concatenation
if ($aviFiles.Count -ge 2) {
    $videoFiles = $aviFiles.FullName

    Write-Host "Input Files for Concatenation:"
    foreach ($file in $aviFiles) {
        Write-Host $file.Name
    }

    $outputFile = Join-Path -Path $folderPath -ChildPath "concatenated.avi"

    # Create the FFmpeg command for concatenation
    $concatArguments = "-f", "concat", "-i", "`"concat:$videoFiles`"", "-c", "copy", "`"$outputFile`""

    $command = "ffmpeg $concatArguments"
    Write-Host "FFmpeg Command: $command"

    try {
        $process = Start-Process -FilePath "ffmpeg" -ArgumentList $concatArguments -NoNewWindow -PassThru -Wait -ErrorAction Stop
        Write-Host "Concatenation complete. Output file: $outputFile"
    } catch {
        Write-Host "Error occurred while executing FFmpeg command:"
        Write-Host "Error message: $($_.Exception.Message)"
    }
} else {
    Write-Host "Not enough AVI files found in the folder for concatenation."
}



    


    Output with error (and no concatenated file is actually produced, needless to say) :

    


    Input Files for Concatenation:
webcam0.avi
webcam1.avi
FFmpeg Command: ffmpeg -f concat -i "concat:C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\webcam0.avi C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\webcam1.avi" -c copy "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\concatenated.avi"
ffmpeg version 2023-06-27-git-9b6d191a66-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58. 13.101 / 58. 13.101
  libavcodec     60. 21.100 / 60. 21.100
  libavformat    60.  9.100 / 60.  9.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  8.102 /  9.  8.102
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100
[in#0 @ 000001d2f05f1b00] Error opening input: Invalid argument
Concatenation complete. Output file: C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\concatenated.avi


    


    But this script, which ostensibly does the same thing to the same files, works fine :

    


    $file1 = "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\webcam0.avi"       # Path to the first video file
$file2 = "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\webcam1.avi"       # Path to the second video file
$outputFile = "C:\Users\HomePC\hswlab\Desktop\videos\eyeblink\022223\2023_04_24\16_15_23\My_WebCam\concat.avi"  # Path to the output concatenated video file

# Create a temporary batch script
$batchScriptPath = [System.IO.Path]::GetTempFileName() + ".bat"
@'
@echo off
ffmpeg -i "%~1" -i "%~2" -filter_complex "[0:v][1:v]concat=n=2:v=1[outv]" -map "[outv]" "%~3"
'@ | Set-Content -Path $batchScriptPath

# Execute the temporary batch script
try {
    & $batchScriptPath $file1 $file2 $outputFile
    Write-Host "Concatenation complete. Output file: $outputFile"
} catch {
    Write-Host "Error occurred while executing FFmpeg command:"
    Write-Host $_.Exception.Message
}

# Remove the temporary batch script
Remove-Item -Path $batchScriptPath -Force



    


    I can't figure out what is wrong with the first script. Any help ?? Thank you !!

    


    Tried many variations on the first script but cannot get it to work.

    


  • Convert from oga to mp3 using pydub : ffmpeg returned error code : 1

    29 juin 2023, par Juan David

    I want to take an OGA file within a binary stream and convert it into mp3 using also another stream. I'm getting a permissions error even with running VSCode as administrator. This is my code :

    


    from pydub import AudioSegment
AudioSegment.converter = "C:\\ProgramData\\chocolatey\\lib\\ffmpeg\\tools\\ffmpeg\\bin\\ffmpeg.exe"

input_stream = io.BytesIO()
input_stream.seek(0) 
await new_file.download_to_memory(input_stream)
 
# Create an audio segment from the binary stream
audio = AudioSegment.from_file(input_stream, format='ogg')

# Create an output stream for the MP3 data
output_stream = io.BytesIO()

# Export the audio to MP3 using ffmpeg and write the output to the stream
audio.export(output_stream, format='mp3', codec='libmp3lame')

# Get the MP3 data from the output stream
mp3_data = output_stream.getvalue()


    


    Error message :

    


      File "C:\ProgramData\Anaconda3\envs\chatbot\lib\site-packages\telegram\ext\_application.py", line 1124, in process_update
    await coroutine
  File "C:\ProgramData\Anaconda3\envs\chatbot\lib\site-packages\telegram\ext\_handler.py", line 141, in handle_update
    return await self.callback(update, context)
  File "c:\Users\jdbol\OneDrive\Desktop\testbots\echobot.py", line 80, in voice_to_text
    audio = AudioSegment.from_file(input_stream, format='ogg')
  File "C:\ProgramData\Anaconda3\envs\chatbot\lib\site-packages\pydub\audio_segment.py", line 773, in from_file     
    raise CouldntDecodeError(
pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1

Output from ffmpeg/avlib:

ffmpeg version 6.0-essentials_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-zlib --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-sdl2 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libgme --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libtheora --enable-libvo-amrwbenc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-librubberband
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
fd:: End of file


    


    I ran the command in a terminal and the file converted without an issue :

    


    ffmpeg -i .\file_12.oga output.mp3 


    


      

    1. I'm not sure if the .exe file must be included into the path. When I don't do it, What I get is a permissions error.
    2. 


    3. What other codecs can be used here ?
    4. 


    5. Is it possible to use oga files ? I tried to declare this but I got an 'Unknown input format : 'oga' message (audio = AudioSegment.from_file(input_stream, format='oga'))
    6. 


    


    Thanks !

    


    UPDATE : I created a more simple version that is not using a binary stream and worked like a charm, so we know for sure that something is happening with the BytesIO object

    


    async def voice_to_text(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
    # Get the absolute path of the script
    filename = 'file_9.oga'
    script_dir = os.path.dirname(os.path.abspath(__file__))

    # Construct the file paths for input and output files
    input_file_path = os.path.join(script_dir, filename)
    output_file_path = os.path.join(script_dir, os.path.splitext(filename)[0] + ".mp3")

    # Load the OGA audio file
    audio = AudioSegment.from_file(input_file_path, format='ogg')

    # Export the audio to MP3 format
    audio.export(output_file_path, format='mp3')

    print("Conversion complete. MP3 file saved as:", output_file_path)


    


    UPDATE 2 : It seems like await new_file.download_to_memory(input_stream) is the problematic line. I tried to save the file and its corrupt. Not sure how to use this method then.

    


    https://docs.python-telegram-bot.org/en/stable/telegram.file.html#telegram.File.download_to_memory