Recherche avancée

Médias (3)

Mot : - Tags -/spip

Autres articles (75)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • MediaSPIP v0.2

    21 juin 2013, par

    MediaSPIP 0.2 est la première version de MediaSPIP stable.
    Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
    Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
    Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
    Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (11266)

  • Ffmpeg is installed, but I get the exception : You do not have ffmpeg installed on your machine

    13 janvier 2023, par Tin Kommen

    I've searched for hours for a solution, but I haven't found one yet. Maybe someone here knows what is going wrong.

    


    I'm trying to make a Bar Chart Race in Python. Although I have downloaded and installed Ffmpeg,
I keep on getting multiple errors :

    


        MovieWriter ffmpeg unavailable; using Pillow instead.
    Traceback (most recent call last):
      File "/Users/___/PycharmProjects/data_visualization/venv/lib/python3.6/site-        packages/matplotlib/animation.py", line 251, in saving
        yield self
      File "/Users/___/PycharmProjects/data_visualization/venv/lib/python3.6/site-        packages/matplotlib/animation.py", line 1161, in save
        writer.grab_frame(**savefig_kwargs)
      File "/Users/____/PycharmProjects/data_visualization/venv/lib/python3.6/site-        packages/matplotlib/animation.py", line 549, in grab_frame
        renderer = self.fig.canvas.get_renderer()
    AttributeError: 'FigureCanvasBase' object has no attribute 'get_renderer'

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/Users/___/PycharmProjects/data_visualization/venv/lib/python3.6/site-        packages/bar_chart_race/_make_chart.py", line 435, in make_animation
        ret_val = anim.save(self.filename, fps=self.fps, writer=self.writer)
      File "/Users/___/PycharmProjects/data_visualization/venv/lib/python3.6/site-        packages/matplotlib/animation.py", line 1161, in save
        writer.grab_frame(**savefig_kwargs)
      File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/contextlib.py", line         100, in __exit__
        self.gen.throw(type, value, traceback)
      File "/Users/___/PycharmProjects/data_visualization/venv/lib/python3.6/site-                        packages/matplotlib/animation.py", line 253, in saving
        self.finish()
              File "/Users/____/PycharmProjects/data_visualization/venv/lib/python3.6/site-        packages/matplotlib/animation.py", line 554, in finish
        self._frames[0].save(
            IndexError: list index out of range

    During handling of the above exception, another exception occurred:

    Exception: You do not have ffmpeg installed on your machine. Download
    ffmpeg from here: https://www.ffmpeg.org/download.html.
    Matplotlib's original error message below:
    list index out of range


    


    I've tried installing ffmpeg with conda, pip and homebrew. When I check the version, i get the following :

    


        ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers
      built with clang version 9.0.1
      configuration: --prefix=/Users/___/opt/miniconda3 --cc=x86_64-apple-darwin13.4.0-clang --disable-doc --disable-openssl --enable-avresample --enable-gnutls --enable-gpl --enable-hardcoded-tables --enable-libfreetype --enable-libopenh264 --enable-libx264 --enable-pic --enable-pthreads --enable-shared --enable-static --enable-version3 --enable-zlib --enable-libmp3lame
      libavutil      56. 31.100 / 56. 31.100
      libavcodec     58. 54.100 / 58. 54.100
      libavformat    58. 29.100 / 58. 29.100
      libavdevice    58.  8.100 / 58.  8.100
      libavfilter     7. 57.100 /  7. 57.100
      libavresample   4.  0.  0 /  4.  0.  0
      libswscale      5.  5.100 /  5.  5.100
      libswresample   3.  5.100 /  3.  5.100
      libpostproc    55.  5.100 / 55.  5.100


    


    Here is the code :

    


        import numpy as np
    import pandas as pd
    import bar_chart_race as bcr
    import os



    df = pd.read_csv('/Users/____/Documents/data/dummy_data.csv', delimiter=';', encoding="utf-8-sig")
    bcr.bar_chart_race(
        df=df,
        filename='test_win2.mov',
        orientation='h',
        sort='desc',
        n_bars=8,
        fixed_order=False,
        fixed_max=False,
        steps_per_period=50,
        interpolate_period=False,
        label_bars=True,
        bar_size=.95,
        period_label={'x': .99, 'y': .25, 'ha': 'right', 'va': 'center'},
        period_summary_func=lambda v, r: {'x': .99, 'y': .18,
                                  's': f'Totaal: {v.nlargest(8).sum():,.0f}',
                                  'ha': 'right', 'size': 8, 'family': 'Courier New'},
        perpendicular_bar_func='median',
        figsize=(3.5, 3),
        period_length=100,
        dpi=300,
        cmap='dark12',
        title='Title?',
        title_size='',
        bar_label_size=4,
        tick_label_size=4,
        shared_fontdict={'family': 'Helvetica', 'color': '.1'},
        scale='linear',
        writer=None,
        fig=None,
        bar_kwargs={'alpha': .3},
        filter_column_colors=False)


    


  • Use FFMPEG to create GTA 5 style loading screen/video

    7 mai 2021, par Archer

    Goal :
Using FFMPEG I would like to make something like these GTA 5 loading screens using only some elements. The goal is to be automated in the end so I can generate thousands of videos with the elements below placed in different folders. https://youtu.be/0A4K0bCkYdg?t=108

    


    Input files :

    


      

    1. background.jpg
    2. 


    3. foreground.png
    4. 


    5. logo.png
    6. 


    7. theme.mp3
    8. 


    


    Current command :

    


    ffmpeg.exe -i background.jpg -i foreground.png -i logo.png -i theme.mp3 -filter_complex " \
[0:v]scale=1920:1080 [background_1], \
[1:v]scale=500:500:force_original_aspect_ratio=decrease [foreground_1], \
[2:v]scale=350:350:force_original_aspect_ratio=decrease [logo_1], \
[background_1]zoompan=z='if(lte(mod(on,50),25),zoom+0.0005,zoom-0.0005)':x=iw/2-(iw/zoom)/2:y=ih/2-(ih/zoom)/2:d=60*60:s=hd1080 [background_2], \
[background_2][foreground_1]overlay=x='min((W-(W*0.3)-n),((W*0.3)+n)):y=H-h' [bg_fg], \
[bg_fg][logo_1]overlay=x=30:y=H-h-30 \
" loading.mkv


    


    This code started from a suggestion on a reddit post I made, but have made some adjustments.

    


    After the inputs I am first scaling the background image in the event it is not the correct ratio already. Then scaling the foreground image and logo image.

    


    The next 2 are what I need help with. The zooming of the background_1 and the scrolling/panning of the foreground_1.

    


    Question 1 : Before the zooming starts occurring is it possible to distort the image like shown, so I can start with a normal rectangular background image ?

    


    Question 2 : I would like the zooming to be much closer to what is happening in the youtube example. How would I achieve this ? The zoompan filter is not making much sense to me at the moment.

    


    Question 3 : With the scrolling/panning of the foreground. How can I start this at 30% in x and go to 70% in x... then back to 30% and repeat for the entire length ? Also how to slow it down ? This answer helped me to understand this somewhat, but using the min example they provided did not work for me and there was no motion at all.

    


    The logo placement is next and I am good with that for now.

    


    Any input would be greatly appreciated.

    


  • Create Panorama from Non-Sequential Video Frames

    6 mai 2021, par M.Innat

    There is a similar question (not that detailed and no exact solution).

    



    


    I want to create a single panorama image from video frames. And for that, I need to get minimum non-sequential video frames at first. A demo video file is uploaded here.

    


    What I Need

    


    A mechanism that can produce not-only non-sequential video frames but also in such a way that can be used to create a panorama image. A sample is given below. As we can see to create a panorama image, all the input samples must contain minimum overlap regions to each other otherwise it can not be done.

    


    enter image description here

    


    So, if I have the following video frame's order

    


    A, A, A, B, B, B, B, C, C, A, A, C, C, C, B, B, B ...


    


    To create a panorama image, I need to get something as follows - reduced sequential frames (or adjacent frames) but with minimum overlapping.

    


         [overlap]  [overlap]  [overlap] [overlap]  [overlap]
 A,    A,B,       B,C,       C,A,       A,C,      C,B,  ...


    


    What I've Tried and Stuck

    


    A demo video clip is given above. To get non-sequential video frames, I primarily rely on ffmpeg software.

    


    Trial 1 Ref.

    


    ffmpeg -i check.mp4 -vf mpdecimate,setpts=N/FRAME_RATE/TB -map 0:v out.mp4


    


    After that, on the out.mp4, I applied slice the video frames using opencv

    


    import cv2, os 
from pathlib import Path

vframe_dir = Path("vid_frames/")
vframe_dir.mkdir(parents=True, exist_ok=True)

vidcap = cv2.VideoCapture('out.mp4')
success,image = vidcap.read()
count = 0

while success:
    cv2.imwrite(f"{vframe_dir}/frame%d.jpg" % count, image)     
    success,image = vidcap.read()
    count += 1


    


    Next, I rotated these saved images horizontally (as my video is a vertical view).

    


    vframe_dir = Path("out/")
vframe_dir.mkdir(parents=True, exist_ok=True)

vframe_dir_rot = Path("vframe_dir_rot/")
vframe_dir_rot.mkdir(parents=True, exist_ok=True)

for i, each_img in tqdm(enumerate(os.listdir(vframe_dir))):
    image = cv2.imread(f"{vframe_dir}/{each_img}")[:, :, ::-1] # Read (with BGRtoRGB)
    
    image = cv2.rotate(image,cv2.cv2.ROTATE_180)
    image = cv2.rotate(image,cv2.ROTATE_90_CLOCKWISE)

    cv2.imwrite(f"{vframe_dir_rot}/{each_img}", image[:, :, ::-1]) # Save (with RGBtoBGR)


    


    The output is ok for this method (with ffmpeg) but inappropriate for creating the panorama image. Because it didn't give some overlapping frames sequentially in the results. Thus panorama can't be generated.

    
 


    Trail 2 - Ref

    


    ffmpeg -i check.mp4 -vf decimate=cycle=2,setpts=N/FRAME_RATE/TB -map 0:v out.mp4


    


    didn't work at all.

    


    Trail 3

    


    ffmpeg -i check.mp4 -ss 0 -qscale 0 -f image2 -r 1 out/images%5d.png


    


    No luck either. However, I've found this last ffmpeg command was close by far but wasn't enough. Comparatively to others, this gave me a small amount of non-duplicate frames (good) but the bad thing is still do not need frames, and I kinda manually pick some desired frames, and then the opecv stitching algorithm works. So, after picking some frames and rotating (as mentioned before) :

    


    stitcher = cv2.Stitcher.create()
status, pano = stitcher.stitch(images) # images: manually picked video frames -_- 


    
 


    Update

    


    After some trials, I am kinda adopting the non-programming solution. But would love to see an efficient programmatic approach.

    


    On the given demo video, I used Adobe products (premiere pro and photoshop) to do this task, video instruction. But the issue was, I kind of took all video frames at first (without dropping to any frames and that will computationally cost further) via premier and use photoshop to stitching them (according to the youtube video instruction). It was too heavy for these editor tools and didn't look better way but the output was better than anything until now. Though I took few (400+ frames) video frames only out of 1200+.

    


    enter image description here

    



    


    Here are some big challenges. The original video clips have some conditions though, and it's too serious. Unlike the given demo video clips :

    


      

    • It's not straight forward, i.e. camera shaking
    • 


    • Lighting condition, i.e. causes different visual look at the same spot
    • 


    • Cameral flickering or banding
    • 


    


    This scenario is not included in the given demo video. And this brings additional and heavy challenges to create panorama images from such videos. Even with the non-programming way (using adobe tools) I couldn't make it any good.

    



    


    However, for now, all I'm interest to get a panorama image from the given demo video which is without the above condition. But I would love to know any comment or suggestion on that.