Recherche avancée

Médias (91)

Autres articles (76)

  • La file d’attente de SPIPmotion

    28 novembre 2010, par

    Une file d’attente stockée dans la base de donnée
    Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
    Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...)

  • Ecrire une actualité

    21 juin 2013, par

    Présentez les changements dans votre MédiaSPIP ou les actualités de vos projets sur votre MédiaSPIP grâce à la rubrique actualités.
    Dans le thème par défaut spipeo de MédiaSPIP, les actualités sont affichées en bas de la page principale sous les éditoriaux.
    Vous pouvez personnaliser le formulaire de création d’une actualité.
    Formulaire de création d’une actualité Dans le cas d’un document de type actualité, les champs proposés par défaut sont : Date de publication ( personnaliser la date de publication ) (...)

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

  • mp3 to wav with ffmpeg reduces quality and duration

    25 novembre 2020, par Neret

    I took this mp3 file and converted it to wav with Audition and with this ffmpeg command :

    


    ffmpeg -i "Casey Don’t You Fret - Dan Lebowitz.mp3" -c:a pcm_f32le "Casey Don’t You Fret - Dan Lebowitz_FFMPEG.wav"


    


    After that I checked the statistics in Audition. The wav file which was generated with Audition has exactly the same statistics as the original mp3 file.

    


    enter image description here

    


    The duration of ffmpeg file has changed. Audio statistics became worse.
Why is this happening ? Can I fix it ?

    


    I used ffmpeg version 2020-11-22-git-0066bf4d1a-full_build-www.gyan.dev on Windows.

    


    UPDATE 1 :
I cut a few seconds of mp3 at the beginning and at the end :

    


    enter image description here

    


    FFMPEG added silence at the beginning and increased duration.

    


    UPDATE 2 :
Look how ffmpeg changed the waveform of this 2.mp3 file in the middle :

    


    ffmpeg -y -i 2.mp3 -c:a pcm_f32le 2_FFMPEG.wav


    


    enter image description here
