Recherche avancée

Médias (91)

Autres articles (73)

  • Encodage et transformation en formats lisibles sur Internet

    10 avril 2011

    MediaSPIP transforme et ré-encode les documents mis en ligne afin de les rendre lisibles sur Internet et automatiquement utilisables sans intervention du créateur de contenu.
    Les vidéos sont automatiquement encodées dans les formats supportés par HTML5 : MP4, Ogv et WebM. La version "MP4" est également utilisée pour le lecteur flash de secours nécessaire aux anciens navigateurs.
    Les documents audios sont également ré-encodés dans les deux formats utilisables par HTML5 :MP3 et Ogg. La version "MP3" (...)

  • Monitoring de fermes de MediaSPIP (et de SPIP tant qu’à faire)

    31 mai 2013, par

    Lorsque l’on gère plusieurs (voir plusieurs dizaines) de MediaSPIP sur la même installation, il peut être très pratique d’obtenir d’un coup d’oeil certaines informations.
    Cet article a pour but de documenter les scripts de monitoring Munin développés avec l’aide d’Infini.
    Ces scripts sont installés automatiquement par le script d’installation automatique si une installation de munin est détectée.
    Description des scripts
    Trois scripts Munin ont été développés :
    1. mediaspip_medias
    Un script de (...)

  • Participer à sa traduction

    10 avril 2011

    Vous pouvez nous aider à améliorer les locutions utilisées dans le logiciel ou à traduire celui-ci dans n’importe qu’elle nouvelle langue permettant sa diffusion à de nouvelles communautés linguistiques.
    Pour ce faire, on utilise l’interface de traduction de SPIP où l’ensemble des modules de langue de MediaSPIP sont à disposition. ll vous suffit de vous inscrire sur la liste de discussion des traducteurs pour demander plus d’informations.
    Actuellement MediaSPIP n’est disponible qu’en français et (...)

Sur d’autres sites (13280)

  • Python unknown file extension .mp4

    18 février 2024, par marlise23

    I am working on a simulation project, however I am unable to create a visual. I started out by running code from matplotlib's documentation (i.e. the code does not belong to me).
When I run the code, I get the error "unknown file extension : .mp4". 
I have installed ffmpeg and checked that it is an updated version.

    



    I am using a Windows computer and Python 3.

    



    import numpy as np
from matplotlib import pyplot as plt
from matplotlib import animation
plt.rcParams['animation.ffmpeg_path']='‪C:\\FFmpeg\bin\ffmpeg.exe'

# First set up the figure, the axis, and the plot element we want to animate
fig = plt.figure()
ax = plt.axes(xlim=(0, 2), ylim=(-2, 2))
line, = ax.plot([], [], lw=2)

# initialization function: plot the background of each frame
def init():
    line.set_data([], [])
    return line,

# animation function.  This is called sequentially
def animate(i):
    x = np.linspace(0, 2, 1000)
    y = np.sin(2 * np.pi * (x - 0.01 * i))
    line.set_data(x, y)
    return line,

# call the animator.  blit=True means only re-draw the parts that have changed.
anim = animation.FuncAnimation(fig, animate, init_func=init,
                               frames=200, interval=20, blit=True)

# save the animation as an mp4.  This requires ffmpeg or mencoder to be
# installed.  The extra_args ensure that the x264 codec is used, so that
# the video can be embedded in html5. 
anim.save('basic_animation.mp4', fps=30, extra_args=['-vcodec', 'libx264'])

