Recherche avancée

Médias (1)

Mot : - Tags -/ogg

Autres articles (29)

  • Les statuts des instances de mutualisation

    13 mars 2010, par

    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 (...)

  • Other interesting software

    13 avril 2011, par

    We don’t claim to be the only ones doing what we do ... and especially not to assert claims to be the best either ... What we do, we just try to do it well and getting better ...
    The following list represents softwares that tend to be more or less as MediaSPIP or that MediaSPIP tries more or less to do the same, whatever ...
    We don’t know them, we didn’t try them, but you can take a peek.
    Videopress
    Website : http://videopress.com/
    License : GNU/GPL v2
    Source code : (...)

  • L’espace de configuration de MediaSPIP

    29 novembre 2010, par

    L’espace de configuration de MediaSPIP est réservé aux administrateurs. Un lien de menu "administrer" est généralement affiché en haut de la page [1].
    Il permet de configurer finement votre site.
    La navigation de cet espace de configuration est divisé en trois parties : la configuration générale du site qui permet notamment de modifier : les informations principales concernant le site (...)

Sur d’autres sites (5812)

  • 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

    


  • some ffmpeg images are green, what causes this ?

    1er juillet 2014, par user2739431

    I’m using ffmpeg to stream files from an android screen to a computer. I use ffmpeg from the android to convert the raw image file to a jpg, and then I pull it to the computer. the images appear green pretty frequently (every few frames) and I’m wondering what is causing this, perhaps the rbg0 parameter ?

    shell screencap | /data/local/tmp/ffmpeg/./ffmpeg.armv7 -f rawvideo
    -s" + dimension[1].Split(’\n’)[0] +" -pix_fmt rgb0 -nostats -r 4 -i - -vf scale=540:960 -f image2 -vcodec mjpeg -update 1 -q:v 1 - > /data/local/tmp/ffmpeg/new.jpg ;

  • How to add text to a video with ffmpeg and python

    25 janvier 2013, par Jared Glass

    I've been trying to add text to an avi with ffmpeg and I can't seem to get it right.

    Please help :

    import subprocess

    ffmpeg = "C:\\ffmpeg_10_6_11.exe"
    inVid = "C:\\test_in.avi"
    outVid = "C:\\test_out.avi"

    proc = subprocess.Popen(ffmpeg + " -i " + inVid + " -vf drawtext=fontfile='arial.ttf'|text='test' -y " + outVid , shell=True, stderr=subprocess.PIPE)
    proc.wait()
    print proc.stderr.read()