enter image description here

    


  • Problem playing a sound with pydub Error : pydub.exceptions.CouldntDecodeError : Decoding failed. ffmpeg returned error code : 1

    28 mai 2020, par studioDKR

    I have a problem getting a file played in the browser with pydub. I think the function is working, but I just don't get the right file path to it, or something else is missing. Would love to get your help !

    



    I get the pydob error message : pydub.exceptions.CouldntDecodeError : Decoding failed. ffmpeg returned error code : 1

    



    Here is the error I get :

    



    [2020-05-28 16:04:33,023] ERROR in app: Exception on /overview [POST]
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/Micha/Documents/GitHub/podprod/app.py", line 109, in overview
    sound = AudioSegment.from_file(filepath)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pydub/audio_segment.py", line 723, in from_file
    raise CouldntDecodeError(
pydub.exceptions.CouldntDecodeError: Decoding failed. ffmpeg returned error code: 1

Output from ffmpeg/avlib:

b'ffmpeg version 4.2.3 Copyright (c) 2000-2020 the FFmpeg developers\n  built with Apple clang version 11.0.3 (clang-1103.0.32.59)\n  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.2.3 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags=-fno-stack-check --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libsoxr --enable-videotoolbox --disable-libjack --disable-indev=jack\n  libavutil      56. 31.100 / 56. 31.100\n  libavcodec     58. 54.100 / 58. 54.100\n  libavformat    58. 29.100 / 58. 29.100\n  libavdevice    58.  8.100 / 58.  8.100\n  libavfilter     7. 57.100 /  7. 57.100\n  libavresample   4.  0.  0 /  4.  0.  0\n  libswscale      5.  5.100 /  5.  5.100\n  libswresample   3.  5.100 /  3.  5.100\n  libpostproc    55.  5.100 / 55.  5.100\n/Users/Micha/documents/github/podprod/uploads/test2.wav: Invalid data found when processing input\n'


    



    This is the Flask route with the function I am writing.

    



    @app.route("/overview", methods=["GET", "POST"])
def overview():

    entries = []

    # Open a file
    path = app.config["FILE_UPLOADS"]

    with os.scandir(path) as dirs:
        for entry in dirs:
            entries.append(entry.name)

    if request.method == "POST":
        filename = request.form['filename']

        filepath = os.path.join(app.config["FILE_UPLOADS"], filename)

        # Play the sound
        sound = AudioSegment.from_file(filepath)
        play(sound)

        return render_template('overview.html', entries=entries)


    



    Here is the HTML template :

    



        {% extends &#x27;main_template.html&#x27; %}&#xA;&#xA;    {% block title %}PodProd Podcast Overview{% endblock %}&#xA;&#xA;    {% block main %}&#xA;&#xA;    <div class="container">&#xA;&#xA;        <h1>Here is an overview of your files</h1>&#xA;&#xA;        <table class="table table-striped">&#xA;            <tr>&#xA;                <th>Filename</th>&#xA;                <th>Action</th>&#xA;            </tr>&#xA;        {% for result in entries %}&#xA;            {% if ".wav" in result %}&#xA;                <tr>&#xA;                    <td>{{ result }}</td>&#xA;                    <td><form action="" method="POST"> <button type="submit" class="btn btn-primary" value="{{" result="result">Play</button></form>&#xA;                </td></tr>&#xA;            {% endif %}&#xA;        {% endfor %}&#xA;        </table>&#xA;&#xA;    </div>&#xA;&#xA;    {% endblock %}&#xA;

    &#xA;

  • FFMPEG Streaming to twitch low bitrate

    17 juillet 2020, par El_Presidente

    I have a python script that will produce frames for a video stream. To stream it to twitch I decided to use ffmpeg (as it is the only option I found). However, the bitrate of my stream is very low (70 KB), although in ffmpeg options it's set to 3000K.

    &#xA;

    # This script copies the video frame by frame&#xA;import cv2&#xA;import subprocess as sp&#xA;twitch_stream_key = &#x27;MY_TWITCH_STREAM_KEY&#x27;&#xA;input_file = &#x27;video.mp4&#x27;&#xA;&#xA;cap = cv2.VideoCapture(input_file)&#xA;ret, frame = cap.read()&#xA;height, width, ch = frame.shape&#xA;&#xA;ffmpeg = &#x27;FFMPEG&#x27;&#xA;dimension = &#x27;{}x{}&#x27;.format(width, height)&#xA;&#xA;fps = cap.get(cv2.CAP_PROP_FPS)&#xA;command = []&#xA;command.extend([&#xA;    &#x27;FFMPEG&#x27;,&#xA;    &#x27;-loglevel&#x27;, &#x27;verbose&#x27;,&#xA;    &#x27;-y&#x27;,  # overwrite previous file/stream&#xA;    &#x27;-analyzeduration&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-f&#x27;, &#x27;rawvideo&#x27;,&#xA;    &#x27;-r&#x27;, &#x27;%d&#x27; % fps,  # set a fixed frame rate&#xA;    &#x27;-vcodec&#x27;, &#x27;rawvideo&#x27;,&#xA;    # size of one frame&#xA;    &#x27;-s&#x27;, &#x27;%dx%d&#x27; % (width, height),&#xA;    &#x27;-pix_fmt&#x27;, &#x27;rgb24&#x27;,  # The input are raw bytes&#xA;    &#x27;-thread_queue_size&#x27;, &#x27;1024&#x27;,&#xA;    &#x27;-i&#x27;, &#x27;-&#x27;,  # The input comes from a pipe&#xA;])       &#xA;command.extend([&#xA;    &#x27;-ar&#x27;, &#x27;8000&#x27;,&#xA;    &#x27;-ac&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-f&#x27;, &#x27;s16le&#x27;,&#xA;    &#x27;-i&#x27;, &#x27;work.mp3&#x27;,&#xA;])&#xA;command.extend([&#xA;    # VIDEO CODEC PARAMETERS&#xA;    &#x27;-vcodec&#x27;, &#x27;libx264&#x27;,&#xA;    &#x27;-r&#x27;, &#x27;%d&#x27; % fps,&#xA;    &#x27;-b:v&#x27;, &#x27;3000k&#x27;,&#xA;    &#x27;-s&#x27;, &#x27;%dx%d&#x27; % (width, height),&#xA;    &#x27;-preset&#x27;, &#x27;faster&#x27;, &#x27;-tune&#x27;, &#x27;zerolatency&#x27;,&#xA;    &#x27;-crf&#x27;, &#x27;23&#x27;,&#xA;    &#x27;-pix_fmt&#x27;, &#x27;yuv420p&#x27;,&#xA;&#xA;    &#x27;-minrate&#x27;, &#x27;3000k&#x27;, &#x27;-maxrate&#x27;, &#x27;3000k&#x27;,&#xA;    &#x27;-bufsize&#x27;, &#x27;12000k&#x27;,&#xA;    &#x27;-g&#x27;, &#x27;60&#x27;,  # key frame distance&#xA;    &#x27;-keyint_min&#x27;, &#x27;1&#x27;,&#xA;&#xA;    # AUDIO CODEC PARAMETERS&#xA;    &#x27;-acodec&#x27;, &#x27;libmp3lame&#x27;, &#x27;-ar&#x27;, &#x27;44100&#x27;, &#x27;-b:a&#x27;, &#x27;160k&#x27;,&#xA;    # &#x27;-bufsize&#x27;, &#x27;8192k&#x27;,&#xA;    &#x27;-ac&#x27;, &#x27;1&#x27;,&#xA;    &#x27;-map&#x27;, &#x27;0:v&#x27;, &#x27;-map&#x27;, &#x27;1:a&#x27;,&#xA;&#xA;    &#x27;-threads&#x27;, &#x27;2&#x27;,&#xA;    # STREAM TO TWITCH&#xA;    &#x27;-f&#x27;, &#x27;flv&#x27;, &#x27;rtmp://live-hel.twitch.tv/app/%s&#x27; %&#xA;          twitch_stream_key&#xA;])&#xA;proc = sp.Popen(command, stdin=sp.PIPE, stderr=sp.PIPE)&#xA;&#xA;while True:&#xA;    ret, frame = cap.read()        &#xA;    if not ret:        &#xA;        break    &#xA;    proc.stdin.write(frame.tostring())&#xA;&#xA;cap.release()&#xA;proc.stdin.close()&#xA;proc.stderr.close()&#xA;proc.wait()&#xA;

    &#xA;

    How can I increase the bitrate ? Maybe you can point me towards some different solution on how I can stream python frames to twitch or any other rtmp server.

    &#xA;

    Here is the complete log, the audio is also broken, it's just noise :

    &#xA;

    ffmpeg version git-2020-06-01-dd76226 Copyright (c) 2000-2020 the FFmpeg developers&#xA;  built with gcc 9.3.1 (GCC) 20200523&#xA;  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-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-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf&#xA;  libavutil      56. 49.100 / 56. 49.100&#xA;  libavcodec     58. 90.100 / 58. 90.100&#xA;  libavformat    58. 44.100 / 58. 44.100&#xA;  libavdevice    58.  9.103 / 58.  9.103&#xA;  libavfilter     7. 84.100 /  7. 84.100&#xA;  libswscale      5.  6.101 /  5.  6.101&#xA;  libswresample   3.  6.100 /  3.  6.100&#xA;  libpostproc    55.  6.100 / 55.  6.100&#xA;Input #0, rawvideo, from &#x27;pipe:&#x27;:&#xA;  Duration: N/A, start: 0.000000, bitrate: 1443225 kb/s&#xA;    Stream #0:0: Video: rawvideo, 1 reference frame (RGB[24] / 0x18424752), rgb24, 1920x1080, 1443225 kb/s, 29 tbr, 29 tbn, 29 tbc&#xA;[s16le @ 0000026d64eb5340] Estimating duration from bitrate, this may be inaccurate&#xA;Guessed Channel Layout for Input Stream #1.0 : mono&#xA;Input #1, s16le, from &#x27;work.mp3&#x27;:&#xA;  Metadata:&#xA;    encoded_by      : iTunes v7.0&#xA;  Duration: 00:09:36.13, bitrate: 128 kb/s&#xA;    Stream #1:0: Audio: pcm_s16le, 8000 Hz, mono, s16, 128 kb/s&#xA;[tcp @ 0000026d64ee34c0] Starting connection attempt to 99.181.64.78 port 1935&#xA;[tcp @ 0000026d64ee34c0] Successfully connected to 99.181.64.78 port 1935&#xA;Stream mapping:&#xA;  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))&#xA;  Stream #1:0 -> #0:1 (pcm_s16le (native) -> mp3 (libmp3lame))&#xA;[graph 0 input from stream 0:0 @ 0000026d64f47c00] w:1920 h:1080 pixfmt:rgb24 tb:1/29 fr:29/1 sar:0/1&#xA;[scaler_out_0_0 @ 0000026d64f4c780] w:1920 h:1080 flags:&#x27;bicubic&#x27; interl:0&#xA;[scaler_out_0_0 @ 0000026d64f4c780] w:1920 h:1080 fmt:rgb24 sar:0/1 -> w:1920 h:1080 fmt:yuv420p sar:0/1 flags:0x4&#xA;[libx264 @ 0000026d64edf840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2&#xA;[libx264 @ 0000026d64edf840] profile High, level 4.0, 4:2:0, 8-bit&#xA;[libx264 @ 0000026d64edf840] 264 - core 160 - H.264/MPEG-4 AVC codec - Copyleft 2003-2020 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=4 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=2 lookahead_threads=2 sliced_threads=1 slices=2 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=1 keyint=60 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=0 rc=crf mbtree=0 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=3000 vbv_bufsize=12000 crf_max=0.0 nal_hrd=none filler=0 ip_ratio=1.40 aq=1:1.00&#xA;[graph_1_in_1_0 @ 0000026d651319c0] tb:1/8000 samplefmt:s16 samplerate:8000 chlayout:0x4&#xA;[format_out_0_1 @ 0000026d65132d80] auto-inserting filter &#x27;auto_resampler_0&#x27; between the filter &#x27;Parsed_anull_0&#x27; and the filter &#x27;format_out_0_1&#x27;&#xA;[auto_resampler_0 @ 0000026d651331c0] ch:1 chl:mono fmt:s16 r:8000Hz -> ch:1 chl:mono fmt:s16p r:44100Hz&#xA;Output #0, flv, to &#x27;rtmp://live-hel.twitch.tv/app/live_*************&#x27;:&#xA;  Metadata:&#xA;    encoder         : Lavf58.44.100&#xA;    Stream #0:0: Video: h264 (libx264), 1 reference frame ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080, q=-1--1, 3000 kb/s, 29 fps, 1k tbn, 29 tbc&#xA;    Metadata:&#xA;      encoder         : Lavc58.90.100 libx264&#xA;    Side data:&#xA;      cpb: bitrate max/min/avg: 3000000/0/3000000 buffer size: 12000000 vbv_delay: N/A&#xA;    Stream #0:1: Audio: mp3 (libmp3lame) ([2][0][0][0] / 0x0002), 44100 Hz, mono, s16p, delay 1105, 160 kb/s&#xA;    Metadata:&#xA;      encoder         : Lavc58.90.100 libmp3lame&#xA;

    &#xA;