Recherche avancée

Médias (91)

Autres articles (38)

  • MediaSPIP Core : La Configuration

    9 novembre 2010, par

    MediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
    Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...)

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

  • Support de tous types de médias

    10 avril 2011

    Contrairement à beaucoup de logiciels et autres plate-formes modernes de partage de documents, MediaSPIP a l’ambition de gérer un maximum de formats de documents différents qu’ils soient de type : images (png, gif, jpg, bmp et autres...) ; audio (MP3, Ogg, Wav et autres...) ; vidéo (Avi, MP4, Ogv, mpg, mov, wmv et autres...) ; contenu textuel, code ou autres (open office, microsoft office (tableur, présentation), web (html, css), LaTeX, Google Earth) (...)

Sur d’autres sites (4972)

  • FFmpeg : encoding in webm (vp9) for windows

    2 juillet 2015, par Seltymar

    I’m trying to encode jpegs to a webm video in vp9 on windows 7.

    I followed the instructions from webmproject in 2 pass.
    I changed \dev\nul by NUL.

    ffmpeg.exe -i %4d.jpg -c:v libvpx-vp9 -pass 1 -b:v 1000K -threads 8 -speed 4 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -an -f webm NUL

    ffmpeg.exe -i %4d.jpg  -c:v libvpx-vp9 -pass 2 -b:v 1000K -threads 8 -speed 1 -tile-columns 6 -frame-parallel 1 -auto-alt-ref 1 -lag-in-frames 25 -c:a libopus -b:a 64k -f webm out.webm

    but after the first pass, it tells me "output file is empty, nothing was encoded". But the second pass create the video.

    I also tryed in one pass :

    ffmpeg -i %4d.jpg -c:v libvpx-vp9 -crf 10 -b:v 0 output.webm

    Then I want to use the output video using html5 video and canvas tags as below.

       




    <canvas>
           Your browser does not support the canvas tag.
    </canvas>
    <code class="echappe-js">&lt;script&gt;<br />
    <br />
    <br />
           var videos = document.createElement('video');<br />
           videos.src = &quot;output.webm&quot;;<br />
           videos.type = &quot;video/webm&quot;;<br />
           videos.load(); <br />
           videos.play();<br />
           videos.playbackRate = 1;<br />
           var videoImage0 = document.getElementById('canvas');        <br />
           videoImage0.width = 2700;<br />
           videoImage0.height = 1350;<br />
    <br />
           var videoImageContexts =videoImage0.getContext('2d');<br />
           //// background color if no video present<br />
           videoImageContexts.fillStyle = '#0000ff';<br />
           videoImageContexts.fillRect(0, 0, videoImage0.width, videoImage0.height);       <br />
           animate();<br />
    <br />
       function animate() {<br />
           requestAnimationFrame(animate);<br />
           update();<br />
    <br />
       }<br />
    <br />
       function update() {<br />
    <br />
           if (videos.readyState === videos.HAVE_ENOUGH_DATA) {<br />
               videoImageContexts.drawImage(videos, 0, 0);<br />
           }<br />
       }<br />
    &lt;/script&gt;

    result :

    1. With both methods the output video can’t be read in VLC but it can be read if I drag and drop in firefox or chrome or using the video tag only.
    2. The html page above works correctly on chrome but not in firefox. In firefox, the color is not correct like if the blue channel was translated.
      enter image description here

    I think the problem is the encoding with FFmpeg. I’m using the static build from zeranoe. Here is the version FFmpeg version

    and libvpx is enable.

    My questions :

    • Is there a problem on my command line ?

    • Is there a problem in my JS code that could lead to error in the decoding process ?

  • FFMpeg Command work in command line, but not in python script

    20 février 2015, par Fooldj

    Okay, kind of a weird problem. But I’m not sure whether it’s python, ffmpeg, or some stupid thing I’m doing wrong.

    I’m trying to take a video, and take 1 frame a second, and output that frame to an image. Right now, if i use the command line with ffmpeg :

    ffmpeg -i test.avi -r 1 -f image2 image-%3d.jpeg -pix_fmt rgb24 -vcodec rawrvideo

    It outputs about 10 images, the images look fine, awesome. Now I have this code (right now some code from some github, as I wanted stuff that i was relatively sure would work, and mine is allll convoluted)

    import subprocess as sp
    import numpy as np
    import re
    import cv2
    import time

    FFMPEG_BIN = r'ffmpeg.exe'
    INPUT_VID = 'test.avi'

    def getInfo():
       command = [FFMPEG_BIN,'-i', INPUT_VID, '-']
       pipe = sp.Popen(command, stdout=sp.PIPE, stderr=sp.PIPE)
       pipe.stdout.readline()
       pipe.terminate()
       infos = pipe.stderr.read()
       infos_list = infos.split('\r\n')
       res = re.search(' \d+x\d+ ',infos)
       res = [int(x) for x in res.group(0).split('x')]
       return res
    res = getInfo()
    command = [ FFMPEG_BIN,
           '-i', INPUT_VID,
           '-f', 'image2pipe',
           '-pix_fmt', 'rgb24',
           '-vcodec', 'rawvideo', '-']
    pipe = sp.Popen(command, stdout = sp.PIPE, bufsize=10**8)
    n = 0
    im2 = []
    try:
       mog = cv2.BackgroundSubtractorMOG2(120,2,True)
       while True:
           raw_image = pipe.stdout.read(res[0]*res[1]*3)
           # transform the byte read into a numpy array
           image =  np.fromstring(raw_image, dtype='uint8')
           image = image.reshape((res[1],res[0],3))
           rgbImg = image.copy()

           fname = ('_tmp%03d.png'%time.time())
           cv2.imwrite(fname, rgbImg)
           # throw away the data in the pipe's buffer.
           #pipe.stdout.flush()
           n += 1
           print n
    except:
       print 'done',n
       pipe.kill()
       cv2.destroyAllWindows()

    When I run this, I get 10 images, but they all have a Blue Tint ! I cannot for the life of me figure out why. I’ve done tons of searches, I’ve tried quite a few different codecs (usually just messes things up worse). The media info for the video file is here :

    General
    Complete name                            : test.avi
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    File size                                : 85.0 KiB
    Duration                                 : 133ms
    Overall bit rate                         : 5 235 Kbps

    Video
    ID                                       : 0
    Format                                   : JPEG
    Codec ID                                 : MJPG
    Duration                                 : 133ms
    Bit rate                                 : 1 240 Kbps
    Width                                    : 640 pixels
    Height                                   : 480 pixels
    Display aspect ratio                     : 4:3
    Frame rate                               : 30.000 fps
    Color space                              : YUV
    Chroma subsampling                       : 4:2:2
    Bit depth                                : 8 bits
    Compression mode                         : Lossy
    Bits/(Pixel*Frame)                       : 0.135
    Stream size                              : 20.1 KiB (24%)

    Any suggestions ? It seems like it should be an RGB mixup...just not sure where at...

  • i have problem in python with Muxing video and audio

    2 février 2021, par Mahmoud Ahmed

    I want to merge files video and audio but I don't know how I did try many times to fix it with ffmpeg,subprocess and moviepy with a deferent ways so this my problem and I stop work on it here if someone can help me to edit it and send to me back please .

    &#xA;

    This is my code with a window .

    &#xA;

    from pytube import YouTube&#xA;from tkinter import *&#xA;from tqdm import tqdm&#xA;from os import startfile&#xA;import subprocess&#xA;import shutil&#xA;import pytube&#xA;import ffmpeg&#xA;import time&#xA;import sys&#xA;import os&#xA;#Functions&#xA;def download():&#xA;    video_url = url.get()&#xA;    try:&#xA;        youtube = pytube.YouTube(video_url)&#xA;        video   = youtube.streams.filter(adaptive=True,file_extension=&#x27;mp4&#x27;).order_by(&#x27;resolution&#x27;).desc().first()&#xA;        video.download(filename=&#x27;Dvideo&#x27;)&#xA;        audio = youtube.streams.get_by_itag(251).download(filename=&#x27;Daudio&#x27;)  #webm               &#xA;        notif.config(fg="green",text="Download is Completed")&#xA;&#xA;&#xA;&#xA;    except Exception as e:&#xA;        print(e)&#xA;        notif.config(fg="red",text="There is an Error in the Downloading Check Your url")&#xA;&#xA;def Merge():&#xA;    try:&#xA;        os.system("ffmpeg -i Dvideo.mp4 -i Daudio.webm -c:v copy -c:a aac output.mp4")&#xA;        #video = ffmpeg.input(&#x27;Dvideo.mp4&#x27;)&#xA;        #audio = ffmpeg.input(&#x27;Daudio.webm&#x27;)&#xA;        #out = ffmpeg.output(video, audio, r&#x27;final.mp4&#x27;, vcodec=&#x27;"avc1.640028&#x27;)&#xA;        #out.run()&#xA;&#xA;    except Exception as w:&#xA;        print(w)&#xA;        notif.config(fg="red",text="There is an Error in the Merge")&#xA;&#xA;#Main Screen&#xA;Window = Tk()&#xA;Window.title("Youtube Video Downloader ")&#xA;#The Labels of Texts &#xA;Label(Window, text="Youtube Video Converter \n By: Mahmoud Ahmed", fg="blue", font=("Calibri",15)).grid(sticky=N,padx=15,row=0)&#xA;Label(Window, text="Please enter the url of the Video u want to download it : ", font=("Calibri",12)).grid(sticky=N,row=1,pady=15)&#xA;Label(Window, text="Notice Any Downloading will be in the same file with this tool.", fg="orange", font=("Calibri",10)).grid(sticky=N,padx=15,row=8)&#xA;&#xA;#my_progress = ttk.Progressbar(Window,length=130, mode=&#x27;determinate&#x27;).grid(row= 9, pady=20)&#xA;&#xA;&#xA;notif = Label(Window,font=("Calibri",12))&#xA;notif.grid(sticky=N,pady=1,row=6)&#xA;#Variables&#xA;url = StringVar()&#xA;#The empty label for URL&#xA;Entry(Window,width=50,textvariable=url).grid(sticky=N,row=2)&#xA;#The Button&#xA;Button(Window,width=20,text="Download",font=("Calibri",12),command=download).grid(sticky=N,row=4,pady=15)&#xA;Button(Window,width=20,text="Merge",font=("Calibri",12),command=Merge).grid(sticky=N,row=5,pady=15)&#xA;#Button(Window,width=20,text="Info",font=("Calibri",12),command=download).grid(sticky=N,row=4,pady=15)&#xA;&#xA;Window.mainloop()&#xA;&#xA;

    &#xA;