Recherche avancée

Médias (0)

Mot : - Tags -/flash

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

Autres articles (92)

  • Pas question de marché, de cloud etc...

    10 avril 2011

    Le vocabulaire utilisé sur ce site essaie d’éviter toute référence à la mode qui fleurit allègrement
    sur le web 2.0 et dans les entreprises qui en vivent.
    Vous êtes donc invité à bannir l’utilisation des termes "Brand", "Cloud", "Marché" etc...
    Notre motivation est avant tout de créer un outil simple, accessible à pour tout le monde, favorisant
    le partage de créations sur Internet et permettant aux auteurs de garder une autonomie optimale.
    Aucun "contrat Gold ou Premium" n’est donc prévu, aucun (...)

  • Automated installation script of MediaSPIP

    25 avril 2011, par

    To overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
    You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
    The documentation of the use of this installation script is available here.
    The code of this (...)

  • Support audio et vidéo HTML5

    10 avril 2011

    MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
    Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
    Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
    Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)

Sur d’autres sites (12190)

  • piping data into an ffmpeg subprocess. Why does write() get stuck ? [closed]

    12 mai 2024, par Tebyy

    It displays the number of frames at the beginning and shows that there are over 300, but when I count all the frames in the loop, the last one I see is 53, and then it only displays the value of 'ret', which is always true. I'm wondering what could be causing this issue of not reading all the frames, resulting in the file not being closed after reading. From what I've read, 'ret' should return false when there are no more frames to read, but because it's not reading all the frames, this isn't happening. Does anyone have any idea what could be causing this ?

    


    Edit : I solved the problem by adding a Thread. Thanks everyone for the help !

    


    I changed those lines of code :

    


    recogniteAndPushFramesToFfmpeg("video-979257305707693982.mp4", ffmpeg_process)
# In function "recogniteAndPushFramesToFfmpeg"
process.stdin.write(frame)


    


    to these :

    


    ffmpeg_thread = Thread(target=recogniteAndPushFramesToFfmpeg, args=("video-979257305707693982.mp4", ffmpeg_process))
ffmpeg_thread.start()
# In function "recogniteAndPushFramesToFfmpeg"
process.stdin.write(frame.tobytes())


    


    Code :

    


    import subprocess
import cv2

def recogniteAndPushFramesToFfmpeg(video_path, process):
    cap = cv2.VideoCapture(video_path)
    i = 1
    print('Frames:', cap.get(cv2.CAP_PROP_FRAME_COUNT))
    while cap.isOpened():
        ret, frame = cap.read()
        print(ret)
        if not ret:
            break

        process.stdin.write(frame)
        process.stdin.flush()
        print('Frame:', i)
        i += 1

    cap.release()
    process.stdin.close()
    #process.wait()
    return
    

ffmpeg_command = [
    'ffmpeg', '-f', 'rawvideo', '-s:v', '1920x1080', '-r', '60',
    '-i', '-', '-vf', 'setpts=2.5*PTS',
    '-c:v', 'libvpx-vp9', '-g', '60',
    '-f', 'webm', '-'
]
ffmpeg_process = subprocess.Popen(ffmpeg_command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=-1)
recogniteAndPushFramesToFfmpeg("video-979257305707693982.mp4", ffmpeg_process)


    


    Python Logs :

    


    Frames: 328.0
