Recherche avancée

Médias (91)

Autres articles (83)

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

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

  • Les vidéos

    21 avril 2011, par

    Comme les documents de type "audio", Mediaspip affiche dans la mesure du possible les vidéos grâce à la balise html5 .
    Un des inconvénients de cette balise est qu’elle n’est pas reconnue correctement par certains navigateurs (Internet Explorer pour ne pas le nommer) et que chaque navigateur ne gère en natif que certains formats de vidéos.
    Son avantage principal quant à lui est de bénéficier de la prise en charge native de vidéos dans les navigateur et donc de se passer de l’utilisation de Flash et (...)

Sur d’autres sites (3973)

  • Python buffered IO ending early streaming with multiple pipes

    5 octobre 2022, par Malibu

    I'm trying to make a continuous livestream of videos downloaded via yt-dlp. I need to port this (working) bash command into Python.

    


    (
    youtube-dl -v --buffer-size 16k https://youtube.com/watch?v=QiInzFHIDp4 -o - | ffmpeg -i - -f mpegts -c copy - ;
    youtube-dl -v --buffer-size 16k https://youtube.com/watch?v=QiInzFHIDp4 -o - | ffmpeg -i - -f mpegts -c copy - ;
) | ffmpeg -re -i - -c:v libx264 -f flv rtmp://127.0.0.1/live/H1P_x5WPF


    


    My Python attempt is cutting off the last 2 seconds of each video. My suspicion is that although the first pipe, yt-dlp, has an empty stdout, there is still data travelling between the second and third pipe. I haven't been able to figure out a way to properly handle the data between those two pipes at the end of the video.

    


    from subprocess import Popen, PIPE, DEVNULL

COPY_BUFSIZE = 65424

playlist = [
    {
        # 15 second video
        "url": "https://youtube.com/watch?v=QiInzFHIDp4"
    },
    {
        # 15 second video
        "url": "https://youtube.com/watch?v=QiInzFHIDp4"
    },
    {
        # 15 second video
        "url": "https://youtube.com/watch?v=QiInzFHIDp4"
    },
]

if __name__ == "__main__":
    stream_cmd = [
        "ffmpeg", "-loglevel", "error",
        "-hide_banner", "-re", "-i", "-",
        "-c:v", "libx264",
        "-f", "flv",
        "-b:v", "3000k", "-minrate", "3000k",
        "-maxrate", "3000k", "-bufsize", "3000k",
        "-r", "25", "-pix_fmt", "yuv420p",
        "rtmp://127.0.0.1/live/H1P_x5WPF"
    ]
    print(f'Stream command:\n"{" ".join(stream_cmd)}"')

    encoder_cmd = [
        "ffmpeg", "-re", "-i", "-", "-f", "mpegts",
        "-c", "copy", "-"
    ]
    print(f'Encoder command:\n"{" ".join(encoder_cmd)}"')

    stream_p = Popen(stream_cmd, stdin=PIPE, stderr=DEVNULL)

    for video in playlist:
        yt_dlp_cmd = [
            "yt-dlp", "-q",
            video["url"],
            "-o", "-"
        ]

        print("Now playing: " + video["url"])

        with Popen(yt_dlp_cmd, stdout=PIPE) as yt_dlp_p:
            with Popen(encoder_cmd, stdin=PIPE, stdout=PIPE, stderr=DEVNULL) as encoder_p:
                while True:
                    yt_dlp_buf = yt_dlp_p.stdout.read(COPY_BUFSIZE)
                    print("READ: yt_dlp")
                    if not yt_dlp_buf:
                        print("yt-dlp buffer empty")
                        # Handle any data in 2nd/3rd pipes before breaking?
                        break

                    written = encoder_p.stdin.write(yt_dlp_buf)
                    print("WRITE: encoder. Bytes: " + str(written))

                    encoder_buf = encoder_p.stdout.read(COPY_BUFSIZE)
                    # if not encoder_buf:
                    #     print("encoder_buf empty")
                    #     break
                    print("READ: encoder")

                    stream_bytes_written = stream_p.stdin.write(encoder_buf)
                    print("WRITE: stream, Bytes: " + str(stream_bytes_written))


    


    Running Python 3.6.9 on MacOS.

    


  • Watching a livestream that is being ripped by ffmpeg to disk - file updating problem

    22 mai 2021, par merlin

    I am automatically recording daily tv news with ffmpeg, so I can watch them later.

    


    ffmpeg -i https://mcdn.daserste.de/daserste/de/master.m3u8 -c copy Tagesschau.mkv


    


    This works. But let's say ffmpeg recorded for 2 minutes and I open the currently saved file and begin to watch the video stops after some time.
It doesn't continue playing (but ffmpeg is still recording so there must be more video).

    


    Strange thing is even by closing and reopening the file I don't see the new content. Sometimes I have to wait 1-2 minutes till the new content shows up. But in the file manager I see the file is growing in size continuous.

    


    But when I copy/paste the file e.g. in the same directory and reopen the file I can immediately see the complete video content up to date recorded.

    


    Maybe it has to do with file system write buffer ? I tried on ZFS and ext4 (mounted on a samba share). By copy/paste I "trigger" the file system to update the file content ?

    


    Is there a workaround so when I start watching it will play without stopping ?

    


  • Installing a PHP Extension in WAMP - Idiot's Walkthrough ?

    16 mars 2015, par PeregrineStudios

    I’ve been coding with PHP for a while now, but haven’t needed to look at extensions - until now. These are brand-spanking new to me and while I’ve looked for, and found, other tutorials, many of them are using language that I don’t understand, or telling me to do things I don’t know how - I guess they assume most readers are a little more intelligent than I am !

    So : I need to install the extension FFmpeg (here : http://ffmpeg-php.sourceforge.net/). I’m currently developing on a local wamp server. PHP version 5.5.12, Apache version 2.4.9. At some point I’d like to put whatever I’ve done up on a live server, but that can wait.

    I have exactly, precisely, zero understanding of how to do this. I don’t even know what exactly I’d need to download, or where to put it.

    Is there anyone willing to take the time to tell me how to do this ? A real ’idiot’s guide’, breaking down each and every step for someone who’s never done this or really even anything similar before now.

    Thanks so much in advance for any assistance anyone can offer !

    EDIT : Firstly, thanks for down-voting someone for trying to learn. Appreciate it. Secondly, there was an answer here before, and now it’s gone. What gives ? Was it deleted ? Why ?

    EDIT AGAIN : I managed to find a cached version of the page with the answers still on it. For anyone else who wants the YouTube video one of the comments directed me to, here it is : https://www.youtube.com/watch?v=KIq85Eq28PM - still not sure why it was outright removed without anything else being answered in its place.