Recherche avancée

Médias (3)

Mot : - Tags -/Valkaama

Autres articles (111)

  • Submit bugs and patches

    13 avril 2011

    Unfortunately a software is never perfect.
    If you think you have found a bug, report it using our ticket system. Please to help us to fix it by providing the following information : the browser you are using, including the exact version as precise an explanation as possible of the problem if possible, the steps taken resulting in the problem a link to the site / page in question
    If you think you have solved the bug, fill in a ticket and attach to it a corrective patch.
    You may also (...)

  • Publier sur MédiaSpip

    13 juin 2013

    Puis-je poster des contenus à partir d’une tablette Ipad ?
    Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir

  • HTML5 audio and video support

    13 avril 2011, par

    MediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
    The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
    For older browsers the Flowplayer flash fallback is used.
    MediaSPIP allows for media playback on major mobile platforms with the above (...)

Sur d’autres sites (13887)

  • Unable to open audio file on Heroku using Librosa

    15 mars 2020, par Rohan Bojja

    I have a feature extraction REST API written in Python using the Librosa library (Extracting audio features), it receives an audio file through HTTP POST and responds with a list of features(such as MFCC,etc).

    Since librosa depends on SoundFile (libsndfile1 / libsndfile-dev), it doesn’t support all the formats, I’m converting the audio file using ffmpeg-python wrapper (https://kkroening.github.io/ffmpeg-python/) .

    It works just fine on my Windows 10 machine with Conda, but when I deploy it on Heroku, the librosa.load() functions returns an unknown format error, no matter what format I convert it to. I have tried FLAC, AIFF and WAV.

    My first guess is that the converted format isn’t supported by libsndfile1, but it works on my local server (plus, their documentation says AIFF and WAV are supported), so I’m a little lost.

    I have attached all the relevant snippets of code below, I can provide anything extra if necessary. Any help is highly appreciated. Thanks.

    UPDATE1 :

    I am using pipes instead of writing and reading from disk, worth a mention as the question could be misleading otherwise.

    The log :

    File "/app/app.py", line 31, in upload
    x , sr = librosa.load(audioFile,mono=True,duration=5)
    File "/app/.heroku/python/lib/python3.6/site-packages/librosa/core/audio.py", line 164, in load
    six.reraise(*sys.exc_info())
    File "/app/.heroku/python/lib/python3.6/site-packages/six.py", line 703, in reraise
    raise value
    File "/app/.heroku/python/lib/python3.6/site-packages/librosa/core/audio.py", line 129, in load
    with sf.SoundFile(path) as sf_desc:
    File "/app/.heroku/python/lib/python3.6/site-packages/soundfile.py", line 629, in __init__
    self._file = self._open(file, mode_int, closefd)
    File "/app/.heroku/python/lib/python3.6/site-packages/soundfile.py", line 1184, in _open
    "Error opening {0!r}: ".format(self.name))
    File "/app/.heroku/python/lib/python3.6/site-packages/soundfile.py", line 1357, in _error_check
    raise RuntimeError(prefix + _ffi.string(err_str).decode('utf-8', 'replace'))
    RuntimeError: Error opening <_io.BytesIO object at 0x7f46ad28beb8>: File contains data in an unknown format.
    10.69.244.94 - - [15/Mar/2020:12:37:28 +0000] "POST /receiveWav HTTP/1.1" 500 290 "-" "curl/7.55.1"

    Flask/Librosa code deployed on Heroku (app.py) :

    from flask import Flask, jsonify, request
    import scipy.optimize
    import os,pickle
    import numpy as np
    from sklearn.preprocessing import StandardScaler
    import librosa
    import logging
    import soundfile as sf
    from pydub import AudioSegment
    import subprocess as sp
    import ffmpeg
    from io import BytesIO

    logging.basicConfig(level=logging.DEBUG)

    app = Flask(__name__)

    @app.route('/receiveWav',methods = ['POST'])
    def upload():
       if(request.method == 'POST'):
           f = request.files['file']
           app.logger.info(f'AUDIO FORMAT\n\n\n\n\n\n\n\n\n\n: {f}')
           proc = (
               ffmpeg.input('pipe:')
               .output('pipe:', format='aiff')
               .run_async(pipe_stdin=True,pipe_stdout=True, pipe_stderr=True)
           )
           audioFile,err = proc.communicate(input=f.read())
           audioFile =  BytesIO(audioFile)
           scaler = pickle.load(open("scaler.ok","rb"))
           x , sr = librosa.load(audioFile,mono=True,duration=5)
           y=x
           #Extract the features
           chroma_stft = librosa.feature.chroma_stft(y=y, sr=sr)
           spec_cent = librosa.feature.spectral_centroid(y=y, sr=sr)
           spec_bw = librosa.feature.spectral_bandwidth(y=y, sr=sr)
           rolloff = librosa.feature.spectral_rolloff(y=y, sr=sr)
           zcr = librosa.feature.zero_crossing_rate(y)
           rmse = librosa.feature.rms(y=y)
           mfcc = librosa.feature.mfcc(y=y, sr=sr)
           features = f'{np.mean(chroma_stft)} {np.mean(rmse)} {np.mean(spec_cent)} {np.mean(spec_bw)} {np.mean(rolloff)} {np.mean(zcr)}'    
           for e in mfcc:
               features += f' {np.mean(e)}'
           input_data2 = np.array([float(i) for i in features.split(" ")]).reshape(1,-1)
           input_data2 = scaler.transform(input_data2)
           return jsonify(input_data2.tolist())

    # driver function
    if __name__ == '__main__':  
       app.run(debug = True)

    Aptfile :

    libsndfile1
    libsndfile-dev
    libav-tools
    libavcodec-extra-53
    libavcodec-extra-53
    ffmpeg

    requirements.txt :

    aniso8601==8.0.0
    audioread==2.1.8
    certifi==2019.11.28
    cffi==1.14.0
    Click==7.0
    decorator==4.4.2
    ffmpeg-python==0.2.0
    Flask==1.1.1
    Flask-RESTful==0.3.8
    future==0.18.2
    gunicorn==20.0.4
    itsdangerous==1.1.0
    Jinja2==2.11.1
    joblib==0.14.1
    librosa==0.7.2
    llvmlite==0.31.0
    MarkupSafe==1.1.1
    marshmallow==3.2.2
    numba==0.48.0
    numpy==1.18.1
    pycparser==2.20
    pydub==0.23.1
    pytz==2019.3
    resampy==0.2.2
    scikit-learn==0.22.2.post1
    scipy==1.4.1
    six==1.14.0
    SoundFile==0.10.3.post1
    Werkzeug==1.0.0
    wincertstore==0.2
  • i am getting when i am trying to run Ffmpegrabberframe on alpine image [closed]

    18 mars 2020, par avinash tiwari

    # # A fatal error has been detected by the Java Runtime Environment :

    # SIGSEGV (0xb) at pc=0x000000000000dc56, pid=446, tid=0x00007fd3c478db20 # # JRE version : OpenJDK Runtime Environment

    (8.0_242-b08) (build 1.8.0_242-b08) # Java VM : OpenJDK 64-Bit Server
    VM (25.242-b08 mixed mode linux-amd64 compressed oops) # Derivative :
    IcedTea 3.15.0 # Distribution : Custom build (Wed Jan 29 10:43:50 UTC
    2020) # Problematic frame : # C 0x000000000000dc56 # # Failed to
    write core dump. Core dumps have been disabled. To enable core
    dumping, try "ulimit -c unlimited" before starting Java again # # An
    error report file with more information is saved as : #
    /builds/had/tip/asset-delivery/firstgen-ingestion---backend/hs_err_pid446.log

    # If you would like to submit a bug report, please include # instructions on how to reproduce the bug and visit : #

    https://icedtea.classpath.org/bugzilla # Exception in thread
    "Thread-8" java.io.EOFException at
    java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:3015)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1576)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:465)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:423)
    at
    org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1$React.react(Framework.scala:818)
    at
    org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1.run(Framework.scala:807)

    def extractAVI(rawDrivePath: String): List[String] = {
       var errorList: List[String] = List.empty
       FileUtils.listFiles(new File(rawDrivePath), new SuffixFileFilter(".avi"), TrueFileFilter.INSTANCE)
         .asScala.toList.foreach(aviFile => {
         var grabber: FFmpegFrameGrabber = null
         var aviStream: InputStream = null
         var isFailedExtraction: Boolean = false
         try {
           LOGGER.info(s"--------inside try----------${aviFile.getAbsolutePath}")
           aviStream = new FileInputStream(aviFile.getAbsolutePath)
           LOGGER.info("--------create grabber----------")
           grabber = new FFmpegFrameGrabber(aviStream)
           LOGGER.info("--------created grabber extraction of drives----------")
           grabber.start()
           LOGGER.info("--------start grabber of drives----------")
           var count: Int = 1
           for (frame <- Iterator.continually(grabber.grabImage()).takeWhile(_ != null)) {
             ImageIO.write(converter.convert(frame), "jpg", new File(aviFile.getParent, "capture-" + count + ".jpg"))
             count += 1
           }
           grabber.stop()
         } catch {
           case ex: Exception => {
             LOGGER.info(s"Error while extracting images for ${aviFile.getAbsolutePath} {}", ex)
             errorList :+= s"${aviFile.getAbsolutePath.replace(rawDrivePath, "")} -> ${ex.getMessage}"
             isFailedExtraction = true
             LOGGER.info("last inside catch")
           }
         } finally {
           // Close the video file
           LOGGER.info(s"inside finally ")
           if (grabber != null)
             grabber.release()
           if (aviStream != null)
             aviStream.close()
           if (aviFile.exists() && !isFailedExtraction) {
             LOGGER.debug(s"Deleting ${aviFile.getAbsolutePath}")
             FileUtils.deleteQuietly(aviFile)
           }
         }
       })
  • FFmpeg psycho-visual options - psy-rdoq

    7 avril 2020, par SLVR

    I'm new to encoding and I like to do my encodings in x265 10bit. Currently, I'm facing a little issue with ffmpeg. I noticed when I'm using libx265 encoder output file looks a little bit blurred or small detail loss. Code I used to do my encodes is

    



    ffmpeg -i input.mp4 -c:v libx265 -preset medium -crf 22 -pix_fmt yuv420p10le -c:a copy -y output-x26510bit.mkv


    



    I've found out psycho-visual options might help in this case. I modified my code in to

    



    ffmpeg -i input.mp4 -c:v libx265 -preset medium -crf 22 -pix_fmt yuv420p10le -psy-rd 2 -psy-rdoq 4 --rdoq-level 1 -c:a copy -y output-x26510bit.mkv


    



    When I issue the above command, I get an error code

    



    C:\Users\abc\Desktop\1>ffmpeg -i input.mp4 -c:v libx265 -preset medium -crf 22 -pix_fmt yuv420p10le -psy-rd 2 -psy-rdoq
 4 -rdoq-level 1 -c:a copy -y output-x26510bit.mkv
ffmpeg version git-2020-04-03-52523b6 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 9.3.1 (GCC) 20200328
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enabl
e-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enab
le-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enabl
e-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --
enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-l
ibvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom
--enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --en
able-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
  libavutil      56. 42.102 / 56. 42.102
  libavcodec     58. 77.101 / 58. 77.101
  libavformat    58. 42.100 / 58. 42.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 77.101 /  7. 77.101
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Unrecognized option 'psy-rdoq'.
Error splitting the argument list: Option not found


    



    How do I solve this issue