Recherche avancée

Médias (0)

Mot : - Tags -/protocoles

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (88)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • MediaSPIP version 0.1 Beta

    16 avril 2011, par

    MediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (18480)

  • how would i play a large list of mp3 and wav files while showing the name of it on the screen with ffmpeg

    4 juillet 2023, par iiDk

    i've been attempting to make a video that is autogenerated using ffmpeg that plays a list of audios and while they are playing it shows the name of the audio file on the screen. i have no idea how to use ffmpeg and i abused ai for the provided script, but it's stupid and doesn't know how to properly reencode the file fixing the bugs at the end which cause the audio to only be on the left channel for no reason and then eventually cutting out.

    


    import os
import subprocess

def create_combined_video(audio_folder, output_path):
    # Get a list of audio files in the specified folder
    audio_files = []
    for filename in os.listdir(audio_folder):
        if filename.endswith(".mp3") or filename.endswith(".wav"):
            audio_files.append(os.path.join(audio_folder, filename))

    # Sort the audio files alphabetically
    audio_files.sort()

    # Create a folder to store the temporary image frames
    temp_frames_folder = "temp_frames"
    os.makedirs(temp_frames_folder, exist_ok=True)

    # Generate the image frames with the corresponding audio file names
    for index, audio_file in enumerate(audio_files):
        name = os.path.splitext(os.path.basename(audio_file))[0]
        image_path = os.path.join(temp_frames_folder, f"{index+1:06d}.jpg")

        # Use FFmpeg to create the image frame with text overlay
        ffmpeg_cmd = f'ffmpeg -y -f lavfi -i color=c=white:s=720x480:d=1 -vf "drawtext=text=\'{name}\':fontcolor=black:fontsize=36:x=(w-text_w)/2:y=(h-text_h)/2" -vframes 1 "{image_path}"'
        subprocess.run(ffmpeg_cmd, shell=True)

    # Generate a text file containing the image file names for each audio
    image_names_path = "image_names.txt"
    with open(image_names_path, "w") as file:
        for index, audio_file in enumerate(audio_files):
            image_path = os.path.join(temp_frames_folder, f"{index+1:06d}.jpg")
            duration = get_audio_duration(audio_file)
            file.write(f"file '{image_path}'\nduration {duration}\n")

    # Generate a text file containing the audio file names
    audio_names_path = "audio_names.txt" 
    with open(audio_names_path, "w") as file:
        for audio_file in audio_files:
            file.write(f"file '{audio_file}'\n")

    # Re-encode the audio files with a common codec (AAC)
    reencoded_audio_folder = "reencoded_audio"
    os.makedirs(reencoded_audio_folder, exist_ok=True)
    for index, audio_file in enumerate(audio_files):
        reencoded_audio_file = os.path.join(reencoded_audio_folder, f"{index:03d}.m4a")
        ffmpeg_cmd = f'ffmpeg -y -i "{audio_file}" -c:a aac "{reencoded_audio_file}"'
        subprocess.run(ffmpeg_cmd, shell=True)

    # Generate a text file containing the re-encoded audio file names
    reencoded_audio_names_path = "reencoded_audio_names.txt"
    with open(reencoded_audio_names_path, "w") as file:
        for index, audio_file in enumerate(audio_files):
            reencoded_audio_file = os.path.join(reencoded_audio_folder, f"{index:03d}.m4a")
            file.write(f"file '{reencoded_audio_file}'\n")

    # Use FFmpeg to generate the video with the image frames and re-encoded audio
    ffmpeg_cmd = f'ffmpeg -y -f concat -safe 0 -i "{image_names_path}" -f concat -safe 0 -i "{reencoded_audio_names_path}" -c:v libx264 -pix_fmt yuv420p -vf "scale=720:480:force_original_aspect_ratio=increase,crop=720:480" -c:a aac -shortest "{output_path}"'
    subprocess.run(ffmpeg_cmd, shell=True)

    # Clean up temporary files and folders
    os.remove(image_names_path)
    os.remove(audio_names_path)
    for image_file in os.listdir(temp_frames_folder):
        os.remove(os.path.join(temp_frames_folder, image_file))
    os.rmdir(temp_frames_folder)
    for audio_file in os.listdir(reencoded_audio_folder):
        os.remove(os.path.join(reencoded_audio_folder, audio_file))
    os.rmdir(reencoded_audio_folder)

