Advanced search

Medias (91)

Other articles (26)

  • Publier sur MédiaSpip

    13 June 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

  • Les statuts des instances de mutualisation

    13 March 2010, by

    Pour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
    Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...)

  • ANNEXE : Les plugins utilisés spécifiquement pour la ferme

    5 March 2010, by

    Le site central/maître de la ferme a besoin d’utiliser plusieurs plugins supplémentaires vis à vis des canaux pour son bon fonctionnement. le plugin Gestion de la mutualisation; le plugin inscription3 pour gérer les inscriptions et les demandes de création d’instance de mutualisation dès l’inscription des utilisateurs; le plugin verifier qui fournit une API de vérification des champs (utilisé par inscription3); le plugin champs extras v2 nécessité par (...)

On other websites (3867)

  • FFmpeg how to get an image for a particular 'coded_picture_number' together with motion vectors

    26 February 2018, by helmo

    I am looking for ways to get this output from ffmpeg:

    enter image description here

    Basically, I would like to pass to the shell, a command that allows me to output a particular frame number, let’s say coded_picture_number=200 with the motion vectors drawn into it.

    Any clue? Thanks in advance.

  • RTMP video streaming client without showing the video just need extensive log

    6 August 2016, by Amir

    I set up an RTMP video streaming server in a cloud environment for research purposes. On another VM in the cloud, I want to use a client to do some experiments. I have tried some different video player like VLC and FFplay but they are keep playing the video in the shell. As it is in the command line environment and to make sure my experiments are not biased with human errors, I need an RTMP video streaming client that just receives the stream as if it wanted to play it and log everything, for instance, if the playback stops due to buffering, average buffer size, etc.

    Thanks

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

    4 July 2023, by 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