plt.show()


    


  • FFMPEG -filter_complex drawtext with style like bold italic and underline

    6 janvier 2019, par Mubbashar

    I am trying to add text on padded area of my video. There are 4 to 5 things that i am not able to do

    • 1) Draw text styling (bold, italic, underline)
    • 2) Padded area opacity
    • 3) Subtitle vertical alignment. When i give some value to VAlign it
      sometimes goes out of the window. how to calculate correctly like
      50px from top or let say 200px from bottom
    • 4) The subtitle should be full width to video. Right now it is like
      this. enter image description here
    • 5) Having a hard time providing OutlineColour value. I have RGBA
      value so how i can give it to OutlineColour

    Here is command i am using

    ffmpeg -y -i video-orignal.mp4 -i logo.png -filter_complex "[0] pad=width=iw:height=ih+200:x=0:y=100:color=#f2e6e6@0.99 [v_1];[v_1] drawtext=fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':text='this is watermark': fontsize=24: x=0.23333333333333*main_w: y=0.1325*main_h: fontcolor=#b01e1e: alpha=1,drawtext=fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':text='This is Top fixed text': fontsize=32: x=w-tw-2: y=(100-th)/2: fontcolor=#9e2643: alpha=1,drawtext=fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':text='This is Bottom fixed text': fontsize=32: x=w-tw-2: y=h-50: fontcolor=#9e2643: alpha=1 [v_2];[v_2] subtitles=f=subtitles-final.srt:force_style='FontName=DejaVu Sans Mono,FontSize=26,OutlineColour=&H00f2eded,PrimaryColour=&H000bf282,BorderStyle=3,WrapStyle=3,Bold=1,italic=1,Underline=1,Alignment=3,MarginV=86.4' [v_3];[v_3] [1]overlay=main_w-140:105 [v_4]" -map "[v_4]" -map 0:a video-final.mp4

    Split into lines and indented to make it readable :

    ffmpeg -y
    -i video-orignal.mp4
    -i logo.png
    -filter_complex
       "[0] pad=width=iw:height=ih+200:x=0:y=100:color=#f2e6e6@0.99 [v_1];
       [v_1]
           drawtext=
               fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':
               text='this is watermark': fontsize=24:
               x=0.23333333333333*main_w: y=0.1325*main_h:
               fontcolor=#b01e1e: alpha=1,
           drawtext=
               fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':
               text='This is Top fixed text': fontsize=32:
               x=w-tw-2: y=(100-th)/2: fontcolor=#9e2643: alpha=1,
           drawtext=
               fontfile='/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf':
               text='This is Bottom fixed text': fontsize=32:
               x=w-tw-2: y=h-50: fontcolor=#9e2643: alpha=1
       [v_2];
       [v_2]
           subtitles=
               f=subtitles-final.srt:
               force_style=
                   'FontName=DejaVu Sans Mono,
                   FontSize=26,
                   OutlineColour=&H00f2eded,
                   PrimaryColour=&H000bf282,
                   BorderStyle=3,WrapStyle=3,Bold=1,italic=1,Underline=1,
                   Alignment=3,MarginV=86.4'
       [v_3];
       [v_3] [1]overlay=main_w-140:105 [v_4]"
    -map "[v_4]"
    -map 0:a
    video-final.mp4
  • Convert images into video

    24 septembre 2017, par Disha Shukla

    I have some images in the folder. I want to convert all images into videos. But the problem is that when the resolution is different it shows the error. I don’t want to stretch the images in the video. I just want to keep image size as it is. But it shows this error.

    My Command :

    ffmpeg -framerate 1/3 -pattern_type glob -i "images/*.jpg" -i trinity.MP3 -shortest -c:v libx264 -r 30 -vf "scale=iw*sar:ih , pad=max(iw\,ih*(16/9)):ow/(16/9):(ow-iw)/2:(oh-ih)/2" -aspect 16:9 -pix_fmt yuv420p out.mp4 -y

    Logs :

    [mjpeg @ 0x6b3820] Changeing bps to 8
    Input #0, image2, from 'images/*.jpg':
     Duration: 00:00:24.00, start: 0.000000, bitrate: N/A
       Stream #0:0: Video: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1280x720 [SAR 1:1 DAR 16:9], 0.33 fps, 0.33 tbr, 0.33 tbn, 0.33 tbc
    [mp3 @ 0x6b4ca0] Estimating duration from bitrate, this may be inaccurate
    Input #1, mp3, from 'trinity.MP3':
     Metadata:
       encoded_by      : Lavf52.9.0
     Duration: 00:09:02.35, start: 0.000000, bitrate: 128 kb/s
       Stream #1:0: Audio: mp3, 44100 Hz, stereo, s16p, 128 kb/s
    [swscaler @ 0x68a3c0] deprecated pixel format used, make sure you did set range correctly
    [libx264 @ 0x6bada0] using SAR=1/1
    [libx264 @ 0x6bada0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX AVX2 FMA3 LZCNT BMI2
    [libx264 @ 0x6bada0] profile High, level 3.1
    [libx264 @ 0x6bada0] 264 - core 142 r2438 af8e768 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, mp4, to 'out.mp4':
     Metadata:
       encoder         : Lavf56.25.101
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 30 fps, 15360 tbn, 30 tbc
       Metadata:
         encoder         : Lavc56.26.100 libx264
       Stream #0:1: Audio: aac (libfaac) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, s16, 128 kb/s
       Metadata:
         encoder         : Lavc56.26.100 libfaac
    Stream mapping:
     Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
     Stream #1:0 -> #0:1 (mp3 (native) -> aac (libfaac))
    Press [q] to stop, [?] for help
    Input stream #0:0 frame changed from size:1280x720 fmt:yuvj420p to size:596x913 fmt:yuvj420p
    [Parsed_pad_1 @ 0x697940] Input area 512:0:1108:913 not within the padded area 0:0:1622:912 or zero-sized
    [Parsed_pad_1 @ 0x697940] Failed to configure input pad on Parsed_pad_1

    Is there any way to keep resolution as it is and make a video of all images ?