def get_audio_duration(audio_file): 
    # Use FFprobe to get the duration of the audio file
    ffprobe_cmd = f'ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "{audio_file}"'
    result = subprocess.run(ffprobe_cmd, shell=True, capture_output=True, text=True)
    duration = float(result.stdout.strip())
    return duration

# Usage example
audio_folder = "C:/Users/Admin/Desktop/Sounds"
output_path = "C:/Users/Admin/Desktop/output.mp4"
create_combined_video(audio_folder, output_path)


    


    i've tried yelling at ai to fix the bug and all it does is break the script instead of doing what i asked it to, but i believe all it has to do is fix reencoding

    


  • FFmpeg massive data loss when writing large data and swapping segments

    25 avril 2023, par Bohdan Petrenko

    I have an ffmpeg process running which continiously writes audio data to two 30 seconds (for testing, I'm actually planning to use 5 minutes) segments. The problem is that when I write some audio data with length more than size of two segments (60 seconds), 8-17 seconds of audio is lost. Here is how I run FFmpeg and write data :

    


        _ffmpeg = Process.Start(new ProcessStartInfo
    {
        FileName = "ffmpeg",
        Arguments = 
            $"-y -f s16le -ar 48000 -ac {Channels} -i pipe:0 -c:a libmp3lame -f segment -segment_time {BufferDuration} -segment_format mp3 -segment_wrap 2 -reset_timestamps 1 -segment_list \"{_segmentListPath}\" \"{segmentName}\"",
        UseShellExecute = false,
        RedirectStandardInput = true
    })!;
    // Channels is usually 1, BufferDuration is 30


    


    And here is how I write data :

    


    public async Task WriteSilenceAsync(int amount)
{
    if (amount > _size) amount = _size; // _size is 48000 * 1 * 2 * 30 * 2 = 5760000 (size of 1 minute of audio)
    
    var silence = _silenceBuffer.AsMemory(0, amount);
    await _ffmpeg.StandardInput.BaseStream.WriteAsync(silence);
}


    


    I tried to change the ffmpeg parameters and ways I write data. But I haven't found the solution.

    


    I'm sure that the problem is caused by ffmpeg segments, because if I disable segmenting and write audio to a single file, there are no problems with data loss or audio missmatch. I also sure that amount of silence to add in WriteSilenceAsync() method is calculated right. I'm not sure if the problem appears with data length more than 30 seconds but less then 1 minute, but I think it doesn't.

    


    I don't know how to solve this problem and would be glad to see any suggestions or solutions.

    


  • Camera Rendering Buffers and Stutters When Large Video Files Being Processd with FFmpeg

    20 avril 2023, par TIANYU HU

    When rendering a real-time camera, I use ffmpeg to process a large video file(like 4G or even larger) at the same time. I noticed that the video frames are buffering and stuttering.

    


    Pipeline :

    


    DISPLAY=:0 gst-launch-1.0 filesrc location=/home/user/jellyfish-120-mbps-4k-uhd-hevc-10bit.mkv ! matroskademux name=demux demux.video_0 ! queue ! h265parse ! nvv4l2decoder ! nvvidconv ! xvimagesink

    


    FFmpeg command :

    


    ffmpeg -i ${file_name} -c copy -f segment -segment_time 600 -segment_format_options movflags=+faststart -reset_timestamps 1 ./${file_name}_%02d.mp4 -y

    


    And there are some warning indicated that “a lot of buffers are being dropped” duration stuttering.
pipeline warning picture

    


    The requirement can be summarized as “real-time video rendering has higher priority, and the low rate of large file processing is accepted”, are there any possible solutions of this issue from your perspective ? Thanks in advance.