Recherche avancée

Médias (91)

Autres articles (67)

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

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

Sur d’autres sites (6046)

  • How to overlay sequence of frames on video using ffmpeg-python ?

    19 novembre 2022, par Yogesh Yadav

    I tried below but it is only showing the background video.

    


    background_video = ffmpeg.input( "input.mp4")
overlay_video = ffmpeg.input(f'{frames_folder}*.png', pattern_type='glob', framerate=25)
subprocess = ffmpeg.overlay(
                          background_video,
                          overlay_video,
                        ).filter("setsar", sar=1)


    


    I also tried to assemble sequence of frames into .webm/.mov video but transparency is lost. video is taking black as background.

    


    P.s - frame size is same as background video size. So no scaling needed.

    


    Edit

    


    I tried @Rotem suggestions

    


    


    Try using single PNG image first

    


    


    overlay_video =  ffmpeg.input('test-frame.png')


    


    It's not working for frames generated by OpenCV but working for any other png image. This is weird, when I'm manually viewing these frames folder it's showing blank images(Link to my frames folder).
But If I convert these frames into the video(see below) it is showing correctly what I draw on each frame.

    


    output_options = {
                    'crf': 20,
                    'preset': 'slower',
                    'movflags': 'faststart',
                    'pix_fmt': 'yuv420p'
                }
ffmpeg.input(f'{frames_folder}*.png', pattern_type='glob', framerate=25 , reinit_filter=0).output(
                    'movie.avi',
                    **output_options
                ).global_args('-report').run()


    


    


    try creating a video from all the PNG images without overlay

    


    


    It's working as expected only issue is transparency. Is there is way to create a transparent background video ? I tried .webm/.mov/.avi but no luck.

    


    


    Add .global_args('-report') and check the log file

    


    


    Report written to "ffmpeg-20221119-110731.log"
Log level: 48
ffmpeg version 5.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with Apple clang version 13.1.6 (clang-1316.0.21.2.5)
  configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
  libavutil      57. 28.100 / 57. 28.100
  libavcodec     59. 37.100 / 59. 37.100
  libavformat    59. 27.100 / 59. 27.100
  libavdevice    59.  7.100 / 59.  7.100
  libavfilter     8. 44.100 /  8. 44.100
  libswscale      6.  7.100 /  6.  7.100
  libswresample   4.  7.100 /  4.  7.100
  libpostproc    56.  6.100 / 56.  6.100
Input #0, image2, from './frames/*.png':
  Duration: 00:00:05.00, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: png, rgba(pc), 1920x1080, 25 fps, 25 tbr, 25 tbn
Codec AVOption crf (Select the quality for constant quality mode) specified for output file #0 (movie.avi) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Codec AVOption preset (Configuration preset) specified for output file #0 (movie.avi) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> mpeg4 (native))
Press [q] to stop, [?] for help
Output #0, avi, to 'movie.avi':
  Metadata:
    ISFT            : Lavf59.27.100
  Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p(tv, progressive), 1920x1080, q=2-31, 200 kb/s, 25 fps, 25 tbn
    Metadata:
      encoder         : Lavc59.37.100 mpeg4
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
frame=  125 fps= 85 q=31.0 Lsize=     491kB time=00:00:05.00 bitrate= 804.3kbits/s speed=3.39x    
video:482kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.772174%


    


    To draw frame I used below.

    


    for i in range(num_frames):
            transparent_img = np.zeros((height, width, 4),  dtype=np.uint8)
            cv2.line(transparent_img, (x1,y1), (x2,y2) ,(255, 255, 255), thickness=1, lineType=cv2.LINE_AA)
            self.frames.append(transparent_img)


## To Save each frame of the video in the given folder
for i, f in enumerate(frames):
    cv2.imwrite("{}/{:0{n}d}.png".format(path_to_frames, i, n=num_digits), f)





    


  • PHP serving two different video files

    6 septembre 2016, par inan

    I’m currently serving with PHP .ts segments while FFmpeg is running.
    My idea was to show during the stream my own advert. So I decided to add between the .ts segments my own video file.

    The problem is, if the advertising file is not existing everything is working fine until the file for my advert exists. The script continues but is not showing the advert.

    I tried to serve just only the advert file and it’s working. So I can assume, everything with the file is alright.

    Is there a limitation, to serve just only one file extension or container etc ?

    I’m watching the streams with VLC and Enigma2

    A part of my code :

    while(streamIsRunning()){
    // Serving .ts segments
    while (!feof($file_handler) && ClientConnected($clientpid)) {
       $response = stream_get_line($file_handler, 4096);
       echo $response;
       flush();
    }

    // Serve Advert if exists
    if (file_exists($myAdvert)) {
       $file_handler = fopen($myAdvert, "rb") or exit ("Stream Not Working");
       while (!feof($file_handler) && ClientConnected($clientpid)) {
           $response = stream_get_line($file_handler, 4096);
           echo $response;
           flush();
      }
    }
    }
  • FFMPEG saving frame from video works in localhost but not working in live server

    5 janvier 2018, par Mukesh

    I’m using FFMPEG to take a frame from a video. My code is working all fine in localhost but, fails to execute in server.

    Code I’m executing :

    $ffmpeg = \FFMpeg\FFMpeg::create();

    $video = $ffmpeg->open($File_temp_name);

    $video
        ->frame(\FFMpeg\Coordinate\TimeCode::fromSeconds(1))
        ->save($saveLocation);

    This code is executing fine in localhost but, when I execute the same in server it is showing an error

    Exception 'FFMpeg\Exception\RuntimeException' with message 'Unable to save framesexception 'Alchemy\BinaryDriver\Exception\ExecutionFailureException' with message 'ffmpeg failed to execute command'

    Command Getting executed is :

    '/usr/bin/ffmpeg' '-y' '-ss' '00:00:01.00' '-i' '/tmp/php02MmoD' '-vframes' '1' '-f' 'image2' '/home/project/public_html/dev/frontend/web/uploads/temp-video-frames/1499319488-act-thumbnail.jpg'

    I’ve tried to execute the command in terminal and found it executing without any error and save frame in desired location. But, when I run it through my code it is throwing above error