Recherche avancée

Médias (2)

Mot : - Tags -/documentation

Autres articles (62)

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

  • Ajouter notes et légendes aux images

    7 février 2011, par

    Pour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
    Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
    Modification lors de l’ajout d’un média
    Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...)

  • MediaSPIP Player : problèmes potentiels

    22 février 2011, par

    Le lecteur ne fonctionne pas sur Internet Explorer
    Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
    Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)

Sur d’autres sites (9164)

  • OpenCv is giving error to play the downloaded video

    17 août 2015, par Prat_yow

    Program a code for a tiny system, which should run on Linux :
    - A routine (P) accepts strings from an unknown remote Internet source,
    which contain just an URL and a file name.
    - The URL and the file name point to a multimedia file, in our case a video
    - (P) separates the file name from the string
    - (P) checks if the file already exists on the system’s internal memory card, as
    (P) is running on a tiny Linux machine connected to a screen
    - If it does not exist, (P) downloads the video file from the given URL and
    stores it in the memory card
    - Finally, (P) opens the file and plays it as a full screen video (no external video
    player allowed !)
    - After this (P) starts from the beginning
    - There is no user action involved and nobody enters data by hand or mouse
    clicks

    I have written code in python. But when I run it it just not load the cv module. Can someone suggest if my approach is correct.? Will doing in java or other compiled language will be easy.?

    My code is :

    import os
    import urllib
    import cv
    import sys

    """
    The following program will take the url as input. Separate the file name of the video from the url
    and check if the file is present in the current memory location or not. If the same file is present
    it will indicate its presence. If the file is not present it will download the file and play it.

    urrlib: to download the video file.
    cv: For playing the video.

    """

    #NOTE Configuration of FFMPEG and OpenCV  is required.
    #NOTE Assuming that the given code is execute from the internal memory location.
    #NOTE Assuming the URL is of the form <initial part="part" of="of" the="the" url="url"></initial><filename>.<format>

    sys.path.append('/opt/ros/hydro/lib/python2.7/dist-packages')

    def myVideo(url):
       search_folder = "."
       videoFile = url.split('/')[-1].split('#')[0].split('?')[0] #stripping the name of the file.

       for root, dirs, files in os.walk(search_folder): # using the os.walk module to find the files.
           for name in files:
               #print os.path.join(name)

               """Checking the videofile in the current directory and the sub-directories"""

               if videoFile == os.path.join(name):  #checking if the file is already present in the internal memory.
                   print "The file is already present in the internal memory"
                   return -1  # Returning the confirmation that the file is present.

               else:
                   print "Downloading the file"
                   video = urllib.FancyURLopener() #downloading the file using urllib.
                   video.retrieve(url,videoFile)

                   curDir = os.getcwd()   # getting the current working directory.
                   fullVideoPath = os.path.join(curDir,videoFile)  # Making the full path of the video file.

                   """For playing the file using openCV first read the file.
                   Find the number of frames and the frame rate.
                   Finally use these parameters to display each extracted frame on the screen"""

                   vFile = cv.CaptureFromFile(fullVideoPath)
                   nFrames = int(  cv.GetCaptureProperty( vidFile, cv.CV_CAP_PROP_FRAME_COUNT ) ) #Number of frames in the video.
                   fps = cv.GetCaptureProperty( vidFile, cv.CV_CAP_PROP_FPS ) # Frame rate
                   waitPerFrameInMillisec = int( 1/fps * 1000/1 ) # Wait time between frames.

                   for f in xrange( nFrames ):
                       frameImg = cv.QueryFrame( vidFile )
                       cv.ShowImage( "My Show",  frameImg )
                       cv.WaitKey( waitPerFrameInMillisec  )

                   cv.DestroyWindow( "My Show" ) # Deleting the window once the playing is done.
                   return 1 # returning the confimation that the file was played successfully.

    if __name__ == "__main__":
       url = "http://techslides.com/demos/sample-videos/small.mp4"
       myVideo(url)
    </format></filename>
  • Issue opening video file with OpenCV VideoCapture

    1er mai 2017, par user1938805

    I’ve been reviewing the multitudes of similar questions for this issue, but I’m afraid I just cannot figure out why I cannot open a file in opencv

    I have a file "small.avi", which is a reencoding of "small.mp4" that I got from the internet. I reencoded it with ffmpeg -i small.mp4 small.avi, and I did this because I couldn’t open a mp4 file either and online it recommended trying an avi format first.

    Here is my code (mostly copied from a tutorial, with a few lines to show some relevant info) :

    import cv2
    import os

    for _, __, files in os.walk("."):
       for file in files:
           print file
    print ""

    cap = cv2.VideoCapture("small.mp4")
    print cap.isOpened()
    print cap.open("small.avi")
    i = 0
    while cap.isOpened() and i &lt; 10:
       i += 1
       ret, frame = cap.read()
       print "read a frame"
       gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
       cv2.imshow('frame', gray)
       if cv2.waitKey(1) &amp; 0xFF == ord('q'):
           break
    cap.release()
    cv2.destroyAllWindows()

    This produces the following output :

    "A:\Program Files\AnacondaPY\Anaconda\python.exe" A:/Documents/Final/VideoProcessor.py
    small.avi
    small.mp4
    VideoProcessor.py

    False
    False

    Process finished with exit code 0

    My program does not appear to properly open either file. Following the advice of

    Can not Read or Play a Video in OpenCV+Python using VideoCapture

    and

    Cannot open ".mp4" video files using OpenCV 2.4.3, Python 2.7 in Windows 7 machine,

    I found my cv2 version to be 3.0.0, went to

    A :\Downloads\opencv\build\x86\vc12\bin

    and copied the file opencv_ffmpeg300.dll to

    A :\Program Files\AnacondaPY\Anaconda

    Despite this, the code still does not successfully open the video file. I even tried the x64 versions, and tried naming the file opencv_ffmpeg.dll, opencv_ffmpeg300.dll, and opencv_ffmpeg300_64.dll (for the x64 version). Is there anything else I can try to fix this ?

    Thanks for any help

  • FFMpeg batch convert video files hangs

    13 juin 2017, par Benson Chang

    I have some .avi file contains video encoded in h264, and I would like to change to .mp4 and change the rates if needed. You can see the code used to convert below. My problem is that ffmpeg will hang when I try to convert all files, and the file it hangs changes from time to time, I wonder why ? Below the code is the output where ffmpeg hangs. I’m running under windows 10, python 2.7.

    import subprocess
    import os

    def convert(fileName):
       sourceFile = fileName
       print sourceFile.split('.')
       targetFile = fileName.split('.')[0] + ".mp4"
       subprocess.call(['ffmpeg', '-y', '-i', sourceFile, '-r',
            '30000/1001', '-b:a', '2M', '-bt', '4M', '-vcodec',
             'libx264', '-pass', '1', '-coder', '0', '-bf', '0',
              '-flags', '-loop', '-wpredp', '0', '-an', targetFile])



    # Set the directory you want to start from
    def convertBatch(rootDir = '.'):
       for dirName, subdirList, fileList in os.walk(rootDir):
           print('Found directory: %s' % dirName)

           for fname in fileList:
               if fname.endswith(".avi"):
                   convert('%s/%s' % (dirName,fname))
                   #os.remove('%s/%s' % (dirName,fname))


    convertBatch("F:\\data\\mp4")

    ffmpeg version 3.1.4 Copyright (c) 2000-2016 the FFmpeg developers
     built with gcc 5.4.0 (GCC)
     configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-libebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
     libavutil      55. 28.100 / 55. 28.100
     libavcodec     57. 48.101 / 57. 48.101
     libavformat    57. 41.100 / 57. 41.100
     libavdevice    57.  0.101 / 57.  0.101
     libavfilter     6. 47.100 /  6. 47.100
     libswscale      4.  1.100 /  4.  1.100
     libswresample   2.  1.100 /  2.  1.100
     libpostproc    54.  0.100 / 54.  0.100
    Input #0, avi, from 'filename.avi':
     Metadata:
       encoder         : Lavf57.56.100
     Duration: 00:00:01.00, start: 0.000000, bitrate: 611 kb/s
       Stream #0:0: Video: h264 (Constrained Baseline) (x264 / 0x34363278), yuv420p, 1024x1024, 578 kb/s, 30 fps, 30 tbr, 30 tbn, 60 tbc
    Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (F:\data\mp4_1_16\11\14\512/11_14_512_16.mp4) 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.
    [libx264 @ 00000000028e42c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 AVX2 LZCNT BMI2
    [libx264 @ 00000000028e42c0] profile Constrained Baseline, level 3.2
    [libx264 @ 00000000028e42c0] 264 - core 148 r2721 72d53ab - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=0 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=18 lookahead_threads=6 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 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
    [mp4 @ 0000000002bd00a0] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
    Output #0, mp4, to 'filename.mp4':
     Metadata:
       encoder         : Lavf57.41.100
       Stream #0:0: Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1024x1024, q=-1--1, 29.97 fps, 30k tbn, 29.97 tbc
       Metadata:
         encoder         : Lavc57.48.101 libx264
       Side data:
         cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream mapping:
     Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
    Press [q] to stop, [?] for help