...
True
Frame 50
True
Frame 51
True
Frame 52
True
Frame 53
True


    


    I placed cap.isOpened() in the loop to check if it always returns true, and when I printed it, it always showed true

    


    Link to video : Tested Video

    


  • FFmpeg downloading entire live stream when making a small clip

    6 février 2021, par stevendesu

    Setup

    


    I'm using FFmpeg to generate video clips from M3U8 videos. The command looks like this :

    


    ffmpeg -ss <start> -i &lt;1080p-chunklist-url> -c:v copy -c:a copy -t <duration> -f mp4 -y out.mp4&#xA;</duration></start>

    &#xA;

    For example, to create a 30-second clip starting at the 5-minute mark for a particular video, the command would be :

    &#xA;

    ffmpeg -ss 300 -i https://example.com/path/to/1080p/index.m3u8 -c:v copy -c:a copy -t 30 -f mp4 -y out.mp4&#xA;

    &#xA;

    Some caveats I'm already aware of :

    &#xA;

      &#xA;
    • If -ss comes after -i then FFmpeg will attempt to download the entire M3U8 instead of just the relevant TS files, and will parse the entire video contents looking for the exact timestamp. By putting -ss before -i FFmpeg uses "seek points", which with HLS videos means it looks at the M3U8 and only downloads relevant TS files
    • &#xA;

    • TS file boundaries function as "seek points" in HLS, so if a TS file starts at 4:51 and the next TS file starts at 5:01, this command will start the clip at 4:51 instead of 5:01 (it prefers the first seek point before the requested time)
    • &#xA;

    • The -t parameter sets an exact clip duration instead of an ending position, so in the above example of a clip starting at 4:51 the same clip would end at 5:21 instead of 5:30
    • &#xA;

    &#xA;

    In theory I can utilize -to instead of -t to specify an ending time of 5:30, however in practice this hasn't worked. Also in theory I can force -accurate_seeking to discard the contents from 4:51 to 5:00 and start the clip where I wanted it, but I learned this only works for transcodes and not transmux

    &#xA;

    Now to the meat of my problem :

    &#xA;

    Problem

    &#xA;

    When the M3U8 URL provided is a live stream (no #EXT-X-ENDLIST tag) then FFmpeg does not behave correctly. On FFmpeg versions 4.2.1 and earlier, it starts by downloading the TS file containing my clip segment, then proceeds to download every TS file in the M3U8 then hangs while waiting for new TS files to become available, downloading them as they appear - even hours after the end of the section I wanted to clip. On FFmpeg version 4.2.2 and later, I can create clips so long as they end before the second-to-last TS file. If the live stream currently has 20 minutes of video data and I create a clip from 19:30 - 19:40 (ending right at the start of the second-to-last TS file, assuming a 10-second TS file duration) then it will behave the same as 4.2.1 : waiting infinitely to download the entire video.

    &#xA;

    The "2 TS files from the end" rule I believe is related to FFmpeg's initial probe of the video to get stream data. In the aforementioned 20-minute long video, if I make a clip from 3:00 to 3:30 (well before the end of the stream) it will first download TS files 119 and 120 (19:40-19:50 and 19:50-20:00), then it displays a list of the streams in the video (audio, video, metadata), then it downloads TS files 19 - 21 (containing the actual data I want for my clip)

    &#xA;

    Is there a way to fix it so I can properly make clips of sections near the "end" of live M3U8s ?

    &#xA;

  • Python moviepy, CompositeVideoClip is Slow and Wierd

    4 mars 2023, par Dan

    I want to add a .mov transparent overlay on top of a .mp4 video, and for that I am using movipy and CompositeVideoClip, but it's too slow.

    &#xA;

    The speed is 40 it/s when only the video is rendering but when it comes to the overlay it is only 5 it/s. To speed it up I have used use_bgclip=True and now I get 90 it/s but when the overlay comes I still get 5 it/s, and when I use use_bgclip=True there are 2 'bugs' that appears :

    &#xA;

      &#xA;
    1. The video freezes after the overlay is done playing.
    2. &#xA;

    3. The audio of the video is lost and the overlay sound is the only one left
    4. &#xA;

    &#xA;

    For the two 'bugs', I found a good enough solution, but I want to speed up the process when the overlay comes, because 5 it/s it's way too slow. I have tried to use codec="h264_nvenc" or higher crf but the speed is the same.

    &#xA;

    Is there a way to speed this up ? (I don't care if I need to use other libraries)

    &#xA;

    import moviepy.editor as mp&#xA;video = mp.VideoFileClip("video.mp4")&#xA;&#xA;overlay = mp.VideoFileClip("overlay.mov", has_mask=True)&#xA;overlay = overlay.set_start(5) # start the overlay 5 seconds after the video starts&#xA;&#xA;compose = mp.CompositeVideoClip([video, overlay], use_bgclip=True, size=video.size)&#xA;compose = compose.set_duration(video.duration) # fix bug 1&#xA;compose = compose.set_audio(video.audio) # fix bug 2 (but I lost the audio from the overlay)&#xA;&#xA;compose.write_videofile("cf15.mp4", codec="libx264", preset="veryfast", ffmpeg_params=["-crf", "15"])&#xA;&#xA;compose.close()&#xA;video.close()&#xA;

    &#xA;