Recherche avancée

Médias (91)

Autres articles (63)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

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

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

  • Powershell Script Exits Handbrake CLI

    23 décembre 2014, par Arnav Attri

    With the help of google, I workaround a Powershell script for handbrake automation. Now, the issue is when the source folder is empty the Powershell script exits.

    Here’s the scenario :

    1. I downloaded someone files - automated via RSS.
    2. They are placed in source folder.
    3. Powershell script works and encoding starts and successfully gets over.
    4. Now, when the encode is completed and in case of new download/file doesn’t arrive in the source folder, the script exits.

    Code is in PasteBin which has more comments but should be easy to infer what the script does

    $inputpath = "I:\S"
    $outputpath = "I:\E"

    $movies = ls $inputpath

    foreach($movie in $movies){
       $name = $movie.basename

       if(!(test-path -path "$outputpath\$name.mkv")){
           C:\"Program Files"\handbrake\HandBrakeCLI.exe -i "$inputpath\$movie" -o "$outputpath\$name.mkv" `
           -e x264 -b 1000 -2 -T -a 1,1 -E mp3 -B 112 --mixdown stereo -f mkv --detelecine --decomb `
           --loose-anamorphic -m -x rc-lookahead=30:ref=4:bframes=3:me=umh:subme=9:analyse=none:deblock=1:0:0:8x8dct=1
       }
    }
  • 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...

  • FFMpeg Command work in command line, but not in python script. (Semi Solved)

    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...

    EDIT : So I fixed the problem by switching the blue and red channels with this code :
    bChannel = rgbImg[ :, :,0]
    rChannel = rgbImg[ :, :,2]
    gChannel = rgbImg[ :, :,1]

               rgbArray = np.zeros((res[1],res[0],3), 'uint8')
               rgbArray[...,0] = rChannel
               rgbArray[...,1] = gChannel
               rgbArray[...,2] = bChannel

    So I guess this is now a question of, why is python mixing up these channels ? Is it a problem with python, or ffmpeg, the codec ?

    Thanks !