Recherche avancée

Médias (91)

Autres articles (44)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

  • Supporting all media types

    13 avril 2011, par

    Unlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)

  • Dépôt de média et thèmes par FTP

    31 mai 2013, par

    L’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
    Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)

Sur d’autres sites (6040)

  • How to capture ffmpeg output in rails ?

    18 août 2019, par HelloWorld

    I’m running a ffmpeg command to try to get the duration of a video file, the command is as follows...

    system('ffmpeg -i C:\Users\example\Desktop\video9.mp4 -f ffmetadata')

    When I run that line it outputs a lot of info to the rails console, including duration. But how would I capture that info so I can split it and grab the data I need ? (I’m doing this inside a rails controller)

    When I run something like this...

    metadata = system('ffmpeg -i C:\Users\example\Desktop\video9.mp4 -f ffmetadata')
    puts metadata

    All it returns is false.

  • Why doesn't the ffmpeg output display the stream in the browser ? [closed]

    10 mai 2024, par Tebyy

    Why is it that when I create a livestream in Python using ffmpeg, and then I open the browser and visit the page, the page keeps loading continuously, and in PyCharm logs, I see binary data ? There are no errors displayed, and the code seems correct to me. I even tried saving to a file for testing purposes, and when I play the video, everything works fine. Does anyone know what might be wrong here ?

    


    Code :

    


    def generate_frames():
    cap = cv2.VideoCapture(os.path.normpath(app_root_dir().joinpath("data/temp", "video-979257305707693982.mp4")))
    while cap.isOpened():
        ret, frame = cap.read()
        if not ret:
            break

        yield frame


@app.route('/video_feed')
def video_feed():
    ffmpeg_command = [
        'ffmpeg', '-f', 'rawvideo', '-pix_fmt', 'bgr24',
        '-s:v', '1920x1080', '-r', '60',
        '-i', '-', '-vf', 'setpts=2.5*PTS', # Video Speed
        '-c:v', 'libvpx-vp9', '-g', '60', '-keyint_min', '60',
        '-b:v', '6M', '-minrate', '4M', '-maxrate', '12M', '-bufsize', '8M',
        '-crf', '0', '-deadline', 'realtime', '-tune', 'psnr', '-quality', 'good',
        '-tile-columns', '6', '-threads', '8', '-lag-in-frames', '16',
        '-f', 'webm', '-'
    ]
    ffmpeg_process = subprocess.Popen(ffmpeg_command, stdin=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)
    frames_generator = generate_frames()
    for frame in frames_generator:
        ffmpeg_process.stdin.write(frame)
        ffmpeg_process.stdin.flush()

    ffmpeg_process.stdin.close()
    ffmpeg_process.wait()

    def generate_video_stream(process):
        startTime = time.time()
        buffer = []
        sentBurst = False
        for chunk in iter(lambda: process.stderr.read(4096), b''):
            buffer.append(chunk)

            # Minimum buffer time, 3 seconds
            if sentBurst is False and time.time() > startTime + 3 and len(buffer) > 0:
                sentBurst = True
                for i in range(0, len(buffer) - 2):
                    print("Send initial burst #", i)
                    yield buffer.pop(0)

            elif time.time() > startTime + 3 and len(buffer) > 0:
                yield buffer.pop(0)

            process.poll()
            if isinstance(process.returncode, int):
                if process.returncode > 0:
                    print('FFmpeg Error', process.returncode)

                break

    return Response(stream_with_context(generate_video_stream(ffmpeg_process)), mimetype='video/webm', content_type="video/webm; codecs=vp9", headers=Headers([("Connection", "close")]))



    


  • FFMPeg generated video : Audio has 'glitches' when uploaded to YouTube

    7 octobre 2023, par CularBytes

    I've generated a voice from Azure AI Speech at 48KHz and 96K Bit Rate, generated a video of some stock footages and I'm trying to combine all of that with a background music.
The voice-over is generated per setence, so that I know how long each setence is and to include relevant video footage.

    


    I'm using FFMpeg through the FFMpegCore nuget package.

    


    The problem

    


    After the video is complete with background music, I play it on my computer and it's perfect (no audio glitches, music keeps playing). But when uploaded to youtube it has 'breaks' in the music inbetween sentences (basically everytime a new voice-fragment is starting).

    


    Example : https://www.youtube.com/watch?v=ieNvQ2TNq44

    


    The code

    


    All of the footage is combined with mostly FFMpeg.Join(string output, string[] videos). These video files also contain the voice-overs (per sentance).

    


    After that I try to add the music like this :

    


       string outputTimelineWithMusicPath = _workingDir + $@"\{videoTitle}_withmusic.mp4";
    FFMpegArguments
        .FromFileInput(inputVideoPath)
        .AddFileInput(musicPath)
        .OutputToFile(outputPath, true, options => options
            .CopyChannel()
            .WithAudioCodec(AudioCodec.Aac)
            .WithAudioBitrate(AudioQuality.Good)
            .UsingShortest(true)
            .WithCustomArgument("-filter_complex \"[0:a]aformat=fltp:44100:stereo,apad[0a];[1]aformat=fltp:44100:stereo,volume=0.05[1a];[0a][1a]amerge[a]\" -map 0:v -map \"[a]\" -ac 2"))
        .ProcessSynchronously();


    


    I've tried to mess around with the CustomArgument, but so far no success.

    


    For example, I thought removing apad from the argument so no 'blank spots' are added, should perhaps fix the issue. Also tried to use amix instead of amerge.

    


    Last try

    


    I've tried to first make sure both files had the same sample rate, in the hope to fix the issue. So far, no success

    


        string outputVideoVoicePath = _workingDir + $@"\{title}_voiceonly_formatting.mp4";
    string musicReplacePath = _workingDir + $@"\{title}_music_formatted.aac";
    FFMpegArguments
    .FromFileInput(inputVideoPath)
    .OutputToFile(outputVideoVoicePath, true, options => options
        .WithAudioCodec(AudioCodec.Aac)
        .WithAudioBitrate(128)
        .WithAudioSamplingRate(44100)
    )
    .ProcessSynchronously();
    
    FFMpegArguments
        .FromFileInput(music.FilePath)
        .OutputToFile(musicReplacePath, true, options => options
            .WithAudioCodec(AudioCodec.Aac)
            .WithAudioBitrate(256) //also tried 96 (which is original format)
            .WithAudioSamplingRate(44100)
        )
        .ProcessSynchronously();
    
    
    Console.WriteLine("Add music...");
    var videoTitle = Regex.Replace(title, "[^a-zA-Z]+", "");
    string outputTimelineWithMusicPath = _workingDir + $@"\{videoTitle}_withmusic.mp4";
    FFMpegArguments
        .FromFileInput(outputVideoVoicePath)
        .AddFileInput(musicReplacePath)
        .OutputToFile(outputTimelineWithMusicPath, true, options => options
            .CopyChannel()
            .WithAudioCodec(AudioCodec.Aac)
            .WithAudioBitrate(AudioQuality.Good)
            .UsingShortest(true)
            .WithCustomArgument("-filter_complex \"[0:a]aformat=fltp:44100:stereo[0a];[1]aformat=fltp:44100:stereo,volume=0.05[1a];[0a][1a]amix=inputs=2[a]\" -map 0:v -map \"[a]\" -ac 2"))
        .ProcessSynchronously();
    return outputTimelineWithMusicPath;


    


    I'm not much of an expert when it comes to audio/video codecs. I do scale each stock video to 24fps, 1920x1080 and the music has a original bitrate of 256Kbps / 44100 sample rate (so I probably don't even have to convert the audio file).